From d80ae99acbcd5df6dfbb05946d3da2e833ed5e2f Mon Sep 17 00:00:00 2001 From: Paul Merlin Date: Fri, 13 Dec 2019 12:03:45 +0100 Subject: [PATCH 1/4] Use type safe accessor to JavaPluginExtension Signed-off-by: Paul Merlin --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index f32134d3..1979c774 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -15,7 +15,7 @@ repositories { jcenter() } -configure { +java { sourceCompatibility = VERSION_1_8 targetCompatibility = VERSION_1_8 } From 69730986c4e9b7558ef059bd72e99de80bc8f64c Mon Sep 17 00:00:00 2001 From: Paul Merlin Date: Fri, 13 Dec 2019 12:04:39 +0100 Subject: [PATCH 2/4] Simplify testGradle task rule declaration Signed-off-by: Paul Merlin --- build.gradle.kts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 1979c774..3dedeb45 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -98,13 +98,12 @@ tasks.addRule("Pattern: testGradle") { val taskName = this if (!taskName.startsWith("testGradle")) return@addRule tasks.register(taskName) { - val t = this val gradleVersion = taskName.substringAfter("testGradle") - t.systemProperty("gradle.under.test", gradleVersion) - t.useJUnit { + systemProperty("gradle.under.test", gradleVersion) + useJUnit { includeCategories("org.jenkinsci.gradle.plugins.jpi.UsesGradleTestKit") } - t.onlyIf { + onlyIf { gradleVersion.startsWith('4') && System.getProperty("java.specification.version") == "1.8" || gradleVersion.startsWith('5') } From 051dd72b77dec07c3b3e49638d620d030951cc36 Mon Sep 17 00:00:00 2001 From: Paul Merlin Date: Fri, 13 Dec 2019 12:07:01 +0100 Subject: [PATCH 3/4] Simplify Gradle version test task dependency wiring by using the task.check type safe accessor to the check task Signed-off-by: Paul Merlin --- build.gradle.kts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 3dedeb45..69ad000d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -110,10 +110,9 @@ tasks.addRule("Pattern: testGradle") { } } -val check = tasks.getByPath("check") setOf("4.10.3", "5.6.4") .map { tasks.named("testGradle$it") } - .forEach { check.dependsOn(it) } + .forEach { tasks.check { dependsOn(it) } } tasks.withType().configureEach { testLogging { From 4f608f1a309a316ecb2bf792906c686650bd76fa Mon Sep 17 00:00:00 2001 From: Paul Merlin Date: Fri, 13 Dec 2019 12:07:48 +0100 Subject: [PATCH 4/4] Simplify codenarcTest configuration by using task type safe accessor Signed-off-by: Paul Merlin --- build.gradle.kts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 69ad000d..4eae3a9b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -125,10 +125,8 @@ codenarc { configFile = file("config/codenarc/rules.groovy") } -project.withGroovyBuilder { - "codenarcTest" { - setProperty("configFile", file("config/codenarc/rules-test.groovy")) - } +tasks.codenarcTest { + configFile = file("config/codenarc/rules-test.groovy") } group = "org.jenkins-ci.tools"