Skip to content

Commit 25b72d6

Browse files
committed
Test Gradle plugin against 9.0.0-milestone-9
1 parent ec9fd89 commit 25b72d6

File tree

5 files changed

+24
-10
lines changed

5 files changed

+24
-10
lines changed

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/plugin/WarPluginActionIntegrationTests.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -20,7 +20,9 @@
2020
import java.io.File;
2121
import java.io.IOException;
2222
import java.io.StringReader;
23+
import java.util.ArrayList;
2324
import java.util.HashSet;
25+
import java.util.List;
2426
import java.util.Set;
2527

2628
import org.gradle.testkit.runner.BuildResult;
@@ -61,9 +63,13 @@ void assembleRunsBootWarAndWar() {
6163
assertThat(result.task(":bootWar").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
6264
assertThat(result.task(":war").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
6365
File buildLibs = new File(this.gradleBuild.getProjectDir(), "build/libs");
64-
assertThat(buildLibs.listFiles()).containsExactlyInAnyOrder(
65-
new File(buildLibs, this.gradleBuild.getProjectDir().getName() + ".war"),
66-
new File(buildLibs, this.gradleBuild.getProjectDir().getName() + "-plain.war"));
66+
List<File> expected = new ArrayList<>();
67+
expected.add(new File(buildLibs, this.gradleBuild.getProjectDir().getName() + ".war"));
68+
expected.add(new File(buildLibs, this.gradleBuild.getProjectDir().getName() + "-plain.war"));
69+
if (this.gradleBuild.gradleVersionIsAtLeast("9.0-milestone-2")) {
70+
expected.add(new File(buildLibs, this.gradleBuild.getProjectDir().getName() + "-plain.jar"));
71+
}
72+
assertThat(buildLibs.listFiles()).containsExactlyInAnyOrderElementsOf(expected);
6773
}
6874

6975
@TestTemplate

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/AbstractBootArchiveIntegrationTests.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
import org.apache.commons.compress.archivers.zip.ZipFile;
5151
import org.gradle.testkit.runner.BuildResult;
5252
import org.gradle.testkit.runner.TaskOutcome;
53+
import org.junit.jupiter.api.Assumptions;
5354
import org.junit.jupiter.api.TestTemplate;
5455

5556
import org.springframework.boot.loader.tools.FileUtils;
@@ -597,6 +598,7 @@ void defaultDirAndFileModesAreUsed() throws IOException {
597598

598599
@TestTemplate
599600
void dirModeAndFileModeAreApplied() throws IOException {
601+
Assumptions.assumeTrue(this.gradleBuild.gradleVersionIsLessThan("9.0-milestone-1"));
600602
BuildResult result = this.gradleBuild.expectDeprecationWarningsWithAtLeastVersion("8.8-rc-1")
601603
.expectDeprecationMessages("The CopyProcessingSpec.setDirMode(Integer) method has been deprecated",
602604
"The CopyProcessingSpec.setFileMode(Integer) method has been deprecated",

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
import org.gradle.testkit.runner.BuildResult;
2727
import org.gradle.testkit.runner.TaskOutcome;
28+
import org.junit.jupiter.api.Assumptions;
2829
import org.junit.jupiter.api.TestTemplate;
2930

3031
import org.springframework.boot.gradle.junit.GradleCompatibility;
@@ -56,6 +57,7 @@ void signed() throws Exception {
5657

5758
@TestTemplate
5859
void whenAResolvableCopyOfAnUnresolvableConfigurationIsResolvedThenResolutionSucceeds() {
60+
Assumptions.assumeTrue(this.gradleBuild.gradleVersionIsLessThan("9.0-milestone-1"));
5961
this.gradleBuild.expectDeprecationWarningsWithAtLeastVersion("8.0").build("build");
6062
}
6163

spring-boot-project/spring-boot-tools/spring-boot-gradle-test-support/src/main/java/org/springframework/boot/testsupport/gradle/testkit/GradleBuild.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,10 @@ public boolean gradleVersionIsAtLeast(String version) {
134134
return GradleVersion.version(this.gradleVersion).compareTo(GradleVersion.version(version)) >= 0;
135135
}
136136

137+
public boolean gradleVersionIsLessThan(String version) {
138+
return GradleVersion.version(this.gradleVersion).compareTo(GradleVersion.version(version)) < 0;
139+
}
140+
137141
public BuildResult build(String... arguments) {
138142
try {
139143
BuildResult result = prepareRunner(arguments).build();

spring-boot-project/spring-boot-tools/spring-boot-gradle-test-support/src/main/java/org/springframework/boot/testsupport/gradle/testkit/GradleVersions.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2024 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -34,18 +34,18 @@ private GradleVersions() {
3434

3535
public static List<String> allCompatible() {
3636
if (isJavaVersion(JavaVersion.VERSION_24)) {
37-
return Arrays.asList(GradleVersion.current().getVersion());
37+
return Arrays.asList(GradleVersion.current().getVersion(), "9.0.0-milestone-9");
3838
}
3939
if (isJavaVersion(JavaVersion.VERSION_23)) {
40-
return Arrays.asList("8.10", GradleVersion.current().getVersion());
40+
return Arrays.asList(GradleVersion.current().getVersion(), "9.0.0-milestone-9");
4141
}
4242
if (isJavaVersion(JavaVersion.VERSION_22)) {
43-
return Arrays.asList("8.8", GradleVersion.current().getVersion());
43+
return Arrays.asList("8.8", GradleVersion.current().getVersion(), "9.0.0-milestone-9");
4444
}
4545
if (isJavaVersion(JavaVersion.VERSION_21)) {
46-
return Arrays.asList("8.5", GradleVersion.current().getVersion());
46+
return Arrays.asList("8.5", GradleVersion.current().getVersion(), "9.0.0-milestone-9");
4747
}
48-
return Arrays.asList("7.6.4", "8.4", GradleVersion.current().getVersion());
48+
return Arrays.asList("7.6.4", "8.4", GradleVersion.current().getVersion(), "9.0.0-milestone-9");
4949
}
5050

5151
public static String minimumCompatible() {

0 commit comments

Comments
 (0)