Merge branch '2.6.x' into 2.7.x

Closes gh-32987
This commit is contained in:
Andy Wilkinson 2022-11-03 10:23:30 +00:00
commit a3870f8da7
2 changed files with 21 additions and 7 deletions

View File

@ -18,10 +18,20 @@ package org.springframework.boot.gradle.tasks.bundling;
import groovy.lang.Closure;
import org.gradle.api.Action;
import org.gradle.util.GradleVersion;
/**
* Wrapper for the deprecated {@link org.gradle.util.ConfigureUtil} that allows
* deprecation warnings to be suppressed in a single, focused location.
* Wrapper for {@code ConfigureUtil} that handles the API and behavior differences in the
* versions of Gradle that we support.
* <p>
* In Gradle 7.1 {@code org.gradle.util.ConfigureUtil} was deprecated and
* {@code org.gradle.util.internal.ConfigureUtil} was introduced as a replacement. In
* Gradle 7.6, the deprecation of {@code org.gradle.util.ConfigureUtil} was strengthened
* by reporting the use of deprecated API to the user.
* <p>
* To accommodate the differences, we use {@code org.gradle.util.internal.ConfigureUtil}
* with Gradle 7.1 and later. With earlier versions, {@code org.gradle.util.ConfigureUtil}
* is used. This avoids users by nagged about deprecated API usage in our plugin.
*
* @author Andy Wilkinson
*/
@ -33,7 +43,10 @@ final class Closures {
@SuppressWarnings("deprecation")
static <T> Action<T> asAction(Closure<?> closure) {
return org.gradle.util.ConfigureUtil.configureUsing(closure);
if (GradleVersion.current().compareTo(GradleVersion.version("7.1")) < 0) {
return org.gradle.util.ConfigureUtil.configureUsing(closure);
}
return org.gradle.util.internal.ConfigureUtil.configureUsing(closure);
}
}

View File

@ -34,16 +34,17 @@ public final class GradleVersions {
public static List<String> allCompatible() {
if (isJava18()) {
return Arrays.asList("7.3.3", "7.4.2", GradleVersion.current().getVersion());
return Arrays.asList("7.3.3", "7.4.2", GradleVersion.current().getVersion(), "7.6-rc-1");
}
if (isJava17()) {
return Arrays.asList("7.2", "7.3.3", "7.4.2", GradleVersion.current().getVersion());
return Arrays.asList("7.2", "7.3.3", "7.4.2", GradleVersion.current().getVersion(), "7.6-rc-1");
}
if (isJava16()) {
return Arrays.asList("7.0.2", "7.1", "7.2", "7.3.3", "7.4.2", GradleVersion.current().getVersion());
return Arrays.asList("7.0.2", "7.1", "7.2", "7.3.3", "7.4.2", GradleVersion.current().getVersion(),
"7.6-rc-1");
}
return Arrays.asList("6.8.3", "6.9.3", "7.0.2", "7.1.1", "7.2", "7.3.3", "7.4.2",
GradleVersion.current().getVersion());
GradleVersion.current().getVersion(), "7.6-rc-1");
}
public static String minimumCompatible() {