Upgrade to Kotlin 1.9.0

Closes gh-36362
pull/36477/head
Andy Wilkinson 1 year ago
parent 4a4b29fcbf
commit 2029117999

@ -4,7 +4,7 @@ org.gradle.caching=true
org.gradle.parallel=true org.gradle.parallel=true
org.gradle.jvmargs=-Xmx2g -Dfile.encoding=UTF-8 org.gradle.jvmargs=-Xmx2g -Dfile.encoding=UTF-8
kotlinVersion=1.8.22 kotlinVersion=1.9.0
nativeBuildToolsVersion=0.9.23 nativeBuildToolsVersion=0.9.23
springFrameworkVersion=6.1.0-M3 springFrameworkVersion=6.1.0-M3
tomcatVersion=10.1.11 tomcatVersion=10.1.11

@ -23,11 +23,11 @@ import java.util.HashSet;
import java.util.Set; import java.util.Set;
import org.gradle.testkit.runner.BuildResult; import org.gradle.testkit.runner.BuildResult;
import org.gradle.util.GradleVersion; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestTemplate; 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.GradleBuild;
import org.springframework.boot.testsupport.gradle.testkit.GradleBuildExtension;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
@ -36,43 +36,40 @@ import static org.assertj.core.api.Assertions.assertThat;
* *
* @author Andy Wilkinson * @author Andy Wilkinson
*/ */
@GradleCompatibility @ExtendWith(GradleBuildExtension.class)
class KotlinPluginActionIntegrationTests { class KotlinPluginActionIntegrationTests {
GradleBuild gradleBuild; GradleBuild gradleBuild = new GradleBuild();
@TestTemplate @Test
void noKotlinVersionPropertyWithoutKotlinPlugin() { void noKotlinVersionPropertyWithoutKotlinPlugin() {
assertThat(this.gradleBuild.build("kotlinVersion").getOutput()).contains("Kotlin version: none"); assertThat(this.gradleBuild.build("kotlinVersion").getOutput()).contains("Kotlin version: none");
} }
@TestTemplate @Test
void kotlinVersionPropertyIsSet() { void kotlinVersionPropertyIsSet() {
String output = this.gradleBuild.expectDeprecationWarningsWithAtLeastVersion("8.1-rc-1") String output = this.gradleBuild.build("kotlinVersion", "dependencies", "--configuration", "compileClasspath")
.build("kotlinVersion", "dependencies", "--configuration", "compileClasspath")
.getOutput(); .getOutput();
assertThat(output).containsPattern("Kotlin version: [0-9]\\.[0-9]\\.[0-9]+"); assertThat(output).containsPattern("Kotlin version: [0-9]\\.[0-9]\\.[0-9]+");
} }
@TestTemplate @Test
void kotlinCompileTasksUseJavaParametersFlagByDefault() { void kotlinCompileTasksUseJavaParametersFlagByDefault() {
assertThat(this.gradleBuild.expectDeprecationWarningsWithAtLeastVersion("8.1-rc-1") assertThat(this.gradleBuild.build("kotlinCompileTasksJavaParameters").getOutput())
.build("kotlinCompileTasksJavaParameters") .contains("compileKotlin java parameters: true")
.getOutput()).contains("compileKotlin java parameters: true")
.contains("compileTestKotlin java parameters: true"); .contains("compileTestKotlin java parameters: true");
} }
@TestTemplate @Test
void kotlinCompileTasksCanOverrideDefaultJavaParametersFlag() { void kotlinCompileTasksCanOverrideDefaultJavaParametersFlag() {
assertThat(this.gradleBuild.expectDeprecationWarningsWithAtLeastVersion("8.1-rc-1") assertThat(this.gradleBuild.build("kotlinCompileTasksJavaParameters").getOutput())
.build("kotlinCompileTasksJavaParameters") .contains("compileKotlin java parameters: false")
.getOutput()).contains("compileKotlin java parameters: false")
.contains("compileTestKotlin java parameters: false"); .contains("compileTestKotlin java parameters: false");
} }
@TestTemplate @Test
void taskConfigurationIsAvoided() throws IOException { 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(); String output = result.getOutput();
BufferedReader reader = new BufferedReader(new StringReader(output)); BufferedReader reader = new BufferedReader(new StringReader(output));
String line; String line;
@ -82,12 +79,7 @@ class KotlinPluginActionIntegrationTests {
configured.add(line.substring("Configuring :".length())); 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");
} }
}
} }

Loading…
Cancel
Save