diff --git a/build-tools-internal/gradle/wrapper/gradle-wrapper.properties b/build-tools-internal/gradle/wrapper/gradle-wrapper.properties index 746f34227cb31..301e3289d0eb8 100644 --- a/build-tools-internal/gradle/wrapper/gradle-wrapper.properties +++ b/build-tools-internal/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip +distributionUrl=https\://services.gradle.org/distributions-snapshots/gradle-7.5-20220328221251+0000-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionSha256Sum=e6d864e3b5bc05cc62041842b306383fc1fefcec359e70cebb1d470a6094ca82 +distributionSha256Sum=023357320e171e5d55fc532ac1a7ae2fb22b453c10c3b7d2eb98ab7524b0a435 diff --git a/build-tools-internal/performance/elasticsearch-build-benchmark-part1.scenarios b/build-tools-internal/performance/elasticsearch-build-benchmark-part1.scenarios index 6b471a6f97e64..041cbf2dec95a 100644 --- a/build-tools-internal/performance/elasticsearch-build-benchmark-part1.scenarios +++ b/build-tools-internal/performance/elasticsearch-build-benchmark-part1.scenarios @@ -1,11 +1,11 @@ -# Can specify scenarios to use when none are specified on the command line -default-scenarios = ["buildConfiguration_master", "buildConfiguration_branch", "single_project_master", "single_project_branch"] +// ensure branch scenario is listed first as this is the gradle version that will picked for inspecting the build +default-scenarios = ["buildConfiguration_branch", "buildConfiguration_master", "single_project_branch", "single_project_master"] buildConfiguration_master { title = "configuration phase (master)" versions = ["@masterWrapper@"] tasks = ["help"] - gradle-args = ["--no-scan", "--no-build-cache"] + gradle-args = ["--no-scan", "--no-build-cache", "--stacktrace"] run-using = cli // value can be "cli" or "tooling-api" daemon = warm // value can be "warm", "cold", or "none" warm-ups = 5 @@ -22,7 +22,7 @@ buildConfiguration_branch { title = "configuration phase (@testGitCommit@)" versions = ["@branchWrapper@"] tasks = ["help"] - gradle-args = ["--no-scan", "--no-build-cache"] + gradle-args = ["--no-scan", "--no-build-cache", "--stacktrace"] run-using = cli // value can be "cli" or "tooling-api" daemon = warm // value can be "warm", "cold", or "none" warm-ups = 5 @@ -39,7 +39,7 @@ single_project_master { title = "single project (master)" versions = ["@masterWrapper@"] tasks = [":server:precommit"] - gradle-args = ["--no-scan"] + gradle-args = ["--no-scan", "--stacktrace"] apply-abi-change-to = "server/src/main/java/org/elasticsearch/bootstrap/BootstrapInfo.java" run-using = cli // value can be "cli" or "tooling-api" daemon = warm // value can be "warm", "cold", or "none" @@ -57,7 +57,7 @@ single_project_branch { title = "single project (@testGitCommit@)" versions = ["@branchWrapper@"] tasks = [":server:precommit"] - gradle-args = ["--no-scan"] + gradle-args = ["--no-scan", "--stacktrace"] apply-abi-change-to = "server/src/main/java/org/elasticsearch/bootstrap/BootstrapInfo.java" run-using = cli // value can be "cli" or "tooling-api" daemon = warm // value can be "warm", "cold", or "none" @@ -69,4 +69,4 @@ single_project_branch { git-checkout = { build = "@testGitCommit@" } -} \ No newline at end of file +} diff --git a/build-tools-internal/performance/elasticsearch-build-benchmark-part2.scenarios b/build-tools-internal/performance/elasticsearch-build-benchmark-part2.scenarios index 23387697ad49e..d8845b9c2e656 100644 --- a/build-tools-internal/performance/elasticsearch-build-benchmark-part2.scenarios +++ b/build-tools-internal/performance/elasticsearch-build-benchmark-part2.scenarios @@ -1,11 +1,12 @@ -default-scenarios = ["precommit_master", "precommit_branch"] +// ensure branch scenario is listed first as this is the gradle version that will picked for inspecting the build +default-scenarios = ["precommit_branch", "precommit_master"] precommit_master { title = "precommit (master)" versions = ["@masterWrapper@"] cleanup-tasks = ["clean"] tasks = ["precommit"] - gradle-args = ["--no-scan", "--no-build-cache"] + gradle-args = ["--no-scan", "--no-build-cache", "--stacktrace"] run-using = cli // value can be "cli" or "tooling-api" daemon = warm // value can be "warm", "cold", or "none" warm-ups = 5 @@ -23,7 +24,7 @@ precommit_branch { versions = ["@branchWrapper@"] cleanup-tasks = ["clean"] tasks = ["precommit"] - gradle-args = ["--no-scan", "--no-build-cache"] + gradle-args = ["--no-scan", "--no-build-cache", "--stacktrace"] run-using = cli // value can be "cli" or "tooling-api" daemon = warm // value can be "warm", "cold", or "none" warm-ups = 5 diff --git a/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/info/GlobalBuildInfoPlugin.java b/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/info/GlobalBuildInfoPlugin.java index 06e85abd4289f..da199cf00533d 100644 --- a/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/info/GlobalBuildInfoPlugin.java +++ b/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/info/GlobalBuildInfoPlugin.java @@ -71,10 +71,10 @@ public void apply(Project project) { if (project != project.getRootProject()) { throw new IllegalStateException(this.getClass().getName() + " can only be applied to the root project."); } - GradleVersion minimumGradleVersion = GradleVersion.version(getResourceContents("/minimumGradleVersion")); - if (GradleVersion.current().compareTo(minimumGradleVersion) < 0) { - throw new GradleException("Gradle " + minimumGradleVersion.getVersion() + "+ is required"); - } + // GradleVersion minimumGradleVersion = GradleVersion.version(getResourceContents("/minimumGradleVersion")); + // if (GradleVersion.current().compareTo(minimumGradleVersion) < 0) { + // throw new GradleException("Gradle " + minimumGradleVersion.getVersion() + "+ is required"); + // } JavaVersion minimumCompilerVersion = JavaVersion.toVersion(getResourceContents("/minimumCompilerVersion")); JavaVersion minimumRuntimeVersion = JavaVersion.toVersion(getResourceContents("/minimumRuntimeVersion")); 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 6f288e70a604b..49255eccdbc3b 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 @@ -12,19 +12,23 @@ import org.elasticsearch.gradle.internal.InternalPlugin; import org.elasticsearch.gradle.internal.conventions.precommit.PrecommitPlugin; import org.gradle.api.Action; +import org.gradle.api.GradleException; import org.gradle.api.Project; import org.gradle.api.Task; import org.gradle.api.artifacts.dsl.DependencyHandler; import org.gradle.api.plugins.quality.Checkstyle; import org.gradle.api.plugins.quality.CheckstyleExtension; +import org.gradle.api.provider.Property; import org.gradle.api.provider.Provider; import org.gradle.api.tasks.SourceSetContainer; import org.gradle.api.tasks.TaskProvider; +import org.gradle.util.GradleVersion; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.UncheckedIOException; +import java.lang.reflect.Method; import java.net.JarURLConnection; import java.net.URL; import java.nio.file.Files; @@ -92,6 +96,9 @@ public void execute(Task task) { project.getTasks().withType(Checkstyle.class).configureEach(t -> { t.dependsOn(copyCheckstyleConf); + // for being able to make performance tests + configureHeapSize(t, project); + // t.getMaxHeapSize().set("1g"); t.reports(r -> r.getHtml().getRequired().set(false)); }); @@ -108,4 +115,19 @@ public void execute(Task task) { return checkstyleTask; } + + /** + * TODO remove before merging after 7.5 final has been released and tested successfully + * */ + private void configureHeapSize(Checkstyle checkstyle, Project project) { + if (GradleVersion.current().compareTo(GradleVersion.version("7.4.1")) > 0) { + try { + Method getMaxHeapSize = checkstyle.getClass().getMethod("getMaxHeapSize"); + Property heapSizeProp = (Property) getMaxHeapSize.invoke(checkstyle); + heapSizeProp.set(project.getPath().equals(":server") ? "2g" : "1g"); + } catch (ReflectiveOperationException e) { + throw new GradleException("Failed to configure heapsize for checkstyle task", e); + } + } + } } diff --git a/build-tools-internal/src/main/resources/minimumGradleVersion b/build-tools-internal/src/main/resources/minimumGradleVersion index cb1d6217e16a1..b3e5f2a33d80e 100644 --- a/build-tools-internal/src/main/resources/minimumGradleVersion +++ b/build-tools-internal/src/main/resources/minimumGradleVersion @@ -1 +1 @@ -7.4.2 \ No newline at end of file +7.5-20220328221251+0000 diff --git a/build-tools-internal/src/test/java/org/elasticsearch/gradle/internal/precommit/UpdateShasTaskTests.java b/build-tools-internal/src/test/java/org/elasticsearch/gradle/internal/precommit/UpdateShasTaskTests.java index 46c8a76fe7f06..8957a437f15b2 100644 --- a/build-tools-internal/src/test/java/org/elasticsearch/gradle/internal/precommit/UpdateShasTaskTests.java +++ b/build-tools-internal/src/test/java/org/elasticsearch/gradle/internal/precommit/UpdateShasTaskTests.java @@ -33,6 +33,7 @@ public class UpdateShasTaskTests extends GradleUnitTestCase { + public static final String GROOVY_JAR_REGEX = "groovy-\\d\\.\\d+\\.\\d+\\.jar"; @Rule public ExpectedException expectedException = ExpectedException.none(); @@ -65,8 +66,9 @@ public void whenDependencyExistsButShaNotThenShouldCreateNewShaFile() throws IOE getLicensesDir(project).mkdir(); task.updateShas(); + Files.list(getLicensesDir(project).toPath()).forEach(System.out::println); Path groovySha = Files.list(getLicensesDir(project).toPath()) - .filter(p -> p.toFile().getName().matches("groovy-\\d\\.\\d\\.\\d\\.jar.sha1")) + .filter(p -> p.toFile().getName().matches(GROOVY_JAR_REGEX + ".sha1")) .findFirst() .get(); assertTrue(groovySha.toFile().getName().startsWith("groovy")); @@ -79,7 +81,7 @@ public void whenDependencyAndWrongShaExistsThenShouldNotOverwriteShaFile() throw .getDependencies() .getFiles() .stream() - .filter(f -> f.getName().matches("groovy-\\d\\.\\d\\.\\d\\.jar")) + .filter(f -> f.getName().matches(GROOVY_JAR_REGEX)) .findFirst() .get(); String groovyShaName = groovyJar.getName() + ".sha1"; diff --git a/build-tools/src/main/java/org/elasticsearch/gradle/testclusters/StandaloneRestIntegTestTask.java b/build-tools/src/main/java/org/elasticsearch/gradle/testclusters/StandaloneRestIntegTestTask.java index 694bcbaddf400..5cbca0132b27b 100644 --- a/build-tools/src/main/java/org/elasticsearch/gradle/testclusters/StandaloneRestIntegTestTask.java +++ b/build-tools/src/main/java/org/elasticsearch/gradle/testclusters/StandaloneRestIntegTestTask.java @@ -104,6 +104,8 @@ public List getSharedResources() { * We resolve this via reflection for now to be compatible with Gradle before and after 7.5. * This makes migration easier and allows gradle benchmark tests across gradle versions easier. * Likely will be removed in future version. + * + * TODO remove before merging after 7.5 final has been released and tested successfully * */ private ResourceLock getResourceLock(SharedResource resource, int nodeCount) { try { diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 41d9927a4d4fb..249e5832f090a 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 746f34227cb31..301e3289d0eb8 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.4.2-all.zip +distributionUrl=https\://services.gradle.org/distributions-snapshots/gradle-7.5-20220328221251+0000-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionSha256Sum=e6d864e3b5bc05cc62041842b306383fc1fefcec359e70cebb1d470a6094ca82 +distributionSha256Sum=023357320e171e5d55fc532ac1a7ae2fb22b453c10c3b7d2eb98ab7524b0a435 diff --git a/gradlew b/gradlew index 1b6c787337ffb..a69d9cb6c2065 100755 --- a/gradlew +++ b/gradlew @@ -205,6 +205,12 @@ set -- \ org.gradle.wrapper.GradleWrapperMain \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. diff --git a/gradlew.bat b/gradlew.bat index ac1b06f93825d..70bc2cea00d28 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +25,7 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -75,13 +75,13 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %ERRORLEVEL% +exit /b %ERRORLEVEL% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/plugins/examples/gradle/wrapper/gradle-wrapper.properties b/plugins/examples/gradle/wrapper/gradle-wrapper.properties index 746f34227cb31..301e3289d0eb8 100644 --- a/plugins/examples/gradle/wrapper/gradle-wrapper.properties +++ b/plugins/examples/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip +distributionUrl=https\://services.gradle.org/distributions-snapshots/gradle-7.5-20220328221251+0000-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionSha256Sum=e6d864e3b5bc05cc62041842b306383fc1fefcec359e70cebb1d470a6094ca82 +distributionSha256Sum=023357320e171e5d55fc532ac1a7ae2fb22b453c10c3b7d2eb98ab7524b0a435