From 88ec47ff2b216f3de5ce252d5e154bf2724aa0c5 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Tue, 28 Mar 2023 17:41:21 +0100 Subject: [PATCH] Test Gradle plugin against Gradle 8.1 Closes gh-35034 --- .../KotlinPluginActionIntegrationTests.java | 15 +++++++++------ .../gradle/testkit/GradleVersions.java | 8 ++++---- 2 files changed, 13 insertions(+), 10 deletions(-) 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 cdab2b2925..e629de7d0f 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 @@ -48,28 +48,31 @@ class KotlinPluginActionIntegrationTests { @TestTemplate void kotlinVersionPropertyIsSet() { - String output = this.gradleBuild.build("kotlinVersion", "dependencies", "--configuration", "compileClasspath") + String output = this.gradleBuild.expectDeprecationWarningsWithAtLeastVersion("8.1-rc-1") + .build("kotlinVersion", "dependencies", "--configuration", "compileClasspath") .getOutput(); assertThat(output).containsPattern("Kotlin version: [0-9]\\.[0-9]\\.[0-9]+"); } @TestTemplate void kotlinCompileTasksUseJavaParametersFlagByDefault() { - assertThat(this.gradleBuild.build("kotlinCompileTasksJavaParameters").getOutput()) - .contains("compileKotlin java parameters: true") + assertThat(this.gradleBuild.expectDeprecationWarningsWithAtLeastVersion("8.1-rc-1") + .build("kotlinCompileTasksJavaParameters") + .getOutput()).contains("compileKotlin java parameters: true") .contains("compileTestKotlin java parameters: true"); } @TestTemplate void kotlinCompileTasksCanOverrideDefaultJavaParametersFlag() { - assertThat(this.gradleBuild.build("kotlinCompileTasksJavaParameters").getOutput()) - .contains("compileKotlin java parameters: false") + assertThat(this.gradleBuild.expectDeprecationWarningsWithAtLeastVersion("8.1-rc-1") + .build("kotlinCompileTasksJavaParameters") + .getOutput()).contains("compileKotlin java parameters: false") .contains("compileTestKotlin java parameters: false"); } @TestTemplate void taskConfigurationIsAvoided() throws IOException { - BuildResult result = this.gradleBuild.build("help"); + BuildResult result = this.gradleBuild.expectDeprecationWarningsWithAtLeastVersion("8.1-rc-1").build("help"); String output = result.getOutput(); BufferedReader reader = new BufferedReader(new StringReader(output)); String line; diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-test-support/src/main/java/org/springframework/boot/testsupport/gradle/testkit/GradleVersions.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-test-support/src/main/java/org/springframework/boot/testsupport/gradle/testkit/GradleVersions.java index 7413044f44..0b84fbadc6 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-test-support/src/main/java/org/springframework/boot/testsupport/gradle/testkit/GradleVersions.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-test-support/src/main/java/org/springframework/boot/testsupport/gradle/testkit/GradleVersions.java @@ -34,15 +34,15 @@ public final class GradleVersions { public static List allCompatible() { if (isJava18()) { - return Arrays.asList("7.3.3", GradleVersion.current().getVersion(), "8.0.2"); + return Arrays.asList("7.3.3", GradleVersion.current().getVersion(), "8.0.2", "8.1"); } if (isJava17()) { - return Arrays.asList("7.2", GradleVersion.current().getVersion(), "8.0.2"); + return Arrays.asList("7.2", GradleVersion.current().getVersion(), "8.0.2", "8.1"); } if (isJava16()) { - return Arrays.asList("7.0.2", GradleVersion.current().getVersion(), "8.0.2"); + return Arrays.asList("7.0.2", GradleVersion.current().getVersion(), "8.0.2", "8.1"); } - return Arrays.asList("6.8.3", "6.9.4", "7.0.2", GradleVersion.current().getVersion(), "8.0.2"); + return Arrays.asList("6.8.3", "6.9.4", "7.0.2", GradleVersion.current().getVersion(), "8.0.2", "8.1"); } public static String minimumCompatible() {