From 6f85a5fa0d0a5a99792c20e75f9e94fad05dc7d7 Mon Sep 17 00:00:00 2001 From: Daniel Widdis Date: Mon, 20 Feb 2023 07:11:52 -0800 Subject: [PATCH] Remove deprecated org.gradle.util.DistributionLocator usage (#6212) (#6377) * Remove deprecated org.gradle.util.DistributionLocator usage Signed-off-by: Daniel Widdis * Update gradle wrapper version to test no deprecation warning Signed-off-by: Daniel Widdis * Change log Signed-off-by: Daniel Widdis * Add newline so linelint doesn't complain. Signed-off-by: Daniel Widdis * Remove remove typo typo Signed-off-by: Daniel Widdis * Use wrapper getDistributionUrl method Signed-off-by: Daniel Widdis * Restore license header removed by autogeneration Signed-off-by: Daniel Widdis * Gradle 8 Signed-off-by: Daniel Widdis * Revert minimumGradleVersion change Signed-off-by: Daniel Widdis --------- Signed-off-by: Daniel Widdis (cherry picked from commit 36f5cfe807584177dd4842810734e04a5f7bd4ae) --- CHANGELOG.md | 1 + build.gradle | 12 +++--------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a4bd3cf26ec5e..8769b0b29894b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - Cluster health call to throw decommissioned exception for local decommissioned node([#6008](https://github.com/opensearch-project/OpenSearch/pull/6008)) - [Refactor] core.common to new opensearch-common library ([#5976](https://github.com/opensearch-project/OpenSearch/pull/5976)) - Cluster local health call to throw exception if node is decommissioned or weighed away ([#6198](https://github.com/opensearch-project/OpenSearch/pull/6198)) +- Remove deprecated org.gradle.util.DistributionLocator usage ([#6212](https://github.com/opensearch-project/OpenSearch/pull/6212)) ### Deprecated diff --git a/build.gradle b/build.gradle index 8d09879ca4842..0c15a962073a8 100644 --- a/build.gradle +++ b/build.gradle @@ -47,8 +47,6 @@ import org.gradle.plugins.ide.eclipse.model.SourceFolder import org.gradle.api.Project; import org.gradle.api.internal.tasks.testing.junit.JUnitTestFramework import org.gradle.process.ExecResult; -import org.gradle.util.DistributionLocator -import org.gradle.util.GradleVersion import static org.opensearch.gradle.util.GradleUtils.maybeConfigure @@ -546,16 +544,12 @@ allprojects { wrapper { distributionType = 'ALL' doLast { - final DistributionLocator locator = new DistributionLocator() - final GradleVersion version = GradleVersion.version(wrapper.gradleVersion) - final URI distributionUri = locator.getDistributionFor(version, wrapper.distributionType.name().toLowerCase(Locale.ENGLISH)) - final URI sha256Uri = new URI(distributionUri.toString() + ".sha256") - final String sha256Sum = new String(sha256Uri.toURL().bytes) - wrapper.getPropertiesFile() << "distributionSha256Sum=${sha256Sum}\n" + def sha256Sum = new String(new URL(getDistributionUrl() + ".sha256").bytes) + propertiesFile << "distributionSha256Sum=${sha256Sum}\n" println "Added checksum to wrapper properties" // Update build-tools to reflect the Gradle upgrade // TODO: we can remove this once we have tests to make sure older versions work. - project(':build-tools').file('src/main/resources/minimumGradleVersion').text = gradleVersion + project(':build-tools').file('src/main/resources/minimumGradleVersion').text = gradleVersion + "\n" println "Updated minimum Gradle Version" } }