Skip to content

Commit a3870f8

Browse files
committed
Merge branch '2.6.x' into 2.7.x
Closes gh-32987
2 parents a814fe9 + beb62be commit a3870f8

File tree

2 files changed

+21
-7
lines changed
  • spring-boot-project/spring-boot-tools
    • spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling
    • spring-boot-gradle-test-support/src/main/java/org/springframework/boot/testsupport/gradle/testkit

2 files changed

+21
-7
lines changed

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/Closures.java

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,20 @@
1818

1919
import groovy.lang.Closure;
2020
import org.gradle.api.Action;
21+
import org.gradle.util.GradleVersion;
2122

2223
/**
23-
* Wrapper for the deprecated {@link org.gradle.util.ConfigureUtil} that allows
24-
* deprecation warnings to be suppressed in a single, focused location.
24+
* Wrapper for {@code ConfigureUtil} that handles the API and behavior differences in the
25+
* versions of Gradle that we support.
26+
* <p>
27+
* In Gradle 7.1 {@code org.gradle.util.ConfigureUtil} was deprecated and
28+
* {@code org.gradle.util.internal.ConfigureUtil} was introduced as a replacement. In
29+
* Gradle 7.6, the deprecation of {@code org.gradle.util.ConfigureUtil} was strengthened
30+
* by reporting the use of deprecated API to the user.
31+
* <p>
32+
* To accommodate the differences, we use {@code org.gradle.util.internal.ConfigureUtil}
33+
* with Gradle 7.1 and later. With earlier versions, {@code org.gradle.util.ConfigureUtil}
34+
* is used. This avoids users by nagged about deprecated API usage in our plugin.
2535
*
2636
* @author Andy Wilkinson
2737
*/
@@ -33,7 +43,10 @@ private Closures() {
3343

3444
@SuppressWarnings("deprecation")
3545
static <T> Action<T> asAction(Closure<?> closure) {
36-
return org.gradle.util.ConfigureUtil.configureUsing(closure);
46+
if (GradleVersion.current().compareTo(GradleVersion.version("7.1")) < 0) {
47+
return org.gradle.util.ConfigureUtil.configureUsing(closure);
48+
}
49+
return org.gradle.util.internal.ConfigureUtil.configureUsing(closure);
3750
}
3851

3952
}

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,17 @@ private GradleVersions() {
3434

3535
public static List<String> allCompatible() {
3636
if (isJava18()) {
37-
return Arrays.asList("7.3.3", "7.4.2", GradleVersion.current().getVersion());
37+
return Arrays.asList("7.3.3", "7.4.2", GradleVersion.current().getVersion(), "7.6-rc-1");
3838
}
3939
if (isJava17()) {
40-
return Arrays.asList("7.2", "7.3.3", "7.4.2", GradleVersion.current().getVersion());
40+
return Arrays.asList("7.2", "7.3.3", "7.4.2", GradleVersion.current().getVersion(), "7.6-rc-1");
4141
}
4242
if (isJava16()) {
43-
return Arrays.asList("7.0.2", "7.1", "7.2", "7.3.3", "7.4.2", GradleVersion.current().getVersion());
43+
return Arrays.asList("7.0.2", "7.1", "7.2", "7.3.3", "7.4.2", GradleVersion.current().getVersion(),
44+
"7.6-rc-1");
4445
}
4546
return Arrays.asList("6.8.3", "6.9.3", "7.0.2", "7.1.1", "7.2", "7.3.3", "7.4.2",
46-
GradleVersion.current().getVersion());
47+
GradleVersion.current().getVersion(), "7.6-rc-1");
4748
}
4849

4950
public static String minimumCompatible() {

0 commit comments

Comments
 (0)