generated from moderneinc/rewrite-recipe-starter
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adopt the recipe-library Gradle plugin (#5)
* Adopt the recipe-library Gradle plugin Might fail to run the Kotlin tests... * Update settings.gradle.kts * Remove duplicated Gradle wrapper validation
- Loading branch information
Showing
3 changed files
with
45 additions
and
113 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,17 @@ | ||
import nebula.plugin.contacts.Contact | ||
import nebula.plugin.contacts.ContactsExtension | ||
import nebula.plugin.release.NetflixOssStrategies | ||
import nebula.plugin.release.git.base.ReleasePluginExtension | ||
import java.net.URI | ||
|
||
plugins { | ||
id("org.openrewrite.build.recipe-library") version "latest.release" | ||
} | ||
|
||
configure<ReleasePluginExtension> { | ||
defaultVersionStrategy = NetflixOssStrategies.SNAPSHOT(project) | ||
} | ||
|
||
group = "net.sghill.jenkins" | ||
description = "Jenkins Rewrite recipes." | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
group = "org.openrewrite.recipe" | ||
description = "A rewrite module automating migrations for Jenkins" | ||
|
||
val rewriteVersion = rewriteRecipe.rewriteVersion.get() | ||
dependencies { | ||
compileOnly("org.projectlombok:lombok:latest.release") | ||
compileOnly("com.google.code.findbugs:jsr305:latest.release") | ||
annotationProcessor("org.projectlombok:lombok:latest.release") | ||
implementation(platform(libs.rewrite.recipe.bom)) | ||
implementation(platform(libs.rewrite.bom)) | ||
|
||
implementation(platform("org.openrewrite:rewrite-bom:$rewriteVersion")) | ||
|
||
implementation("org.rocksdb:rocksdbjni:7.2.2") | ||
implementation("org.openrewrite:rewrite-java") | ||
|
@@ -36,13 +23,10 @@ dependencies { | |
implementation("com.google.inject:guice:6.+") | ||
implementation("org.eclipse.sisu:org.eclipse.sisu.inject:latest.release") | ||
implementation("org.apache.maven.wagon:wagon-http-lightweight:latest.release") | ||
// implementation("org.eclipse.aether:aether-api:latest.release") | ||
// implementation("org.eclipse.aether:aether-impl:latest.release") | ||
// implementation("org.apache.maven:waggon-http-lightweight:latest.release") | ||
|
||
testImplementation("org.ow2.asm:asm:latest.release") | ||
|
||
testImplementation(platform(libs.junit.bom)) | ||
testImplementation(platform("org.junit:junit-bom:latest.release")) | ||
testImplementation("org.junit.jupiter:junit-jupiter-api") | ||
testImplementation("org.junit.jupiter:junit-jupiter-params") | ||
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine") | ||
|
@@ -55,76 +39,3 @@ dependencies { | |
testRuntimeOnly("com.google.code.findbugs:jsr305:3.0.2") | ||
testRuntimeOnly("org.slf4j:slf4j-simple:1.7.36") | ||
} | ||
|
||
tasks.test { | ||
useJUnitPlatform() | ||
jvmArgs = listOf("-XX:+UnlockDiagnosticVMOptions", "-XX:+ShowHiddenFrames") | ||
} | ||
|
||
configure<ContactsExtension> { | ||
val j = Contact("[email protected]") | ||
j.moniker("Steve Hill") | ||
j.github("sghill") | ||
people["[email protected]"] = j | ||
} | ||
|
||
tasks.withType<JavaCompile>().configureEach { | ||
options.encoding = "UTF-8" | ||
options.compilerArgs.addAll(listOf("-parameters")) | ||
} | ||
|
||
configure<PublishingExtension> { | ||
publications { | ||
named("nebula", MavenPublication::class.java) { | ||
suppressPomMetadataWarningsFor("runtimeElements") | ||
} | ||
} | ||
} | ||
|
||
val targetRepo: Provider<URI> = providers.provider { | ||
if (version.toString().endsWith("SNAPSHOT")) { | ||
uri("https://oss.sonatype.org/content/repositories/snapshots/") | ||
} else { | ||
uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/") | ||
} | ||
} | ||
|
||
publishing { | ||
repositories { | ||
repositories { | ||
maven { | ||
url = targetRepo.get() | ||
credentials { | ||
username = providers.gradleProperty("ossrhUsername").getOrElse("Unknown user") | ||
password = providers.gradleProperty("ossrhPassword").getOrElse("Unknown password") | ||
} | ||
} | ||
} | ||
} | ||
publications { | ||
named<MavenPublication>("nebula") { | ||
pom { | ||
licenses { | ||
license { | ||
name.set("The Apache License, Version 2.0") | ||
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt") | ||
} | ||
} | ||
scm { | ||
connection.set("scm:git:https://github.com/sghill/rewrite-jenkins.git") | ||
developerConnection.set("scm:git:[email protected]:sghill/rewrite-jenkins.git") | ||
url.set("https://github.com/sghill/rewrite-jenkins") | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
signing { | ||
sign(publishing.publications["nebula"]) | ||
useGpgCmd() | ||
} | ||
|
||
tasks.withType<Sign>() { | ||
onlyIf { gradle.taskGraph.hasTask(":publish") } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,45 @@ | ||
rootProject.name = "rewrite-jenkins" | ||
|
||
dependencyResolutionManagement { | ||
versionCatalogs { | ||
create("libs") { | ||
library("junit-bom", "org.junit", "junit-bom").version { | ||
strictly("[5.9.1, 6.0.0[") | ||
pluginManagement { | ||
repositories { | ||
mavenLocal() | ||
gradlePluginPortal() | ||
} | ||
} | ||
|
||
plugins { | ||
id("com.gradle.enterprise") version "latest.release" | ||
id("com.gradle.common-custom-user-data-gradle-plugin") version "latest.release" | ||
} | ||
|
||
gradleEnterprise { | ||
val isCiServer = System.getenv("CI")?.equals("true") ?: false | ||
server = "https://ge.openrewrite.org/" | ||
val gradleCacheRemoteUsername: String? = System.getenv("GRADLE_ENTERPRISE_CACHE_USERNAME") | ||
val gradleCacheRemotePassword: String? = System.getenv("GRADLE_ENTERPRISE_CACHE_PASSWORD") | ||
|
||
buildCache { | ||
remote(HttpBuildCache::class) { | ||
url = uri("https://ge.openrewrite.org/cache/") | ||
isPush = isCiServer | ||
if (!gradleCacheRemoteUsername.isNullOrBlank() && !gradleCacheRemotePassword.isNullOrBlank()) { | ||
credentials { | ||
username = gradleCacheRemoteUsername | ||
password = gradleCacheRemotePassword | ||
} | ||
} | ||
library("rewrite-bom", "org.openrewrite:rewrite-bom:8.1.2") | ||
library("rewrite-recipe-bom", "org.openrewrite.recipe:rewrite-recipe-bom:2.0.1") | ||
} | ||
} | ||
|
||
buildScan { | ||
capture { | ||
isTaskInputFiles = true | ||
} | ||
|
||
isUploadInBackground = !isCiServer | ||
|
||
publishAlways() | ||
this as com.gradle.enterprise.gradleplugin.internal.extension.BuildScanExtensionWithHiddenFeatures | ||
publishIfAuthenticated() | ||
} | ||
} |