From a0a28d6896ad44d645dd348afcf19ca299212faa Mon Sep 17 00:00:00 2001 From: altro3 Date: Fri, 27 Oct 2023 15:07:27 +0700 Subject: [PATCH] Deprecations fixes and minor improvements in gradle scripts --- CONTRIBUTING.md | 2 +- ....micronaut.build.internal.convention-base.gradle | 4 ++-- ...cronaut.build.internal.convention-library.gradle | 12 +++++------- ...cronaut.build.internal.convention-quality.gradle | 2 +- core/build.gradle | 2 +- inject-kotlin/build.gradle | 13 +++++++------ test-suite-http-server-tck-netty/build.gradle | 4 ++-- test-suite-logback-graalvm/build.gradle | 2 +- test-suite-netty-ssl-graalvm/build.gradle | 2 +- 9 files changed, 21 insertions(+), 22 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3b98cbd9bb..da2c9e4967 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,7 +6,7 @@ If you are interested in contributing to the Micronaut Framework and are looking ## JDK Setup -The Micronaut Framework currently requires JDK 8 +The Micronaut Framework currently requires JDK 17 ## IDE Setup diff --git a/buildSrc/src/main/groovy/io.micronaut.build.internal.convention-base.gradle b/buildSrc/src/main/groovy/io.micronaut.build.internal.convention-base.gradle index 9d16ebd247..cf94ac7d21 100644 --- a/buildSrc/src/main/groovy/io.micronaut.build.internal.convention-base.gradle +++ b/buildSrc/src/main/groovy/io.micronaut.build.internal.convention-base.gradle @@ -14,7 +14,7 @@ repositories { mavenCentral() } -configurations.all { +configurations.configureEach { resolutionStrategy.cacheChangingModulesFor 0, 'seconds' resolutionStrategy.cacheDynamicVersionsFor 0, 'seconds' } @@ -62,7 +62,7 @@ tasks.withType(Jar).configureEach { preserveFileTimestamps = false } -configurations.all { +configurations.configureEach { resolutionStrategy.dependencySubstitution { rootProject.subprojects.each { if (!it.name.startsWith('test-')) { diff --git a/buildSrc/src/main/groovy/io.micronaut.build.internal.convention-library.gradle b/buildSrc/src/main/groovy/io.micronaut.build.internal.convention-library.gradle index d76a85e56b..c739e802f6 100644 --- a/buildSrc/src/main/groovy/io.micronaut.build.internal.convention-library.gradle +++ b/buildSrc/src/main/groovy/io.micronaut.build.internal.convention-library.gradle @@ -3,13 +3,11 @@ plugins { id "io.micronaut.build.internal.convention-base" } -configurations { - all { - resolutionStrategy.eachDependency { DependencyResolveDetails details -> - String group = details.requested.group - if (group == 'org.ow2.asm') { - details.useVersion(libs.versions.asm.get()) - } +configurations.configureEach { + resolutionStrategy.eachDependency { DependencyResolveDetails details -> + String group = details.requested.group + if (group == 'org.ow2.asm') { + details.useVersion(libs.versions.asm.get()) } } } diff --git a/buildSrc/src/main/groovy/io.micronaut.build.internal.convention-quality.gradle b/buildSrc/src/main/groovy/io.micronaut.build.internal.convention-quality.gradle index cfeabf6010..59df71c518 100644 --- a/buildSrc/src/main/groovy/io.micronaut.build.internal.convention-quality.gradle +++ b/buildSrc/src/main/groovy/io.micronaut.build.internal.convention-quality.gradle @@ -5,7 +5,7 @@ plugins { } tasks.named("htmlSanityCheck") { - sourceDir = new File("${rootProject.buildDir}/docs/guide/") + sourceDir = file("${rootProject.layout.buildDirectory.asFile.get()}/docs/guide/") sourceDocuments = fileTree(sourceDir) { include "index.html" } diff --git a/core/build.gradle b/core/build.gradle index d3bd67cfc4..41a3e597bc 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -31,7 +31,7 @@ spotless { } def versionInfo = tasks.register("micronautVersionInfo", WriteProperties) { - outputFile = "${buildDir}/resources/version/micronaut-version.properties" + destinationFile = file("${layout.buildDirectory.asFile.get()}/resources/version/micronaut-version.properties") property 'micronaut.version', projectVersion } tasks.named("processResources") { diff --git a/inject-kotlin/build.gradle b/inject-kotlin/build.gradle index c2bdbb45fa..17b7f3a525 100644 --- a/inject-kotlin/build.gradle +++ b/inject-kotlin/build.gradle @@ -16,9 +16,7 @@ dependencies { api project(":core-processor") implementation(libs.managed.ksp.api) - if (!JavaVersion.current().isJava9Compatible()) { - api files(org.gradle.internal.jvm.Jvm.current().toolsJar) - } + kspTest(project) kspTest platform(libs.test.boms.micronaut.validation) kspTest (libs.micronaut.validation.processor) { @@ -57,9 +55,12 @@ afterEvaluate { } } -tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { - kotlinOptions { - jvmTarget = "17" +kotlin { + jvmToolchain(17) +} + +tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach { + compilerOptions { freeCompilerArgs = ['-Xjvm-default=all'] } } diff --git a/test-suite-http-server-tck-netty/build.gradle b/test-suite-http-server-tck-netty/build.gradle index fa58dcfa31..35aeb1cde6 100644 --- a/test-suite-http-server-tck-netty/build.gradle +++ b/test-suite-http-server-tck-netty/build.gradle @@ -27,7 +27,7 @@ dependencies { } configurations { - all { + configureEach { // Stop serde pulling in AOP exclude group: 'io.micronaut', module: 'micronaut-aop' // Stop pulling in inject-groovy from maven @@ -48,7 +48,7 @@ graalvmNative { enabled = true } binaries { - all { + configureEach { resources.autodetect() } } diff --git a/test-suite-logback-graalvm/build.gradle b/test-suite-logback-graalvm/build.gradle index 0933e2edba..a273e0aa79 100644 --- a/test-suite-logback-graalvm/build.gradle +++ b/test-suite-logback-graalvm/build.gradle @@ -23,7 +23,7 @@ graalvmNative { enabled = true } binaries { - all { + configureEach { resources.autodetect() } } diff --git a/test-suite-netty-ssl-graalvm/build.gradle b/test-suite-netty-ssl-graalvm/build.gradle index 9f825ff8bc..699bfc77d5 100644 --- a/test-suite-netty-ssl-graalvm/build.gradle +++ b/test-suite-netty-ssl-graalvm/build.gradle @@ -31,7 +31,7 @@ graalvmNative { enabled = true } binaries { - all { + configureEach { resources.autodetect() } }