Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to to Gradle wrapper 7.5 #85141

Merged
merged 33 commits into from
Jul 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
86c18e9
Update to to Gradle wrapper 7.5
breskeby Mar 20, 2022
c9f830f
Update to latest gradle 7.5 nightly
breskeby Apr 1, 2022
d190b3d
Update to latest 7.5 snapshot
breskeby Apr 11, 2022
04fdd1a
Clean imports
breskeby Apr 11, 2022
38ba194
Fix spotless
breskeby Apr 11, 2022
8c63e68
Update to latest gradle nightly
breskeby Apr 12, 2022
d8fa6ee
Update to latest 7.5 snapshot
breskeby May 2, 2022
8565826
Fix TestResultProcessor api change
breskeby May 2, 2022
74a92b0
Update to latest snapshot containing more debug tracing
breskeby May 4, 2022
92bc4bd
Temporally fix incompatibilities with Gradle 7-5
breskeby May 4, 2022
71b6402
Update wrapper to include artifact transform fix
breskeby May 4, 2022
b7853c5
Update wrapper to debug build locks
breskeby May 6, 2022
fa9187e
Update gradle wrapper to another debug snapshot
breskeby May 9, 2022
41b3291
Update to another debug version
breskeby May 10, 2022
06c79ee
Revert "Temporally fix incompatibilities with Gradle 7-5"
breskeby May 11, 2022
616bb77
Revert "Fix TestResultProcessor api change"
breskeby May 11, 2022
06994d2
Revert more changes based on earlier nightly snapshots
breskeby May 11, 2022
727b89c
Update wrapper to 7.5-milestone-1
breskeby May 12, 2022
5f6ec44
Update wrapper to 7.5-rc-1
breskeby May 12, 2022
9b7c842
Keep 7.4.2 as minimum gradle version for benchmark testing
breskeby May 30, 2022
4f95e2d
tweak checkstyle memory settings
breskeby May 31, 2022
cd04067
tweak performance test setup to handle gradle update scenarios better
breskeby Jun 1, 2022
83334ec
Update to 7.5-rc-2
breskeby Jun 13, 2022
5fe0619
Keep 7.4.2 as minimum gradle version for benchmark testing
breskeby Jun 13, 2022
29c66ad
Update to 7.5-rc-3
breskeby Jul 6, 2022
83f0f2f
Fix expected test output taking gradleversion into account
breskeby Jul 6, 2022
c7a4676
Update to Gradle 7.5-rc-4
breskeby Jul 7, 2022
0d4d285
Update wrapper to 7.5-rc-5
breskeby Jul 14, 2022
e058d3e
Update wrapper to 7.5
breskeby Jul 15, 2022
b4edd08
Update minimum gradle version
breskeby Jul 15, 2022
419f691
Cleanup 7.5 update after GA has been tested
breskeby Jul 15, 2022
38c8b69
Polishing
breskeby Jul 15, 2022
0a4b784
Remove debug
breskeby Jul 18, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion build-tools-internal/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -311,10 +311,11 @@ tasks.register("bootstrapPerformanceTests", Copy) {
from('performance')
into('build/performanceTests')
def root = file('..')
inputs.property('branchWrapper', gradle.gradleVersion)
filter(ReplaceTokens, tokens: [
testGitCommit:GitInfo.gitInfo(root).revision,
masterWrapper:"${ -> resolveMasterWrapperVersion()}".toString(),
branchWrapper:"${-> new File(root, "build-tools-internal/src/main/resources/minimumGradleVersion").text}".toString()])
branchWrapper:"${-> gradle.gradleVersion}".toString()])
}

def resolveMasterWrapperVersion() {
Expand Down
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.4.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionSha256Sum=e6d864e3b5bc05cc62041842b306383fc1fefcec359e70cebb1d470a6094ca82
distributionSha256Sum=97a52d145762adc241bad7fd18289bf7f6801e08ece6badf80402fe2b9f250b1
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -69,4 +69,4 @@ single_project_branch {
git-checkout = {
build = "@testGitCommit@"
}
}
}
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ package org.elasticsearch.gradle.internal.snyk
import org.elasticsearch.gradle.fixtures.AbstractGradleInternalPluginFuncTest
import org.gradle.api.Plugin
import org.gradle.testkit.runner.TaskOutcome
import org.gradle.util.GradleVersion
import org.skyscreamer.jsonassert.JSONAssert

import static java.net.HttpURLConnection.HTTP_CREATED
Expand Down Expand Up @@ -57,7 +58,7 @@ class SnykDependencyMonitoringGradlePluginFuncTest extends AbstractGradleInterna
},
"depGraphJSON": {
"pkgManager": {
"version": "7.4.2",
"version": "${GradleVersion.current().version}",
"name": "gradle"
},
"schemaVersion": "1.2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ public void execute(Task task) {

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

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.4.2
7.5
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -66,7 +67,7 @@ public void whenDependencyExistsButShaNotThenShouldCreateNewShaFile() throws IOE
getLicensesDir(project).mkdir();
task.updateShas();
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"));
Expand All @@ -79,7 +80,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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

import org.elasticsearch.gradle.FileSystemOperationsAware;
import org.elasticsearch.gradle.util.GradleUtils;
import org.gradle.api.GradleException;
import org.gradle.api.provider.Provider;
import org.gradle.api.services.internal.BuildServiceRegistryInternal;
import org.gradle.api.tasks.CacheableTask;
Expand All @@ -20,11 +19,8 @@
import org.gradle.api.tasks.testing.Test;
import org.gradle.internal.resources.ResourceLock;
import org.gradle.internal.resources.SharedResource;
import org.gradle.util.GradleVersion;

import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
Expand Down Expand Up @@ -94,32 +90,11 @@ public List<ResourceLock> getSharedResources() {

int nodeCount = clusters.stream().mapToInt(cluster -> cluster.getNodes().size()).sum();
if (nodeCount > 0) {
locks.add(getResourceLock(resource, nodeCount));
locks.add(resource.getResourceLock());
}
return Collections.unmodifiableList(locks);
}

/**
* SharedResource#getResourceLock has changed its parameters with Gradle 7.5.
* 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.
* */
private ResourceLock getResourceLock(SharedResource resource, int nodeCount) {
try {
Method getResourceLock = Arrays.stream(resource.getClass().getMethods())
.filter(p -> p.getName().equals("getResourceLock"))
.findFirst()
.get();
getResourceLock.setAccessible(true);
return (ResourceLock) (GradleVersion.current().compareTo(GradleVersion.version("7.5.0")) < 0
? getResourceLock.invoke(resource, Math.min(nodeCount, resource.getMaxUsages()))
: getResourceLock.invoke(resource));
} catch (Exception e) {
throw new GradleException("Unable to get ResourceLock", e);
}
}

public WorkResult delete(Object... objects) {
return getFileSystemOperations().delete(d -> d.delete(objects));
}
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.4.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionSha256Sum=e6d864e3b5bc05cc62041842b306383fc1fefcec359e70cebb1d470a6094ca82
distributionSha256Sum=97a52d145762adc241bad7fd18289bf7f6801e08ece6badf80402fe2b9f250b1
6 changes: 6 additions & 0 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
14 changes: 8 additions & 6 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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%

Expand All @@ -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.
Expand Down Expand Up @@ -75,13 +75,15 @@ 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
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%

:mainEnd
if "%OS%"=="Windows_NT" endlocal
Expand Down
4 changes: 2 additions & 2 deletions plugins/examples/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.4.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionSha256Sum=e6d864e3b5bc05cc62041842b306383fc1fefcec359e70cebb1d470a6094ca82
distributionSha256Sum=97a52d145762adc241bad7fd18289bf7f6801e08ece6badf80402fe2b9f250b1
2 changes: 2 additions & 0 deletions server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -246,3 +246,5 @@ tasks.named("licenseHeaders").configure {
excludes << 'org/apache/lucene/search/RegExp87*'
excludes << 'org/apache/lucene/search/RegexpQuery87*'
}

tasks.withType(Checkstyle.class).configureEach { t -> t.getMaxHeapSize().set("2g") }