diff --git a/.github/workflows/graalvm-latest.yml b/.github/workflows/graalvm-latest.yml index 8b7f9fbbaa3..f79dede7f51 100644 --- a/.github/workflows/graalvm-latest.yml +++ b/.github/workflows/graalvm-latest.yml @@ -29,3 +29,4 @@ jobs: GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} GRADLE_ENTERPRISE_CACHE_USERNAME: ${{ secrets.GRADLE_ENTERPRISE_CACHE_USERNAME }} GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }} + diff --git a/buildSrc/src/main/groovy/io.micronaut.internal.build.starter-openapi-module.gradle b/buildSrc/src/main/groovy/io.micronaut.internal.build.starter-openapi-module.gradle index 6aeb2983e62..89991f17781 100644 --- a/buildSrc/src/main/groovy/io.micronaut.internal.build.starter-openapi-module.gradle +++ b/buildSrc/src/main/groovy/io.micronaut.internal.build.starter-openapi-module.gradle @@ -38,4 +38,4 @@ abstract class OpenApiSystemPropertyOverride implements CommandLineArgumentProvi Iterable asArguments() { ["-Dmicronaut.openapi.config.file=${openApiPropertiesFile.asFile.get().absolutePath}".toString()] } -} +} \ No newline at end of file diff --git a/buildSrc/src/main/groovy/io.micronaut.internal.starter.base-module.gradle b/buildSrc/src/main/groovy/io.micronaut.internal.starter.base-module.gradle index 0f2a2f9271e..6cffc3ffdf9 100644 --- a/buildSrc/src/main/groovy/io.micronaut.internal.starter.base-module.gradle +++ b/buildSrc/src/main/groovy/io.micronaut.internal.starter.base-module.gradle @@ -47,12 +47,3 @@ dependencies { exclude group: "org.apache.groovy", module: "groovy-all" } } -java { - sourceCompatibility = JavaVersion.toVersion("21") - targetCompatibility = JavaVersion.toVersion("21") -} -java { - toolchain { - languageVersion = JavaLanguageVersion.of(21) - } -} \ No newline at end of file diff --git a/buildSrc/src/main/groovy/io.micronaut.internal.starter.published-module.gradle b/buildSrc/src/main/groovy/io.micronaut.internal.starter.published-module.gradle index dbd9c73c648..cfcad4f0bf8 100644 --- a/buildSrc/src/main/groovy/io.micronaut.internal.starter.published-module.gradle +++ b/buildSrc/src/main/groovy/io.micronaut.internal.starter.published-module.gradle @@ -2,3 +2,12 @@ plugins { id "io.micronaut.internal.starter.base-module" id "io.micronaut.build.internal.publishing" } +java { + sourceCompatibility = JavaVersion.toVersion("17") + targetCompatibility = JavaVersion.toVersion("17") +} +java { + toolchain { + languageVersion = JavaLanguageVersion.of(21) + } +} \ No newline at end of file diff --git a/starter-cli/build.gradle b/starter-cli/build.gradle index d2e83923108..2513f76b963 100644 --- a/starter-cli/build.gradle +++ b/starter-cli/build.gradle @@ -66,7 +66,7 @@ application { } rocker { - javaVersion = '21' + javaVersion = '17' postProcessing = ['io.micronaut.starter.rocker.WhitespaceProcessor'] } diff --git a/starter-core/build.gradle b/starter-core/build.gradle index 13b05236758..d12eabb8bea 100644 --- a/starter-core/build.gradle +++ b/starter-core/build.gradle @@ -1,7 +1,7 @@ import io.micronaut.internal.starter.tasks.WriteMicronautVersionInfoTask plugins { - id "io.micronaut.internal.starter.published-module" + id("io.micronaut.internal.starter.published-module") id "io.micronaut.internal.starter.convention" id "io.micronaut.starter.rocker" id "io.micronaut.internal.starter.coordinates" @@ -50,6 +50,6 @@ TaskProvider micronautVersionInfo = tasks.registe sourceSets.main.resources.srcDir(micronautVersionInfo) rocker { - javaVersion = '21' + javaVersion = '17' postProcessing = ['io.micronaut.starter.rocker.WhitespaceProcessor'] } diff --git a/starter-core/src/test/groovy/io/micronaut/starter/feature/build/KaptSpec.groovy b/starter-core/src/test/groovy/io/micronaut/starter/feature/build/KaptSpec.groovy index 8217970c250..9fcff860c94 100644 --- a/starter-core/src/test/groovy/io/micronaut/starter/feature/build/KaptSpec.groovy +++ b/starter-core/src/test/groovy/io/micronaut/starter/feature/build/KaptSpec.groovy @@ -15,7 +15,6 @@ import io.micronaut.starter.options.JdkVersion import io.micronaut.starter.options.Language import io.micronaut.starter.options.Options import io.micronaut.starter.options.TestFramework -import spock.lang.Ignore import spock.lang.Shared import spock.lang.Subject @@ -147,15 +146,14 @@ class KaptSpec extends ApplicationContextSpec implements CommandOutputFixture { output.".mvn/jvm.config" == KotlinSupportFeature.JDK_21_KAPT_MODULES } - @Ignore void 'Corrected jdk21 = jdk17 is specified in build = #buildTool for kapt'(BuildTool buildTool) { when: - def output = generate(ApplicationType.DEFAULT, new Options(Language.KOTLIN, TestFramework.DEFAULT_OPTION, buildTool, JdkVersion.JDK_21),['kapt']) - def buildFile = buildTool == BuildTool.GRADLE ? output["build.gradle"] : output["build.gradle.kts"] + Map output = generate(ApplicationType.DEFAULT, new Options(Language.KOTLIN, TestFramework.DEFAULT_OPTION, buildTool, JdkVersion.JDK_21),['kapt']) + String buildFile = buildTool == BuildTool.GRADLE ? output["build.gradle"] : output["build.gradle.kts"] then: buildFile - buildFile.contains('sourceCompatibility = JavaVersion.toVersion("17")') + buildFile.contains('sourceCompatibility = JavaVersion.toVersion("21")') !buildFile.contains('targetCompatibility = JavaVersion.toVersion("17")') !buildFile.contains('targetCompatibility = JavaVersion.toVersion("21")') diff --git a/starter-core/src/test/groovy/io/micronaut/starter/feature/test/SpockSpec.groovy b/starter-core/src/test/groovy/io/micronaut/starter/feature/test/SpockSpec.groovy index 00516a29823..cc8fc6a454e 100644 --- a/starter-core/src/test/groovy/io/micronaut/starter/feature/test/SpockSpec.groovy +++ b/starter-core/src/test/groovy/io/micronaut/starter/feature/test/SpockSpec.groovy @@ -6,7 +6,6 @@ import io.micronaut.starter.options.BuildTool import io.micronaut.starter.options.JdkVersion import io.micronaut.starter.options.Language import io.micronaut.starter.options.TestFramework -import spock.lang.Ignore import spock.lang.Issue class SpockSpec extends ApplicationContextSpec { @@ -78,8 +77,7 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach { Language.JAVA | TestFramework.KOTEST } - @Ignore - void 'With #language, #testFramework and #jdk and kapt we use the kotlin toolchain for JDK17'() { + void 'With #language, #testFramework and #jdk and kapt we use the kotlin toolchain for JDK17'(Language language, TestFramework testFramework, JdkVersion jdk) { when: String template = new BuildBuilder(beanContext, BuildTool.GRADLE) .language(language) @@ -89,20 +87,35 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach { .render() then: - template.contains('sourceCompatibility = JavaVersion.toVersion("17")') + template.contains('sourceCompatibility = JavaVersion.toVersion("' + jdk.majorVersion() + '")') - template.contains('''\ + if (jdk.majorVersion() == 17) { + assert template.contains('''\ kotlin { jvmToolchain { languageVersion.set(JavaLanguageVersion.of(17)) } }''') - !template.contains('''\ + assert !template.contains('''\ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach { compilerOptions { jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17 } }''') + } else if (jdk.majorVersion() == 21) { + assert template.contains('''\ +kotlin { + jvmToolchain { + languageVersion.set(JavaLanguageVersion.of(21)) + } +}''') + assert !template.contains('''\ +tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach { + compilerOptions { + jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_21 + } +}''') + } where: language | testFramework | jdk diff --git a/test-features/build.gradle b/test-features/build.gradle index a6de7d34155..62f4ae7ad62 100644 --- a/test-features/build.gradle +++ b/test-features/build.gradle @@ -25,6 +25,6 @@ sourceSets { } rocker { - javaVersion = '21' + javaVersion = '17' postProcessing = ['io.micronaut.starter.rocker.WhitespaceProcessor'] }