From 2029117999886d60b1940d516778d3e9ee56ed28 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 19 Jul 2023 20:27:41 +0100 Subject: [PATCH] Upgrade to Kotlin 1.9.0 Closes gh-36362 --- gradle.properties | 2 +- .../KotlinPluginActionIntegrationTests.java | 42 ++++++++----------- 2 files changed, 18 insertions(+), 26 deletions(-) diff --git a/gradle.properties b/gradle.properties index aa7abc2f74..c0cea14c25 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ org.gradle.caching=true org.gradle.parallel=true org.gradle.jvmargs=-Xmx2g -Dfile.encoding=UTF-8 -kotlinVersion=1.8.22 +kotlinVersion=1.9.0 nativeBuildToolsVersion=0.9.23 springFrameworkVersion=6.1.0-M3 tomcatVersion=10.1.11 diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/plugin/KotlinPluginActionIntegrationTests.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/plugin/KotlinPluginActionIntegrationTests.java index cfb35aa41c..54d8807735 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/plugin/KotlinPluginActionIntegrationTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/plugin/KotlinPluginActionIntegrationTests.java @@ -23,11 +23,11 @@ import java.util.HashSet; import java.util.Set; import org.gradle.testkit.runner.BuildResult; -import org.gradle.util.GradleVersion; -import org.junit.jupiter.api.TestTemplate; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.boot.gradle.junit.GradleCompatibility; import org.springframework.boot.testsupport.gradle.testkit.GradleBuild; +import org.springframework.boot.testsupport.gradle.testkit.GradleBuildExtension; import static org.assertj.core.api.Assertions.assertThat; @@ -36,43 +36,40 @@ import static org.assertj.core.api.Assertions.assertThat; * * @author Andy Wilkinson */ -@GradleCompatibility +@ExtendWith(GradleBuildExtension.class) class KotlinPluginActionIntegrationTests { - GradleBuild gradleBuild; + GradleBuild gradleBuild = new GradleBuild(); - @TestTemplate + @Test void noKotlinVersionPropertyWithoutKotlinPlugin() { assertThat(this.gradleBuild.build("kotlinVersion").getOutput()).contains("Kotlin version: none"); } - @TestTemplate + @Test void kotlinVersionPropertyIsSet() { - String output = this.gradleBuild.expectDeprecationWarningsWithAtLeastVersion("8.1-rc-1") - .build("kotlinVersion", "dependencies", "--configuration", "compileClasspath") + String output = this.gradleBuild.build("kotlinVersion", "dependencies", "--configuration", "compileClasspath") .getOutput(); assertThat(output).containsPattern("Kotlin version: [0-9]\\.[0-9]\\.[0-9]+"); } - @TestTemplate + @Test void kotlinCompileTasksUseJavaParametersFlagByDefault() { - assertThat(this.gradleBuild.expectDeprecationWarningsWithAtLeastVersion("8.1-rc-1") - .build("kotlinCompileTasksJavaParameters") - .getOutput()).contains("compileKotlin java parameters: true") + assertThat(this.gradleBuild.build("kotlinCompileTasksJavaParameters").getOutput()) + .contains("compileKotlin java parameters: true") .contains("compileTestKotlin java parameters: true"); } - @TestTemplate + @Test void kotlinCompileTasksCanOverrideDefaultJavaParametersFlag() { - assertThat(this.gradleBuild.expectDeprecationWarningsWithAtLeastVersion("8.1-rc-1") - .build("kotlinCompileTasksJavaParameters") - .getOutput()).contains("compileKotlin java parameters: false") + assertThat(this.gradleBuild.build("kotlinCompileTasksJavaParameters").getOutput()) + .contains("compileKotlin java parameters: false") .contains("compileTestKotlin java parameters: false"); } - @TestTemplate + @Test void taskConfigurationIsAvoided() throws IOException { - BuildResult result = this.gradleBuild.expectDeprecationWarningsWithAtLeastVersion("8.1-rc-1").build("help"); + BuildResult result = this.gradleBuild.build("help"); String output = result.getOutput(); BufferedReader reader = new BufferedReader(new StringReader(output)); String line; @@ -82,12 +79,7 @@ class KotlinPluginActionIntegrationTests { configured.add(line.substring("Configuring :".length())); } } - if (GradleVersion.version(this.gradleBuild.getGradleVersion()).compareTo(GradleVersion.version("7.3.3")) < 0) { - assertThat(configured).containsExactly("help"); - } - else { - assertThat(configured).containsExactlyInAnyOrder("help", "clean"); - } + assertThat(configured).containsExactlyInAnyOrder("help", "clean"); } }