Skip to content

Commit de54e06

Browse files
authored
[8.14] Update Gradle wrapper to 8.8 (#108021) (#109345)
(cherry picked from commit 8ac3e3d) * Add asm 9.7 to verification metadata
1 parent 8865227 commit de54e06

29 files changed

+356
-230
lines changed

build-conventions/build.gradle

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@
88

99
import org.gradle.plugins.ide.eclipse.model.SourceFolder
1010

11+
12+
buildscript {
13+
repositories {
14+
maven {
15+
url 'https://jitpack.io'
16+
}
17+
mavenCentral()
18+
}
19+
}
20+
1121
plugins {
1222
id 'java-gradle-plugin'
1323
id 'java-test-fixtures'
@@ -59,6 +69,10 @@ gradlePlugin {
5969
}
6070

6171
repositories {
72+
maven {
73+
url 'https://jitpack.io'
74+
}
75+
6276
mavenCentral()
6377
gradlePluginPortal()
6478
}

build-tools-internal/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,9 @@ tasks.named('licenseHeaders').configure {
257257
*****************************************************************************/
258258

259259
repositories {
260+
maven {
261+
url 'https://jitpack.io'
262+
}
260263
mavenCentral()
261264
gradlePluginPortal()
262265
}

build-tools-internal/gradle/wrapper/gradle-wrapper.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionSha256Sum=194717442575a6f96e1c1befa2c30e9a4fc90f701d7aee33eb879b79e7ff05c0
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
3+
distributionSha256Sum=f8b4f4772d302c8ff580bc40d0f56e715de69b163546944f787c87abf209c961
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-all.zip
55
networkTimeout=10000
66
validateDistributionUrl=true
77
zipStoreBase=GRADLE_USER_HOME
Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
pluginManagement {
2-
includeBuild "../build-conventions"
2+
repositories {
3+
maven {
4+
url 'https://jitpack.io'
5+
}
6+
mavenCentral()
7+
gradlePluginPortal()
8+
}
9+
10+
includeBuild "../build-conventions"
311
includeBuild "../build-tools"
412
}
513

@@ -9,4 +17,4 @@ dependencyResolutionManagement {
917
from(files("../gradle/build.versions.toml"))
1018
}
1119
}
12-
}
20+
}

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/InternalDistributionArchiveSetupPlugin.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ private void configureGeneralTaskDefaults(Project project) {
9999
project.getTasks().withType(AbstractCopyTask.class).configureEach(t -> {
100100
t.dependsOn(project.getTasks().withType(EmptyDirTask.class));
101101
t.setIncludeEmptyDirs(true);
102-
t.setDirMode(0755);
103-
t.setFileMode(0644);
102+
t.dirPermissions(permissions -> permissions.unix(0755));
103+
t.filePermissions(permissions -> permissions.unix(0644));
104104
});
105105

106106
// common config across all archives

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/SymbolicLinkPreservingTar.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ private void visitSymbolicLink(final FileCopyDetailsInternal details) {
145145
visitedSymbolicLinks.add(details.getFile());
146146
final TarArchiveEntry entry = new TarArchiveEntry(details.getRelativePath().getPathString(), TarConstants.LF_SYMLINK);
147147
entry.setModTime(getModTime(details));
148-
entry.setMode(UnixStat.LINK_FLAG | details.getMode());
148+
entry.setMode(UnixStat.LINK_FLAG | details.getPermissions().toUnixNumeric());
149149
try {
150150
entry.setLinkName(Files.readSymbolicLink(details.getFile().toPath()).toString());
151151
tar.putArchiveEntry(entry);
@@ -158,7 +158,7 @@ private void visitSymbolicLink(final FileCopyDetailsInternal details) {
158158
private void visitDirectory(final FileCopyDetailsInternal details) {
159159
final TarArchiveEntry entry = new TarArchiveEntry(details.getRelativePath().getPathString() + "/");
160160
entry.setModTime(getModTime(details));
161-
entry.setMode(UnixStat.DIR_FLAG | details.getMode());
161+
entry.setMode(UnixStat.DIR_FLAG | details.getPermissions().toUnixNumeric());
162162
try {
163163
tar.putArchiveEntry(entry);
164164
tar.closeArchiveEntry();
@@ -170,7 +170,7 @@ private void visitDirectory(final FileCopyDetailsInternal details) {
170170
private void visitFile(final FileCopyDetailsInternal details) {
171171
final TarArchiveEntry entry = new TarArchiveEntry(details.getRelativePath().getPathString());
172172
entry.setModTime(getModTime(details));
173-
entry.setMode(UnixStat.FILE_FLAG | details.getMode());
173+
entry.setMode(UnixStat.FILE_FLAG | details.getPermissions().toUnixNumeric());
174174
entry.setSize(details.getSize());
175175
try {
176176
tar.putArchiveEntry(entry);

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/info/GlobalBuildInfoPlugin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ private List<JavaHome> getAvailableJavaVersions() {
260260
private Stream<InstallationLocation> getAvailableJavaInstallationLocationSteam() {
261261
return Stream.concat(
262262
javaInstallationRegistry.toolchains().stream().map(metadata -> metadata.location),
263-
Stream.of(new InstallationLocation(Jvm.current().getJavaHome(), "Current JVM"))
263+
Stream.of(InstallationLocation.userDefined(Jvm.current().getJavaHome(), "Current JVM"))
264264
);
265265
}
266266

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/precommit/DependencyLicensesPrecommitPlugin.java

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,23 @@
1212
import org.elasticsearch.gradle.internal.conventions.precommit.PrecommitPlugin;
1313
import org.gradle.api.Project;
1414
import org.gradle.api.Task;
15-
import org.gradle.api.artifacts.Configuration;
16-
import org.gradle.api.artifacts.ProjectDependency;
15+
import org.gradle.api.artifacts.component.ComponentIdentifier;
16+
import org.gradle.api.artifacts.component.ModuleComponentIdentifier;
1717
import org.gradle.api.plugins.JavaPlugin;
18+
import org.gradle.api.specs.Spec;
1819
import org.gradle.api.tasks.TaskProvider;
1920

2021
public class DependencyLicensesPrecommitPlugin extends PrecommitPlugin {
22+
private static Spec<ComponentIdentifier> COMPONENT_FILTER = identifier -> (identifier instanceof ModuleComponentIdentifier)
23+
&& ((ModuleComponentIdentifier) identifier).getGroup().startsWith("org.elasticsearch") == false;
2124

2225
@Override
2326
public TaskProvider<? extends Task> createTask(Project project) {
2427
project.getPlugins().apply(CompileOnlyResolvePlugin.class);
25-
TaskProvider<DependencyLicensesTask> dependencyLicenses = project.getTasks()
26-
.register("dependencyLicenses", DependencyLicensesTask.class);
27-
28-
// only require dependency licenses for non-elasticsearch deps
29-
dependencyLicenses.configure(t -> {
30-
Configuration runtimeClasspath = project.getConfigurations().getByName(JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME);
31-
Configuration compileOnly = project.getConfigurations()
32-
.getByName(CompileOnlyResolvePlugin.RESOLVEABLE_COMPILE_ONLY_CONFIGURATION_NAME);
33-
t.setDependencies(
34-
runtimeClasspath.fileCollection(
35-
dependency -> dependency instanceof ProjectDependency == false
36-
&& dependency.getGroup().startsWith("org.elasticsearch") == false
37-
).minus(compileOnly)
38-
);
28+
var dependencyLicenses = project.getTasks().register("dependencyLicenses", DependencyLicensesTask.class, t -> {
29+
var runtimeClasspath = project.getConfigurations().getByName(JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME);
30+
var compileOnly = project.getConfigurations().getByName(CompileOnlyResolvePlugin.RESOLVEABLE_COMPILE_ONLY_CONFIGURATION_NAME);
31+
t.configureDependencies(runtimeClasspath, compileOnly, COMPONENT_FILTER);
3932
});
4033
return dependencyLicenses;
4134
}

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/precommit/DependencyLicensesTask.java

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,18 @@
1111
import org.gradle.api.DefaultTask;
1212
import org.gradle.api.GradleException;
1313
import org.gradle.api.InvalidUserDataException;
14+
import org.gradle.api.artifacts.Configuration;
15+
import org.gradle.api.artifacts.component.ComponentIdentifier;
1416
import org.gradle.api.file.Directory;
1517
import org.gradle.api.file.DirectoryProperty;
1618
import org.gradle.api.file.FileCollection;
1719
import org.gradle.api.file.ProjectLayout;
1820
import org.gradle.api.logging.Logger;
1921
import org.gradle.api.logging.Logging;
2022
import org.gradle.api.model.ObjectFactory;
23+
import org.gradle.api.provider.Property;
2124
import org.gradle.api.provider.Provider;
25+
import org.gradle.api.specs.Spec;
2226
import org.gradle.api.tasks.Input;
2327
import org.gradle.api.tasks.InputDirectory;
2428
import org.gradle.api.tasks.InputFiles;
@@ -41,6 +45,8 @@
4145

4246
import javax.inject.Inject;
4347

48+
import static org.elasticsearch.gradle.internal.util.DependenciesUtils.createFileCollectionFromNonTransitiveArtifactsView;
49+
4450
/**
4551
* A task to check licenses for dependencies.
4652
* <p>
@@ -83,7 +89,7 @@
8389
* for the dependency. This artifact will be redistributed by us with the release to
8490
* comply with the license terms.
8591
*/
86-
public class DependencyLicensesTask extends DefaultTask {
92+
public abstract class DependencyLicensesTask extends DefaultTask {
8793

8894
private final Pattern regex = Pattern.compile("-v?\\d+.*");
8995

@@ -181,6 +187,10 @@ public void ignoreFile(String file) {
181187
ignoreFiles.add(file);
182188
}
183189

190+
@Input
191+
@Optional
192+
public abstract Property<Spec<ComponentIdentifier>> getComponentFilter();
193+
184194
@TaskAction
185195
public void checkDependencies() {
186196
if (dependencies == null) {
@@ -295,7 +305,6 @@ private String getFileName(String name, Map<String, ?> counters, String type) {
295305
// try the other suffix...TODO: get rid of this, just support ending in .txt
296306
return fileName + ".txt";
297307
}
298-
299308
return fileName;
300309
}
301310

@@ -310,4 +319,15 @@ public LinkedHashMap<String, String> getMappings() {
310319
return new LinkedHashMap<>(mappings);
311320
}
312321

322+
/**
323+
* Convencience method for configuring dependencies to be checked and ignoring transitive dependencies for now.
324+
* */
325+
public void configureDependencies(
326+
Configuration plusConfiguration,
327+
Configuration minusConfiguration,
328+
Spec<ComponentIdentifier> componentFilter
329+
) {
330+
setDependencies(createFileCollectionFromNonTransitiveArtifactsView(plusConfiguration, componentFilter).minus(minusConfiguration));
331+
}
332+
313333
}

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/precommit/ThirdPartyAuditPrecommitPlugin.java

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,14 @@
1515
import org.gradle.api.Project;
1616
import org.gradle.api.Task;
1717
import org.gradle.api.artifacts.Configuration;
18+
import org.gradle.api.artifacts.component.ModuleComponentIdentifier;
1819
import org.gradle.api.tasks.TaskProvider;
1920

2021
import java.io.File;
2122
import java.nio.file.Path;
2223

24+
import static org.elasticsearch.gradle.internal.util.DependenciesUtils.createFileCollectionFromNonTransitiveArtifactsView;
25+
2326
public class ThirdPartyAuditPrecommitPlugin extends PrecommitPlugin {
2427

2528
public static final String JDK_JAR_HELL_CONFIG_NAME = "jdkJarHell";
@@ -54,12 +57,14 @@ public TaskProvider<? extends Task> createTask(Project project) {
5457
Configuration compileOnly = project.getConfigurations()
5558
.getByName(CompileOnlyResolvePlugin.RESOLVEABLE_COMPILE_ONLY_CONFIGURATION_NAME);
5659
t.setClasspath(runtimeConfiguration.plus(compileOnly));
57-
t.getJarsToScan().from(runtimeConfiguration.fileCollection(dep -> {
58-
// These are SelfResolvingDependency, and some of them backed by file collections, like the Gradle API files,
59-
// or dependencies added as `files(...)`, we can't be sure if those are third party or not.
60-
// err on the side of scanning these to make sure we don't miss anything
61-
return dep.getGroup() != null && dep.getGroup().startsWith("org.elasticsearch") == false;
62-
}));
60+
t.getJarsToScan()
61+
.from(
62+
createFileCollectionFromNonTransitiveArtifactsView(
63+
runtimeConfiguration,
64+
identifier -> identifier instanceof ModuleComponentIdentifier
65+
&& ((ModuleComponentIdentifier) identifier).getGroup().startsWith("org.elasticsearch") == false
66+
)
67+
);
6368
t.dependsOn(resourcesTask);
6469
if (BuildParams.getIsRuntimeJavaHomeSet()) {
6570
t.getJavaHome().set(project.provider(BuildParams::getRuntimeJavaHome).map(File::getPath));

0 commit comments

Comments
 (0)