diff --git a/aop/build.gradle b/aop/build.gradle index f103477d9b..ed85572b8e 100644 --- a/aop/build.gradle +++ b/aop/build.gradle @@ -12,7 +12,7 @@ dependencies { compileOnly libs.kotlinx.coroutines.core } -compileKotlin { +tasks.named("compileKotlin") { kotlinOptions.jvmTarget = "1.8" kotlinOptions.languageVersion = "1.6" } diff --git a/benchmarks/build.gradle b/benchmarks/build.gradle index 19a67d966c..3d3a7353a9 100644 --- a/benchmarks/build.gradle +++ b/benchmarks/build.gradle @@ -27,9 +27,12 @@ jmh { fork = 1 // jvmArgs = ["-agentpath:/Applications/YourKit-Java-Profiler-2018.04.app/Contents/Resources/bin/mac/libyjpagent.jnilib"] } -processJmhResources { + +tasks.named("processJmhResources") { duplicatesStrategy = DuplicatesStrategy.WARN } -spotlessJavaCheck.enabled = false -checkstyleMain.enabled = false -checkstyleJmh.enabled = false +['spotlessJavaCheck', 'checkstyleMain', 'checkstyleJmh'].each { + tasks.named(it) { + enabled = false + } +} diff --git a/build.gradle b/build.gradle index 405d796636..fd5fb4e1fb 100644 --- a/build.gradle +++ b/build.gradle @@ -114,8 +114,8 @@ subprojects { Project subproject -> } tasks.withType(Checkstyle).configureEach { reports { - xml.enabled = !System.getenv("GITHUB_ACTIONS") - html.enabled = !System.getenv("GITHUB_ACTIONS") + xml.required = !System.getenv("GITHUB_ACTIONS") + html.required = !System.getenv("GITHUB_ACTIONS") } } @@ -133,7 +133,7 @@ subprojects { Project subproject -> apply plugin: 'com.github.johnrengelman.shadow' - shadowJar { + tasks.named("shadowJar") { configurations = [project.configurations.shadowCompile] relocate "com.github.benmanes.caffeine", "io.micronaut.caffeine" relocate "org.objectweb.asm", "io.micronaut.asm" @@ -210,7 +210,10 @@ htmlSanityCheck { include "index.html" } } -docs.finalizedBy(htmlSanityCheck) + +tasks.named("docs") { + finalizedBy(htmlSanityCheck) +} tasks.named("updateVersionCatalogs") { // we set the list to empty because we accept upgrades which improve the status diff --git a/core/build.gradle b/core/build.gradle index 30f78637ad..400ec3433f 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -2,7 +2,7 @@ ext { shadowJarEnabled = true } -shadowJar { +tasks.named("shadowJar") { exclude "module-info.class" } @@ -33,10 +33,10 @@ spotless { } } -processResources.dependsOn('micronautVersionInfo') -task micronautVersionInfo(type: WriteProperties) { - outputFile = "${buildDir}/resources/main/micronaut-version.properties" +def versionInfo = tasks.register("micronautVersionInfo", WriteProperties) { + outputFile = "${buildDir}/resources/version/micronaut-version.properties" property 'micronaut.version', projectVersion } - - +tasks.named("processResources") { + from(versionInfo) +} diff --git a/gradle/geb.gradle b/gradle/geb.gradle index 6588d4e1b1..f82b46a5b9 100644 --- a/gradle/geb.gradle +++ b/gradle/geb.gradle @@ -9,7 +9,7 @@ dependencies { testRuntimeOnly libs.selenium.driver.firefox } -test { +tasks.named("test") { systemProperty "geb.env", System.getProperty('geb.env') systemProperty "webdriver.chrome.driver", System.getProperty('webdriver.chrome.driver') systemProperty "webdriver.gecko.driver", System.getProperty('webdriver.gecko.driver') diff --git a/http-client-core/build.gradle b/http-client-core/build.gradle index 351871feb5..81eaaca543 100644 --- a/http-client-core/build.gradle +++ b/http-client-core/build.gradle @@ -15,7 +15,7 @@ dependencies { compileOnly libs.kotlin.stdlib } -//tasks.withType(Test) { +//tasks.withType(Test).configureEach { // testLogging { // showStandardStreams = true // exceptionFormat = 'full' diff --git a/http-client/build.gradle b/http-client/build.gradle index 8767da3e84..9b9be4dbdf 100644 --- a/http-client/build.gradle +++ b/http-client/build.gradle @@ -36,7 +36,7 @@ dependencies { } } -//tasks.withType(Test) { +//tasks.withType(Test).configureEach { // jvmArgs('-Dio.netty.leakDetection.level=paranoid') // testLogging { // showStandardStreams = true diff --git a/http-server-netty/build.gradle b/http-server-netty/build.gradle index f3b5dedb94..f1320f3fd9 100644 --- a/http-server-netty/build.gradle +++ b/http-server-netty/build.gradle @@ -68,7 +68,7 @@ dependencies { testImplementation libs.junit.jupiter.api } -//tasks.withType(Test) { +//tasks.withType(Test).configureEach { // testLogging { // showStandardStreams = true // exceptionFormat = 'full' diff --git a/http/build.gradle b/http/build.gradle index 4c666ffba1..9abbac6822 100644 --- a/http/build.gradle +++ b/http/build.gradle @@ -30,7 +30,7 @@ dependencies { testImplementation project(":runtime") } -compileKotlin { +tasks.named("compileKotlin") { kotlinOptions.jvmTarget = "1.8" } diff --git a/inject-groovy-test/build.gradle b/inject-groovy-test/build.gradle index b780298a13..d957eafb05 100644 --- a/inject-groovy-test/build.gradle +++ b/inject-groovy-test/build.gradle @@ -9,9 +9,7 @@ dependencies { api project(":context") } -afterEvaluate { - sourcesJar { - from "$projectDir/src/main/groovy" - duplicatesStrategy(DuplicatesStrategy.EXCLUDE) - } +tasks.named("sourcesJar") { + from "$projectDir/src/main/groovy" + duplicatesStrategy(DuplicatesStrategy.EXCLUDE) } diff --git a/inject-groovy/build.gradle b/inject-groovy/build.gradle index 3a832fe047..c1ff3ccd9b 100644 --- a/inject-groovy/build.gradle +++ b/inject-groovy/build.gradle @@ -40,7 +40,7 @@ dependencies { functionalTestImplementation(testFixtures(project(":test-suite"))) } -test { +tasks.named("test") { exclude '**/*$_closure*' } diff --git a/inject-java-test/build.gradle b/inject-java-test/build.gradle index e968340ea3..c82ecf2383 100644 --- a/inject-java-test/build.gradle +++ b/inject-java-test/build.gradle @@ -24,8 +24,6 @@ dependencies { testImplementation libs.smallrye } -afterEvaluate { - sourcesJar { - from "$projectDir/src/main/groovy" - } +tasks.named("sourcesJar") { + from "$projectDir/src/main/groovy" } diff --git a/inject-java/build.gradle b/inject-java/build.gradle index ea6c3e428f..ec36bd3628 100644 --- a/inject-java/build.gradle +++ b/inject-java/build.gradle @@ -48,7 +48,7 @@ dependencies { //compileTestJava.options.forkOptions.jvmArgs = ['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005'] -tasks.withType(Test) { +tasks.withType(Test).configureEach { forkEvery = 100 maxParallelForks = 2 useJUnitPlatform() diff --git a/inject-kotlin-test/build.gradle b/inject-kotlin-test/build.gradle index baae7d665c..5c1e6079f4 100644 --- a/inject-kotlin-test/build.gradle +++ b/inject-kotlin-test/build.gradle @@ -27,18 +27,18 @@ dependencies { implementation libs.kotlin.stdlib } -afterEvaluate { - sourcesJar { - from "$projectDir/src/main/groovy" - from "$projectDir/src/main/kotlin" - } +tasks.named("sourcesJar") { + from "$projectDir/src/main/groovy" + from "$projectDir/src/main/kotlin" } -compileKotlin { + +tasks.named("compileKotlin") { kotlinOptions { jvmTarget = "1.8" } } -compileGroovy { + +tasks.named("compileGroovy") { // this allows groovy to access kotlin classes. dependsOn tasks.getByPath('compileKotlin') classpath += files(compileKotlin.destinationDir) diff --git a/test-suite-groovy/build.gradle b/test-suite-groovy/build.gradle index 21b15854c1..068d201b2d 100644 --- a/test-suite-groovy/build.gradle +++ b/test-suite-groovy/build.gradle @@ -28,7 +28,7 @@ dependencies { testImplementation libs.managed.reactor } -//tasks.withType(Test) { +//tasks.withType(Test).configureEach { // testLogging { // showStandardStreams = true // exceptionFormat = 'full' diff --git a/test-suite-kotlin/build.gradle b/test-suite-kotlin/build.gradle index f451906d9d..e850cc9383 100644 --- a/test-suite-kotlin/build.gradle +++ b/test-suite-kotlin/build.gradle @@ -60,10 +60,10 @@ dependencies { testImplementation libs.managed.reactor } -compileTestKotlin { +tasks.named("compileTestKotlin") { kotlinOptions.jvmTarget = "1.8" } -test { +tasks.named("test") { useJUnitPlatform() } diff --git a/test-suite/build.gradle b/test-suite/build.gradle index 131ec53078..c140785278 100644 --- a/test-suite/build.gradle +++ b/test-suite/build.gradle @@ -87,7 +87,7 @@ dependencies { testFixturesApi libs.managed.groovy } -//tasks.withType(Test) { +//tasks.withType(Test).configureEach { // useJUnitPlatform() // // jvmArgs('-Dio.netty.leakDetection.level=paranoid') diff --git a/tracing/build.gradle b/tracing/build.gradle index 428aacda72..6ea71d7206 100644 --- a/tracing/build.gradle +++ b/tracing/build.gradle @@ -39,7 +39,7 @@ dependencies { } -tasks.withType(Test) { +tasks.withType(Test).configureEach { testLogging { showStandardStreams = true exceptionFormat = 'full' diff --git a/websocket/build.gradle b/websocket/build.gradle index 19fd177aa3..a066424e4a 100644 --- a/websocket/build.gradle +++ b/websocket/build.gradle @@ -17,6 +17,6 @@ dependencies { testImplementation project(":inject-groovy") } -test { +tasks.named("test") { timeout = Duration.ofMinutes(5) }