Skip to content

Commit

Permalink
Update Gradle wrapper to 8.12 (elastic#118683)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
breskeby authored Dec 30, 2024
1 parent d7fa740 commit ba61f8c
Show file tree
Hide file tree
Showing 162 changed files with 4,434 additions and 474 deletions.
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,7 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=89d4e70e4e84e2d2dfbb63e4daa53e21b25017cc70c37e4eea31ee51fb15098a
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-all.zip
distributionSha256Sum=7ebdac923867a3cec0098302416d1e3c6c0c729fc4e2e05c10637a8af33a76c5
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ class PublishPluginFuncTest extends AbstractGradleFuncTest {
esplugin {
name = 'hello-world-plugin'
classname 'org.acme.HelloWorldPlugin'
classname = 'org.acme.HelloWorldPlugin'
description = "shadowed es plugin"
}
Expand Down Expand Up @@ -375,7 +375,7 @@ class PublishPluginFuncTest extends AbstractGradleFuncTest {
esplugin {
name = 'hello-world-plugin'
classname 'org.acme.HelloWorldPlugin'
classname = 'org.acme.HelloWorldPlugin'
description = "custom project description"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,13 @@ private static void configureBwcProject(
// We don't use a normal `Copy` task here as snapshotting the entire gradle user home is very expensive. This task is cheap, so
// up-to-date checking doesn't buy us much
project.getTasks().register("setupGradleUserHome", task -> {
File gradleUserHome = project.getGradle().getGradleUserHomeDir();
String projectName = project.getName();
task.doLast(t -> {
fileSystemOperations.copy(copy -> {
String gradleUserHome = project.getGradle().getGradleUserHomeDir().getAbsolutePath();
copy.into(gradleUserHome + "-" + project.getName());
copy.from(gradleUserHome, copySpec -> {
String absoluteGradleUserHomePath = gradleUserHome.getAbsolutePath();
copy.into(absoluteGradleUserHomePath + "-" + projectName);
copy.from(absoluteGradleUserHomePath, copySpec -> {
copySpec.include("gradle.properties");
copySpec.include("init.d/*");
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,11 @@ public Destination getDestination() {
return Destination.StdErr;
}

@Override
public long getLogTime() {
return result.getEndTime();
}

@Override
public String getMessage() {
return message;
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.11.1
8.12
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class TestClustersPluginFuncTest extends AbstractGradleFuncTest {
esplugin {
name = 'test-$pluginType'
classname 'org.acme.TestModule'
classname = 'org.acme.TestModule'
description = "test $pluginType description"
}
Expand Down
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -364,24 +364,24 @@ tasks.register("verifyBwcTestsEnabled") {
}

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

tasks.named("wrapper").configure {
distributionType = 'ALL'
def minimumGradleVersionFile = project.file('build-tools-internal/src/main/resources/minimumGradleVersion')
doLast {
// copy wrapper properties file to build-tools-internal to allow seamless idea integration
def file = new File("build-tools-internal/gradle/wrapper/gradle-wrapper.properties")
Files.copy(wrapper.getPropertiesFile().toPath(), file.toPath(), REPLACE_EXISTING)
Files.copy(getPropertiesFile().toPath(), file.toPath(), REPLACE_EXISTING)
// copy wrapper properties file to plugins/examples to allow seamless idea integration
def examplePluginsWrapperProperties = new File("plugins/examples/gradle/wrapper/gradle-wrapper.properties")
Files.copy(wrapper.getPropertiesFile().toPath(), examplePluginsWrapperProperties.toPath(), REPLACE_EXISTING)

Files.copy(getPropertiesFile().toPath(), examplePluginsWrapperProperties.toPath(), REPLACE_EXISTING)
// Update build-tools to reflect the Gradle upgrade
// TODO: we can remove this once we have tests to make sure older versions work.
project.file('build-tools-internal/src/main/resources/minimumGradleVersion').text = gradleVersion
minimumGradleVersionFile.text = gradleVersion
println "Updated minimum Gradle Version"
}
}
Expand Down
6 changes: 3 additions & 3 deletions client/client-benchmark-noop-api-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ group = 'org.elasticsearch.plugin'
apply plugin: 'elasticsearch.internal-es-plugin'

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

// Not published so no need to assemble
Expand Down
4 changes: 2 additions & 2 deletions distribution/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -647,8 +647,8 @@ subprojects {
// in the final log4j2.properties configuration, as it appears in the
// archive distribution.
artifacts.add('log4jConfig', file("${defaultOutputs}/log4j2.properties")) {
type 'file'
name 'log4j2.properties'
type = 'file'
name = 'log4j2.properties'
builtBy 'buildDefaultLog4jConfig'
}

Expand Down
8 changes: 4 additions & 4 deletions distribution/docker/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ repositories {
// other Docker variants, the need for the main image to be rebuildable by Docker Hub
// means that the Dockerfile itself has to fetch the binary.
ivy {
url 'https://github.com/'
url = 'https://github.com/'
patternLayout {
artifact '/[organisation]/[module]/releases/download/v[revision]/[module]-[classifier]'
}
Expand All @@ -50,7 +50,7 @@ if (useDra == false) {
artifact '/[organisation]/[module]-[revision]-[classifier].[ext]'
}
} else {
url "https://artifacts-snapshot.elastic.co/"
url = "https://artifacts-snapshot.elastic.co/"
patternLayout {
if (VersionProperties.isElasticsearchSnapshot()) {
artifact '/[organization]/[revision]/downloads/[organization]/[module]/[module]-[revision]-[classifier].[ext]'
Expand Down Expand Up @@ -583,8 +583,8 @@ subprojects { Project subProject ->
}

artifacts.add('default', file(tarFile)) {
type 'tar'
name artifactName
type = 'tar'
name = artifactName
builtBy exportTaskName
}
}
Expand Down
50 changes: 25 additions & 25 deletions distribution/packages/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import java.util.regex.Pattern
*/

plugins {
id "com.netflix.nebula.ospackage-base" version "11.10.0"
id "com.netflix.nebula.ospackage-base" version "11.10.1"
}

['deb', 'rpm'].each { type ->
Expand Down Expand Up @@ -87,21 +87,21 @@ def commonPackageConfig(String type, String architecture) {
OS.current().equals(OS.WINDOWS) == false
}
dependsOn "process${type.capitalize()}Files"
packageName "elasticsearch"
packageName = "elasticsearch"
if (type == 'deb') {
if (architecture == 'x64') {
arch('amd64')
arch = 'amd64'
} else {
assert architecture == 'aarch64': architecture
arch('arm64')
arch = 'arm64'
}
} else {
assert type == 'rpm': type
if (architecture == 'x64') {
arch('X86_64')
arch = 'X86_64'
} else {
assert architecture == 'aarch64': architecture
arch('aarch64')
arch = 'aarch64'
}
}
// Follow elasticsearch's file naming convention
Expand Down Expand Up @@ -200,7 +200,7 @@ def commonPackageConfig(String type, String architecture) {
into('/etc')
permissionGroup 'elasticsearch'
setgid true
includeEmptyDirs true
includeEmptyDirs = true
createDirectoryEntry true
include("elasticsearch") // empty dir, just to add directory entry
include("elasticsearch/jvm.options.d") // empty dir, just to add directory entry
Expand All @@ -215,7 +215,7 @@ def commonPackageConfig(String type, String architecture) {
unix(0660)
}
permissionGroup 'elasticsearch'
includeEmptyDirs true
includeEmptyDirs = true
createDirectoryEntry true
fileType CONFIG | NOREPLACE
}
Expand Down Expand Up @@ -265,7 +265,7 @@ def commonPackageConfig(String type, String architecture) {
into(file.parent) {
from "${packagingFiles}/${file.parent}"
include file.name
includeEmptyDirs true
includeEmptyDirs = true
createDirectoryEntry true
user u
permissionGroup g
Expand All @@ -289,15 +289,15 @@ def commonPackageConfig(String type, String architecture) {

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

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

fileMode 0644
dirMode 0755
user 'root'
permissionGroup 'root'
fileMode = 0644
dirMode = 0755
user = 'root'
permissionGroup = 'root'

into '/usr/share/elasticsearch'
}
Expand All @@ -330,7 +330,7 @@ Closure commonDebConfig(String architecture) {
customFields['License'] = 'Elastic-License'

archiveVersion = project.version.replace('-', '~')
packageGroup 'web'
packageGroup = 'web'

// versions found on oldest supported distro, centos-6
requires('bash', '4.1', GREATER | EQUAL)
Expand Down Expand Up @@ -358,24 +358,24 @@ Closure commonRpmConfig(String architecture) {
return {
configure(commonPackageConfig('rpm', architecture))

license 'Elastic License'
license = 'Elastic License'

packageGroup 'Application/Internet'
packageGroup = 'Application/Internet'
requires '/bin/bash'

obsoletes packageName, '7.0.0', Flags.LESS

prefix '/usr'
packager 'Elasticsearch'
packager = 'Elasticsearch'
archiveVersion = project.version.replace('-', '_')
release = '1'
os 'LINUX'
distribution 'Elasticsearch'
vendor 'Elasticsearch'
os = 'LINUX'
distribution = 'Elasticsearch'
vendor = 'Elasticsearch'
// TODO ospackage doesn't support icon but we used to have one

// without this the rpm will have parent dirs of any files we copy in, eg /etc/elasticsearch
addParentDirs false
addParentDirs = false
}
}

Expand Down
11 changes: 3 additions & 8 deletions gradle/verification-metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -949,14 +949,9 @@
<sha256 value="d694edd7bae3bc1a8e0dae2f5a22c479ff04d6b9bfcb0ab751a42f02e02d2100" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.netflix.nebula" name="gradle-ospackage-plugin" version="11.10.0">
<artifact name="gradle-ospackage-plugin-11.10.0.jar">
<sha256 value="93c264b05864f8db979a169a99e4bfaad84caa30b829743f67210382dff89619" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.netflix.nebula" name="gradle-ospackage-plugin" version="11.9.1">
<artifact name="gradle-ospackage-plugin-11.9.1.jar">
<sha256 value="63b2c387cb83481bb8d7e33e0be02e9000c0ec30843ca7730641392f3f5f28ad" origin="Generated by Gradle"/>
<component group="com.netflix.nebula" name="gradle-ospackage-plugin" version="11.10.1">
<artifact name="gradle-ospackage-plugin-11.10.1.jar">
<sha256 value="8f1daf5885f1a8f6bcab00bf9b52cf484d87da7839e9bbd327a94af27df5dacc" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.netflix.nebula" name="nebula-gradle-interop" version="2.0.0">
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=89d4e70e4e84e2d2dfbb63e4daa53e21b25017cc70c37e4eea31ee51fb15098a
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-all.zip
distributionSha256Sum=7ebdac923867a3cec0098302416d1e3c6c0c729fc4e2e05c10637a8af33a76c5
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
3 changes: 1 addition & 2 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
apply plugin: 'elasticsearch.base-internal-es-plugin'

esplugin {
name 'entitlement-allowed-nonmodular'
description 'A non-modular test module that invokes entitlement checks that are supposed to be granted'
classname 'org.elasticsearch.entitlement.qa.nonmodular.EntitlementAllowedNonModularPlugin'
name = 'entitlement-allowed-nonmodular'
description = 'A non-modular test module that invokes entitlement checks that are supposed to be granted'
classname = 'org.elasticsearch.entitlement.qa.nonmodular.EntitlementAllowedNonModularPlugin'
}

dependencies {
Expand Down
6 changes: 3 additions & 3 deletions libs/entitlement/qa/entitlement-allowed/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
apply plugin: 'elasticsearch.base-internal-es-plugin'

esplugin {
name 'entitlement-allowed'
description 'A test module that invokes entitlement checks that are supposed to be granted'
classname 'org.elasticsearch.entitlement.qa.EntitlementAllowedPlugin'
name = 'entitlement-allowed'
description = 'A test module that invokes entitlement checks that are supposed to be granted'
classname = 'org.elasticsearch.entitlement.qa.EntitlementAllowedPlugin'
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
apply plugin: 'elasticsearch.base-internal-es-plugin'

esplugin {
name 'entitlement-denied-nonmodular'
description 'A non-modular test module that invokes non-granted entitlement and triggers exceptions'
classname 'org.elasticsearch.entitlement.qa.nonmodular.EntitlementDeniedNonModularPlugin'
name = 'entitlement-denied-nonmodular'
description = 'A non-modular test module that invokes non-granted entitlement and triggers exceptions'
classname = 'org.elasticsearch.entitlement.qa.nonmodular.EntitlementDeniedNonModularPlugin'
}

dependencies {
Expand Down
6 changes: 3 additions & 3 deletions libs/entitlement/qa/entitlement-denied/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
apply plugin: 'elasticsearch.base-internal-es-plugin'

esplugin {
name 'entitlement-denied'
description 'A test module that invokes non-granted entitlement and triggers exceptions'
classname 'org.elasticsearch.entitlement.qa.EntitlementDeniedPlugin'
name = 'entitlement-denied'
description = 'A test module that invokes non-granted entitlement and triggers exceptions'
classname = 'org.elasticsearch.entitlement.qa.EntitlementDeniedPlugin'
}

dependencies {
Expand Down
2 changes: 1 addition & 1 deletion libs/native/libraries/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ repositories {
exclusiveContent {
forRepository {
maven {
url "https://artifactory.elastic.dev/artifactory/elasticsearch-native"
url = "https://artifactory.elastic.dev/artifactory/elasticsearch-native"
metadataSources {
artifact()
}
Expand Down
Loading

0 comments on commit ba61f8c

Please sign in to comment.