From a0b244ed39e4c2c172b310c1cb87d0391b28c031 Mon Sep 17 00:00:00 2001 From: Tim te Beek Date: Thu, 29 Jun 2023 20:49:55 +0200 Subject: [PATCH 1/3] Adopt the recipe-library Gradle plugin Might fail to run the Kotlin tests... --- build.gradle.kts | 99 +++--------------------------------------------- 1 file changed, 5 insertions(+), 94 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index c87ca89..7a43006 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -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 { - 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,9 +23,6 @@ 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") @@ -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 { - val j = Contact("sghill.dev@gmail.com") - j.moniker("Steve Hill") - j.github("sghill") - people["sghill.dev@gmail.com"] = j -} - -tasks.withType().configureEach { - options.encoding = "UTF-8" - options.compilerArgs.addAll(listOf("-parameters")) -} - -configure { - publications { - named("nebula", MavenPublication::class.java) { - suppressPomMetadataWarningsFor("runtimeElements") - } - } -} - -val targetRepo: Provider = 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("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:git@github.com:sghill/rewrite-jenkins.git") - url.set("https://github.com/sghill/rewrite-jenkins") - } - } - } - } -} - -signing { - sign(publishing.publications["nebula"]) - useGpgCmd() -} - -tasks.withType() { - onlyIf { gradle.taskGraph.hasTask(":publish") } -} From d588c3d3770dcf2622134238ac5c27d50fbff178 Mon Sep 17 00:00:00 2001 From: Tim te Beek Date: Thu, 29 Jun 2023 21:02:47 +0200 Subject: [PATCH 2/3] Update settings.gradle.kts --- build.gradle.kts | 2 +- settings.gradle.kts | 46 ++++++++++++++++++++++++++++++++++++++------- 2 files changed, 40 insertions(+), 8 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 7a43006..26399ac 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -26,7 +26,7 @@ dependencies { 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") diff --git a/settings.gradle.kts b/settings.gradle.kts index b5940e1..f105e7e 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -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() + } } From 610b378f84a96b73e4a6a76138fe150727522ca3 Mon Sep 17 00:00:00 2001 From: Tim te Beek Date: Thu, 29 Jun 2023 21:05:08 +0200 Subject: [PATCH 3/3] Remove duplicated Gradle wrapper validation --- .github/workflows/gradle-wrapper-validation.yml | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 .github/workflows/gradle-wrapper-validation.yml diff --git a/.github/workflows/gradle-wrapper-validation.yml b/.github/workflows/gradle-wrapper-validation.yml deleted file mode 100644 index 420d80c..0000000 --- a/.github/workflows/gradle-wrapper-validation.yml +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: "Validate Gradle Wrapper" -on: [push, pull_request] - -jobs: - validation: - name: "Validation" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: gradle/wrapper-validation-action@v1