Skip to content

Commit 4d17b21

Browse files
authored
Update Gradle wrapper to 8.12 (#118683) (#119357)
This updates the gradle wrapper to 8.12 We addressed deprecation warnings due to the update that includes: - Fix change in TestOutputEvent api - Fix deprecation in groovy syntax - Use latest ospackage plugin containing our fix - Remove project usages at execution time - Fix deprecated project references in repository-old-versions (cherry picked from commit ba61f8c) # Conflicts: # build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/distribution/DockerCloudElasticsearchDistributionType.java # build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/distribution/DockerUbiElasticsearchDistributionType.java # build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/test/Fixture.java # plugins/repository-hdfs/hadoop-client-api/build.gradle # server/src/main/java/org/elasticsearch/inference/ChunkingOptions.java # x-pack/plugin/kql/build.gradle # x-pack/plugin/migrate/build.gradle # x-pack/plugin/security/qa/security-basic/build.gradle
1 parent f75095c commit 4d17b21

File tree

154 files changed

+4411
-450
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

154 files changed

+4411
-450
lines changed

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionSha256Sum=89d4e70e4e84e2d2dfbb63e4daa53e21b25017cc70c37e4eea31ee51fb15098a
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-all.zip
3+
distributionSha256Sum=7ebdac923867a3cec0098302416d1e3c6c0c729fc4e2e05c10637a8af33a76c5
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-all.zip
55
networkTimeout=10000
66
validateDistributionUrl=true
77
zipStoreBase=GRADLE_USER_HOME

build-tools-internal/src/integTest/groovy/org/elasticsearch/gradle/internal/PublishPluginFuncTest.groovy

+2-2
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ class PublishPluginFuncTest extends AbstractGradleFuncTest {
285285
286286
esplugin {
287287
name = 'hello-world-plugin'
288-
classname 'org.acme.HelloWorldPlugin'
288+
classname = 'org.acme.HelloWorldPlugin'
289289
description = "shadowed es plugin"
290290
}
291291
@@ -375,7 +375,7 @@ class PublishPluginFuncTest extends AbstractGradleFuncTest {
375375
376376
esplugin {
377377
name = 'hello-world-plugin'
378-
classname 'org.acme.HelloWorldPlugin'
378+
classname = 'org.acme.HelloWorldPlugin'
379379
description = "custom project description"
380380
}
381381

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

+5-3
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,13 @@ private static void configureBwcProject(
130130
// We don't use a normal `Copy` task here as snapshotting the entire gradle user home is very expensive. This task is cheap, so
131131
// up-to-date checking doesn't buy us much
132132
project.getTasks().register("setupGradleUserHome", task -> {
133+
File gradleUserHome = project.getGradle().getGradleUserHomeDir();
134+
String projectName = project.getName();
133135
task.doLast(t -> {
134136
fileSystemOperations.copy(copy -> {
135-
String gradleUserHome = project.getGradle().getGradleUserHomeDir().getAbsolutePath();
136-
copy.into(gradleUserHome + "-" + project.getName());
137-
copy.from(gradleUserHome, copySpec -> {
137+
String absoluteGradleUserHomePath = gradleUserHome.getAbsolutePath();
138+
copy.into(absoluteGradleUserHomePath + "-" + projectName);
139+
copy.from(absoluteGradleUserHomePath, copySpec -> {
138140
copySpec.include("gradle.properties");
139141
copySpec.include("init.d/*");
140142
});

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

+5
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,11 @@ public Destination getDestination() {
172172
return Destination.StdErr;
173173
}
174174

175+
@Override
176+
public long getLogTime() {
177+
return result.getEndTime();
178+
}
179+
175180
@Override
176181
public String getMessage() {
177182
return message;
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8.11.1
1+
8.12

build-tools/src/integTest/groovy/org/elasticsearch/gradle/TestClustersPluginFuncTest.groovy

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ class TestClustersPluginFuncTest extends AbstractGradleFuncTest {
135135
136136
esplugin {
137137
name = 'test-$pluginType'
138-
classname 'org.acme.TestModule'
138+
classname = 'org.acme.TestModule'
139139
description = "test $pluginType description"
140140
}
141141

build.gradle

+5-5
Original file line numberDiff line numberDiff line change
@@ -364,24 +364,24 @@ tasks.register("verifyBwcTestsEnabled") {
364364
}
365365

366366
tasks.register("branchConsistency") {
367-
description 'Ensures this branch is internally consistent. For example, that versions constants match released versions.'
367+
description = 'Ensures this branch is internally consistent. For example, that versions constants match released versions.'
368368
group 'Verification'
369369
dependsOn ":verifyVersions", ":verifyBwcTestsEnabled"
370370
}
371371

372372
tasks.named("wrapper").configure {
373373
distributionType = 'ALL'
374+
def minimumGradleVersionFile = project.file('build-tools-internal/src/main/resources/minimumGradleVersion')
374375
doLast {
375376
// copy wrapper properties file to build-tools-internal to allow seamless idea integration
376377
def file = new File("build-tools-internal/gradle/wrapper/gradle-wrapper.properties")
377-
Files.copy(wrapper.getPropertiesFile().toPath(), file.toPath(), REPLACE_EXISTING)
378+
Files.copy(getPropertiesFile().toPath(), file.toPath(), REPLACE_EXISTING)
378379
// copy wrapper properties file to plugins/examples to allow seamless idea integration
379380
def examplePluginsWrapperProperties = new File("plugins/examples/gradle/wrapper/gradle-wrapper.properties")
380-
Files.copy(wrapper.getPropertiesFile().toPath(), examplePluginsWrapperProperties.toPath(), REPLACE_EXISTING)
381-
381+
Files.copy(getPropertiesFile().toPath(), examplePluginsWrapperProperties.toPath(), REPLACE_EXISTING)
382382
// Update build-tools to reflect the Gradle upgrade
383383
// TODO: we can remove this once we have tests to make sure older versions work.
384-
project.file('build-tools-internal/src/main/resources/minimumGradleVersion').text = gradleVersion
384+
minimumGradleVersionFile.text = gradleVersion
385385
println "Updated minimum Gradle Version"
386386
}
387387
}

client/client-benchmark-noop-api-plugin/build.gradle

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ group = 'org.elasticsearch.plugin'
1212
apply plugin: 'elasticsearch.internal-es-plugin'
1313

1414
esplugin {
15-
name 'client-benchmark-noop-api'
16-
description 'Stubbed out Elasticsearch actions that can be used for client-side benchmarking'
17-
classname 'org.elasticsearch.plugin.noop.NoopPlugin'
15+
name = 'client-benchmark-noop-api'
16+
description = 'Stubbed out Elasticsearch actions that can be used for client-side benchmarking'
17+
classname ='org.elasticsearch.plugin.noop.NoopPlugin'
1818
}
1919

2020
// Not published so no need to assemble

distribution/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -639,8 +639,8 @@ subprojects {
639639
// in the final log4j2.properties configuration, as it appears in the
640640
// archive distribution.
641641
artifacts.add('log4jConfig', file("${defaultOutputs}/log4j2.properties")) {
642-
type 'file'
643-
name 'log4j2.properties'
642+
type = 'file'
643+
name = 'log4j2.properties'
644644
builtBy 'buildDefaultLog4jConfig'
645645
}
646646

distribution/docker/build.gradle

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ repositories {
2828
// other Docker variants, the need for the main image to be rebuildable by Docker Hub
2929
// means that the Dockerfile itself has to fetch the binary.
3030
ivy {
31-
url 'https://github.com/'
31+
url = 'https://github.com/'
3232
patternLayout {
3333
artifact '/[organisation]/[module]/releases/download/v[revision]/[module]-[classifier]'
3434
}
@@ -50,7 +50,7 @@ if (useDra == false) {
5050
artifact '/[organisation]/[module]-[revision]-[classifier].[ext]'
5151
}
5252
} else {
53-
url "https://artifacts-snapshot.elastic.co/"
53+
url = "https://artifacts-snapshot.elastic.co/"
5454
patternLayout {
5555
if (VersionProperties.isElasticsearchSnapshot()) {
5656
artifact '/[organization]/[revision]/downloads/[organization]/[module]/[module]-[revision]-[classifier].[ext]'
@@ -570,8 +570,8 @@ subprojects { Project subProject ->
570570
}
571571

572572
artifacts.add('default', file(tarFile)) {
573-
type 'tar'
574-
name artifactName
573+
type = 'tar'
574+
name = artifactName
575575
builtBy exportTaskName
576576
}
577577
}

distribution/packages/build.gradle

+25-25
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ import java.util.regex.Pattern
4444
*/
4545

4646
plugins {
47-
id "com.netflix.nebula.ospackage-base" version "11.10.0"
47+
id "com.netflix.nebula.ospackage-base" version "11.10.1"
4848
}
4949

5050
['deb', 'rpm'].each { type ->
@@ -88,21 +88,21 @@ def commonPackageConfig(String type, String architecture) {
8888
OS.current().equals(OS.WINDOWS) == false
8989
}
9090
dependsOn "process${type.capitalize()}Files"
91-
packageName "elasticsearch"
91+
packageName = "elasticsearch"
9292
if (type == 'deb') {
9393
if (architecture == 'x64') {
94-
arch('amd64')
94+
arch = 'amd64'
9595
} else {
9696
assert architecture == 'aarch64': architecture
97-
arch('arm64')
97+
arch = 'arm64'
9898
}
9999
} else {
100100
assert type == 'rpm': type
101101
if (architecture == 'x64') {
102-
arch('X86_64')
102+
arch = 'X86_64'
103103
} else {
104104
assert architecture == 'aarch64': architecture
105-
arch('aarch64')
105+
arch = 'aarch64'
106106
}
107107
}
108108
// Follow elasticsearch's file naming convention
@@ -201,7 +201,7 @@ def commonPackageConfig(String type, String architecture) {
201201
into('/etc')
202202
permissionGroup 'elasticsearch'
203203
setgid true
204-
includeEmptyDirs true
204+
includeEmptyDirs = true
205205
createDirectoryEntry true
206206
include("elasticsearch") // empty dir, just to add directory entry
207207
include("elasticsearch/jvm.options.d") // empty dir, just to add directory entry
@@ -216,7 +216,7 @@ def commonPackageConfig(String type, String architecture) {
216216
unix(0660)
217217
}
218218
permissionGroup 'elasticsearch'
219-
includeEmptyDirs true
219+
includeEmptyDirs = true
220220
createDirectoryEntry true
221221
fileType CONFIG | NOREPLACE
222222
}
@@ -266,7 +266,7 @@ def commonPackageConfig(String type, String architecture) {
266266
into(file.parent) {
267267
from "${packagingFiles}/${file.parent}"
268268
include file.name
269-
includeEmptyDirs true
269+
includeEmptyDirs = true
270270
createDirectoryEntry true
271271
user u
272272
permissionGroup g
@@ -290,15 +290,15 @@ def commonPackageConfig(String type, String architecture) {
290290

291291
// this is package independent configuration
292292
ospackage {
293-
maintainer 'Elasticsearch Team <info@elastic.co>'
294-
summary 'Distributed RESTful search engine built for the cloud'
295-
packageDescription '''
293+
maintainer = 'Elasticsearch Team <info@elastic.co>'
294+
summary = 'Distributed RESTful search engine built for the cloud'
295+
packageDescription = '''
296296
Reference documentation can be found at
297297
https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html
298298
and the 'Elasticsearch: The Definitive Guide' book can be found at
299299
https://www.elastic.co/guide/en/elasticsearch/guide/current/index.html
300300
'''.stripIndent().trim()
301-
url 'https://www.elastic.co/'
301+
url = 'https://www.elastic.co/'
302302

303303
// signing setup
304304
if (project.hasProperty('signing.password') && buildParams.isSnapshotBuild() == false) {
@@ -312,10 +312,10 @@ ospackage {
312312
// version found on oldest supported distro, centos-6
313313
requires('coreutils', '8.4', GREATER | EQUAL)
314314

315-
fileMode 0644
316-
dirMode 0755
317-
user 'root'
318-
permissionGroup 'root'
315+
fileMode = 0644
316+
dirMode = 0755
317+
user = 'root'
318+
permissionGroup = 'root'
319319

320320
into '/usr/share/elasticsearch'
321321
}
@@ -331,7 +331,7 @@ Closure commonDebConfig(String architecture) {
331331
customFields['License'] = 'Elastic-License'
332332

333333
archiveVersion = project.version.replace('-', '~')
334-
packageGroup 'web'
334+
packageGroup = 'web'
335335

336336
// versions found on oldest supported distro, centos-6
337337
requires('bash', '4.1', GREATER | EQUAL)
@@ -360,24 +360,24 @@ Closure commonRpmConfig(String architecture) {
360360
return {
361361
configure(commonPackageConfig('rpm', architecture))
362362

363-
license 'Elastic License'
363+
license = 'Elastic License'
364364

365-
packageGroup 'Application/Internet'
365+
packageGroup = 'Application/Internet'
366366
requires '/bin/bash'
367367

368368
obsoletes packageName, '7.0.0', Flags.LESS
369369

370370
prefix '/usr'
371-
packager 'Elasticsearch'
371+
packager = 'Elasticsearch'
372372
archiveVersion = project.version.replace('-', '_')
373373
release = '1'
374-
os 'LINUX'
375-
distribution 'Elasticsearch'
376-
vendor 'Elasticsearch'
374+
os = 'LINUX'
375+
distribution = 'Elasticsearch'
376+
vendor = 'Elasticsearch'
377377
// TODO ospackage doesn't support icon but we used to have one
378378

379379
// without this the rpm will have parent dirs of any files we copy in, eg /etc/elasticsearch
380-
addParentDirs false
380+
addParentDirs = false
381381
}
382382
}
383383

gradle/verification-metadata.xml

+3-8
Original file line numberDiff line numberDiff line change
@@ -939,14 +939,9 @@
939939
<sha256 value="d694edd7bae3bc1a8e0dae2f5a22c479ff04d6b9bfcb0ab751a42f02e02d2100" origin="Generated by Gradle"/>
940940
</artifact>
941941
</component>
942-
<component group="com.netflix.nebula" name="gradle-ospackage-plugin" version="11.10.0">
943-
<artifact name="gradle-ospackage-plugin-11.10.0.jar">
944-
<sha256 value="93c264b05864f8db979a169a99e4bfaad84caa30b829743f67210382dff89619" origin="Generated by Gradle"/>
945-
</artifact>
946-
</component>
947-
<component group="com.netflix.nebula" name="gradle-ospackage-plugin" version="11.9.1">
948-
<artifact name="gradle-ospackage-plugin-11.9.1.jar">
949-
<sha256 value="63b2c387cb83481bb8d7e33e0be02e9000c0ec30843ca7730641392f3f5f28ad" origin="Generated by Gradle"/>
942+
<component group="com.netflix.nebula" name="gradle-ospackage-plugin" version="11.10.1">
943+
<artifact name="gradle-ospackage-plugin-11.10.1.jar">
944+
<sha256 value="8f1daf5885f1a8f6bcab00bf9b52cf484d87da7839e9bbd327a94af27df5dacc" origin="Generated by Gradle"/>
950945
</artifact>
951946
</component>
952947
<component group="com.netflix.nebula" name="nebula-gradle-interop" version="2.0.0">

gradle/wrapper/gradle-wrapper.properties

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionSha256Sum=89d4e70e4e84e2d2dfbb63e4daa53e21b25017cc70c37e4eea31ee51fb15098a
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-all.zip
3+
distributionSha256Sum=7ebdac923867a3cec0098302416d1e3c6c0c729fc4e2e05c10637a8af33a76c5
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-all.zip
55
networkTimeout=10000
66
validateDistributionUrl=true
77
zipStoreBase=GRADLE_USER_HOME

gradlew

+1-2
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@ done
8686
# shellcheck disable=SC2034
8787
APP_BASE_NAME=${0##*/}
8888
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
89-
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
90-
' "$PWD" ) || exit
89+
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
9190

9291
# Use the maximum available, or set MAX_FD != -1 to use that value.
9392
MAX_FD=maximum

libs/native/libraries/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ repositories {
2525
exclusiveContent {
2626
forRepository {
2727
maven {
28-
url "https://artifactory.elastic.dev/artifactory/elasticsearch-native"
28+
url = "https://artifactory.elastic.dev/artifactory/elasticsearch-native"
2929
metadataSources {
3030
artifact()
3131
}

0 commit comments

Comments
 (0)