Skip to content

Commit

Permalink
Update wrapper to 7.1 (#73941)
Browse files Browse the repository at this point in the history
- Fix new introduced deprecated usages
- Update to newer ospackage snapshot to include provided PR for fixing deprecated usage

This gradle release comes with improvements on incremental compilation which we should benefit from
  • Loading branch information
breskeby committed Jun 17, 2021
1 parent c1e9590 commit c2e8625
Show file tree
Hide file tree
Showing 13 changed files with 19 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void apply(Project project) {
File heapdumpDir = new File(project.getBuildDir(), "heapdump");

project.getTasks().withType(Test.class).configureEach(test -> {
File testOutputDir = new File(test.getReports().getJunitXml().getDestination(), "output");
File testOutputDir = new File(test.getReports().getJunitXml().getOutputLocation().getAsFile().get(), "output");

ErrorReportingTestListener listener = new ErrorReportingTestListener(test.getTestLogging(), test.getLogger(), testOutputDir);
test.getExtensions().add("errorReportingTestListener", listener);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public void execute(Task task) {

project.getTasks().withType(Checkstyle.class).configureEach(t -> {
t.dependsOn(copyCheckstyleConf);
t.reports(r -> r.getHtml().setEnabled(false));
t.reports(r -> r.getHtml().getRequired().set(false));
});

return checkstyleTask;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.elasticsearch.gradle.internal.conventions.precommit.PrecommitTask;
import org.gradle.api.file.FileCollection;
import org.gradle.api.plugins.JavaPluginConvention;
import org.gradle.api.plugins.JavaPluginExtension;
import org.gradle.api.tasks.CacheableTask;
import org.gradle.api.tasks.Classpath;
import org.gradle.api.tasks.InputFiles;
Expand Down Expand Up @@ -43,7 +44,7 @@ public LoggerUsageTask(ExecOperations execOperations) {
@TaskAction
public void runLoggerUsageTask() {
LoggedExec.javaexec(execOperations, spec -> {
spec.setMain("org.elasticsearch.test.loggerusage.ESLoggerUsageChecker");
spec.getMainClass().set("org.elasticsearch.test.loggerusage.ESLoggerUsageChecker");
spec.classpath(getClasspath());
getClassDirectories().forEach(spec::args);
});
Expand All @@ -62,8 +63,7 @@ public void setClasspath(FileCollection classpath) {
@PathSensitive(PathSensitivity.RELATIVE)
@SkipWhenEmpty
public FileCollection getClassDirectories() {
return getProject().getConvention()
.getPlugin(JavaPluginConvention.class)
return getProject().getExtensions().getByType(JavaPluginExtension.class)
.getSourceSets()
.stream()
// Don't pick up all source sets like the java9 ones as logger-check doesn't support the class format
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ private String runForbiddenAPIsCli() throws IOException {
getProject().getConfigurations().getByName(CompileOnlyResolvePlugin.RESOLVEABLE_COMPILE_ONLY_CONFIGURATION_NAME)
);
spec.jvmArgs("-Xmx1g");
spec.setMain("de.thetaphi.forbiddenapis.cli.CliMain");
spec.getMainClass().set("de.thetaphi.forbiddenapis.cli.CliMain");
spec.args("-f", getSignatureFile().getAbsolutePath(), "-d", getJarExpandDir(), "--allowmissingclasses");
spec.setErrorOutput(errorOut);
if (getLogger().isInfoEnabled() == false) {
Expand Down Expand Up @@ -364,7 +364,7 @@ private Set<String> runJdkJarHellCheck() throws IOException {
getProject().getConfigurations().getByName(CompileOnlyResolvePlugin.RESOLVEABLE_COMPILE_ONLY_CONFIGURATION_NAME)
);

spec.setMain(JDK_JAR_HELL_MAIN_CLASS);
spec.getMainClass().set(JDK_JAR_HELL_MAIN_CLASS);
spec.args(getJarExpandDir());
spec.setIgnoreExitValue(true);
if (javaHome != null) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.0.2
7.1
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ public LoggedExec(FileSystemOperations fileSystemOperations) {
doLast(new Action<Task>() {
@Override
public void execute(Task task) {
if (LoggedExec.this.getExecResult().getExitValue() != 0) {
int exitValue = LoggedExec.this.getExecutionResult().get().getExitValue();
if (exitValue != 0) {
try {
LoggedExec.this.getLogger().error("Output for " + LoggedExec.this.getExecutable() + ":");
outputLogger.accept(LoggedExec.this.getLogger());
Expand All @@ -67,7 +68,7 @@ public void execute(Task task) {
"Process '%s %s' finished with non-zero exit value %d",
LoggedExec.this.getExecutable(),
LoggedExec.this.getArgs(),
LoggedExec.this.getExecResult().getExitValue()
exitValue
)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public File getSuccessMarker() {
public void runJarHellCheck() throws IOException{
LoggedExec.javaexec(execOperations, spec -> {
spec.environment("CLASSPATH", getJarHellRuntimeClasspath().plus(getClasspath()).getAsPath());
spec.setMain("org.elasticsearch.jdk.JarHell");
spec.getMainClass().set("org.elasticsearch.jdk.JarHell");
});
writeMarker();
}
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ tasks.named("wrapper").configure {
println "Added checksum to wrapper properties"
// Update build-tools to reflect the Gradle upgrade
// TODO: we can remove this once we have tests to make sure older versions work.
project(':build-tools').file('src/main/resources/minimumGradleVersion').text = gradleVersion
project.file('build-tools-internal/src/main/resources/minimumGradleVersion').text = gradleVersion
println "Updated minimum Gradle Version"
}
}
Expand Down
9 changes: 2 additions & 7 deletions distribution/packages/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ buildscript {
maven { url 'https://jitpack.io' }
}
dependencies {
classpath "com.github.breskeby:gradle-ospackage-plugin:ddb72a9922b934033827d48d296f7f3d470ac422"
classpath "com.github.breskeby:gradle-ospackage-plugin:98455c1"
}
}

Expand Down Expand Up @@ -124,10 +124,7 @@ Closure commonPackageConfig(String type, boolean oss, boolean jdk, String archit
String jdkString = jdk ? "" : "no-jdk-"
String prefix = "${architecture == 'aarch64' ? 'aarch64-' : ''}${oss ? 'oss-' : ''}${jdk ? '' : 'no-jdk-'}${type}"
destinationDirectory = file("${prefix}/build/distributions")

// SystemPackagingTask overrides default archive task convention mappings, but doesn't provide a setter so we have to override the convention mapping itself
conventionMapping.archiveFile = { objects.fileProperty().fileValue(file("${destinationDirectory.get()}/${packageName}-${project.version}-${jdkString}${archString}.${type}")) }

archiveFileName.value(project.provider({ "${packageName}-${project.version}-${jdkString}${archString}.${type}" } ))
String packagingFiles = "build/packaging/${oss ? 'oss-' : ''}${jdk ? '' : 'no-jdk-'}${type}"

String scripts = "${packagingFiles}/scripts"
Expand Down Expand Up @@ -278,8 +275,6 @@ Closure commonPackageConfig(String type, boolean oss, boolean jdk, String archit
}
}

apply plugin: 'nebula.ospackage-base'

// this is package indepdendent configuration
ospackage {
maintainer 'Elasticsearch Team <info@elastic.co>'
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
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.0.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionSha256Sum=13bf8d3cf8eeeb5770d19741a59bde9bd966dd78d17f1bbad787a05ef19d1c2d
distributionSha256Sum=a9e356a21595348b6f04b024ed0b08ac8aea6b2ac37e6c0ef58e51549cd7b9cb
2 changes: 1 addition & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ case "`uname`" in
Darwin* )
darwin=true
;;
MINGW* )
MSYS* | MINGW* )
msys=true
;;
NONSTOP* )
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id "com.gradle.enterprise" version "3.5.1"
id "com.gradle.enterprise" version "3.6.2"
}

includeBuild "build-conventions"
Expand Down

0 comments on commit c2e8625

Please sign in to comment.