Skip to content

Commit

Permalink
Update Gradle wrapper to 7.2 (elastic#75894)
Browse files Browse the repository at this point in the history
* Update Gradle wrapper to 7.2-rc-1

Fix deprecation warnings on the go

* Remove deprecated lambda based Gradle task actions

* Remove usage of deprecated BasePluginConvention

* Update wrapper to 7.2-rc-2

* Update gradle wrapper to 7.2-rc-3

* Update gradle wrapper to 7.2
  • Loading branch information
breskeby authored Aug 18, 2021
1 parent 87ca6fa commit 86a5772
Show file tree
Hide file tree
Showing 8 changed files with 187 additions and 128 deletions.
4 changes: 2 additions & 2 deletions build-tools-internal/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionSha256Sum=9bb8bc05f562f2d42bdf1ba8db62f6b6fa1c3bf6c392228802cc7cb0578fe7e0
distributionSha256Sum=a8da5b02437a60819cad23e10fc7e9cf32bcb57029d9cb277e26eeff76ce014b
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.elasticsearch.gradle.Version;
import org.gradle.api.GradleException;
import org.gradle.api.Project;
import org.gradle.api.Task;
import org.gradle.api.logging.LogLevel;
import org.gradle.api.provider.Provider;
import org.gradle.api.tasks.TaskProvider;
Expand Down Expand Up @@ -65,11 +66,14 @@ private TaskProvider<LoggedExec> createRunBwcGradleTask(Project project, String
loggedExec.usesService(bwcTaskThrottleProvider);
loggedExec.setSpoolOutput(true);
loggedExec.setWorkingDir(checkoutDir.get());
loggedExec.doFirst(t -> {
// Execution time so that the checkouts are available
String compilerVersionInfoPath = minimumCompilerVersionPath(unreleasedVersionInfo.get().version);
String minimumCompilerVersion = readFromFile(new File(checkoutDir.get(), compilerVersionInfoPath));
loggedExec.environment("JAVA_HOME", getJavaHome(Integer.parseInt(minimumCompilerVersion)));
loggedExec.doFirst(new Action<Task>() {
@Override
public void execute(Task t) {
// Execution time so that the checkouts are available
String compilerVersionInfoPath = minimumCompilerVersionPath(unreleasedVersionInfo.get().version);
String minimumCompilerVersion = readFromFile(new File(checkoutDir.get(), compilerVersionInfoPath));
loggedExec.environment("JAVA_HOME", getJavaHome(Integer.parseInt(minimumCompilerVersion)));
}
});

if (Os.isFamily(Os.FAMILY_WINDOWS)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.elasticsearch.gradle.Version;
import org.elasticsearch.gradle.internal.info.BuildParams;
import org.elasticsearch.gradle.internal.info.GlobalBuildInfoPlugin;
import org.gradle.api.Action;
import org.gradle.api.InvalidUserDataException;
import org.gradle.api.Project;
import org.gradle.api.Task;
Expand Down Expand Up @@ -237,14 +238,16 @@ static void createBuildBwcTask(
if (project.getGradle().getStartParameter().isBuildCacheEnabled()) {
c.args("--build-cache");
}
c.doLast(task -> {
if (expectedOutputFile.exists() == false) {
throw new InvalidUserDataException(
"Building " + bwcVersion.get() + " didn't generate expected artifact " + expectedOutputFile
);
c.doLast(new Action<Task>() {
@Override
public void execute(Task task) {
if (expectedOutputFile.exists() == false) {
throw new InvalidUserDataException(
"Building " + bwcVersion.get() + " didn't generate expected artifact " + expectedOutputFile
);
}
}
});

});
bwcTaskProvider.configure(t -> t.dependsOn(bwcTaskName));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import org.gradle.api.artifacts.Configuration;
import org.gradle.api.artifacts.Dependency;
import org.gradle.api.artifacts.dsl.DependencyHandler;
import org.gradle.api.plugins.BasePluginConvention;
import org.gradle.api.plugins.BasePluginExtension;
import org.gradle.api.plugins.JavaPlugin;
import org.gradle.api.plugins.JavaPluginExtension;
import org.gradle.api.provider.ProviderFactory;
Expand Down Expand Up @@ -50,10 +50,10 @@ public void registerTestArtifactFromSourceSet(SourceSet sourceSet) {
// PolicyUtil doesn't handle classifier notation well probably.
// Instead of fixing PoliceUtil we stick to the pattern of changing
// the basename here to indicate its a test artifacts jar.
BasePluginConvention convention = (BasePluginConvention) project.getConvention().getPlugins().get("base");
BasePluginExtension pluginExtension = project.getExtensions().getByType(BasePluginExtension.class);
project.getTasks().named(name + "Jar", Jar.class).configure(jar -> {
jar.getArchiveBaseName()
.convention(providerFactory.provider(() -> convention.getArchivesBaseName() + "-" + name + "-artifacts"));
.convention(providerFactory.provider(() -> pluginExtension.getArchivesName().get() + "-" + name + "-artifacts"));
jar.getArchiveClassifier().set("");
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,14 @@ public void apply(Project project) {

TaskProvider<Task> preProcessFixture = project.getTasks().register("preProcessFixture", t -> {
t.getOutputs().dir(testfixturesDir);
t.doFirst(t2 -> {
try {
Files.createDirectories(testfixturesDir.toPath());
} catch (IOException e) {
throw new UncheckedIOException(e);
t.doFirst(new Action<Task>() {
@Override
public void execute(Task task) {
try {
Files.createDirectories(testfixturesDir.toPath());
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
});
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.1.1
7.2
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionSha256Sum=9bb8bc05f562f2d42bdf1ba8db62f6b6fa1c3bf6c392228802cc7cb0578fe7e0
distributionSha256Sum=a8da5b02437a60819cad23e10fc7e9cf32bcb57029d9cb277e26eeff76ce014b
Loading

0 comments on commit 86a5772

Please sign in to comment.