diff --git a/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/ElasticsearchTestBasePlugin.java b/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/ElasticsearchTestBasePlugin.java index 7a7619e61f45e..47be2d03f587f 100644 --- a/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/ElasticsearchTestBasePlugin.java +++ b/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/ElasticsearchTestBasePlugin.java @@ -49,7 +49,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); diff --git a/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/precommit/CheckstylePrecommitPlugin.java b/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/precommit/CheckstylePrecommitPlugin.java index 582fb2e4e0df5..80251b3a7ca56 100644 --- a/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/precommit/CheckstylePrecommitPlugin.java +++ b/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/precommit/CheckstylePrecommitPlugin.java @@ -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; diff --git a/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/precommit/LoggerUsageTask.java b/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/precommit/LoggerUsageTask.java index 69487778ebce0..a1a025eeea6d3 100644 --- a/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/precommit/LoggerUsageTask.java +++ b/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/precommit/LoggerUsageTask.java @@ -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; @@ -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); }); @@ -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 diff --git a/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/precommit/ThirdPartyAuditTask.java b/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/precommit/ThirdPartyAuditTask.java index 90611ceca5f84..cd2722870303f 100644 --- a/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/precommit/ThirdPartyAuditTask.java +++ b/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/precommit/ThirdPartyAuditTask.java @@ -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) { @@ -364,7 +364,7 @@ private Set 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) { diff --git a/build-tools-internal/src/main/resources/minimumGradleVersion b/build-tools-internal/src/main/resources/minimumGradleVersion index 2f963cd6d1c36..986084f369cdd 100644 --- a/build-tools-internal/src/main/resources/minimumGradleVersion +++ b/build-tools-internal/src/main/resources/minimumGradleVersion @@ -1 +1 @@ -7.0.2 \ No newline at end of file +7.1 \ No newline at end of file diff --git a/build-tools/src/main/java/org/elasticsearch/gradle/LoggedExec.java b/build-tools/src/main/java/org/elasticsearch/gradle/LoggedExec.java index 5ce64e9eb8552..a9d077e456285 100644 --- a/build-tools/src/main/java/org/elasticsearch/gradle/LoggedExec.java +++ b/build-tools/src/main/java/org/elasticsearch/gradle/LoggedExec.java @@ -55,7 +55,8 @@ public LoggedExec(FileSystemOperations fileSystemOperations) { doLast(new Action() { @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()); @@ -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 ) ); } diff --git a/build-tools/src/main/java/org/elasticsearch/gradle/jarhell/JarHellTask.java b/build-tools/src/main/java/org/elasticsearch/gradle/jarhell/JarHellTask.java index a85678f56d340..d487b242669d0 100644 --- a/build-tools/src/main/java/org/elasticsearch/gradle/jarhell/JarHellTask.java +++ b/build-tools/src/main/java/org/elasticsearch/gradle/jarhell/JarHellTask.java @@ -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(); } diff --git a/build.gradle b/build.gradle index 935fe57240409..13862afc4e026 100644 --- a/build.gradle +++ b/build.gradle @@ -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" } } diff --git a/distribution/packages/build.gradle b/distribution/packages/build.gradle index ee7acdc043740..f54d76f7669e1 100644 --- a/distribution/packages/build.gradle +++ b/distribution/packages/build.gradle @@ -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" } } @@ -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" @@ -286,8 +283,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 ' diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index e708b1c023ec8..7454180f2ae88 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 57e152bd1dc07..ed19318388cca 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -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 diff --git a/gradlew b/gradlew index 4f906e0c811fc..744e882ed5726 100755 --- a/gradlew +++ b/gradlew @@ -72,7 +72,7 @@ case "`uname`" in Darwin* ) darwin=true ;; - MINGW* ) + MSYS* | MINGW* ) msys=true ;; NONSTOP* ) diff --git a/settings.gradle b/settings.gradle index 63c699b30e889..0e7b172f0f389 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,5 +1,5 @@ plugins { - id "com.gradle.enterprise" version "3.5.1" + id "com.gradle.enterprise" version "3.6.2" } includeBuild "build-conventions"