Skip to content

Commit

Permalink
Remove deprecated org.gradle.util.DistributionLocator usage (opensear…
Browse files Browse the repository at this point in the history
…ch-project#6212)

* Remove deprecated org.gradle.util.DistributionLocator usage

Signed-off-by: Daniel Widdis <[email protected]>

* Update gradle wrapper version to test no deprecation warning

Signed-off-by: Daniel Widdis <[email protected]>

* Change log

Signed-off-by: Daniel Widdis <[email protected]>

* Add newline so linelint doesn't complain.

Signed-off-by: Daniel Widdis <[email protected]>

* Remove remove typo typo

Signed-off-by: Daniel Widdis <[email protected]>

* Use wrapper getDistributionUrl method

Signed-off-by: Daniel Widdis <[email protected]>

* Restore license header removed by autogeneration

Signed-off-by: Daniel Widdis <[email protected]>

* Gradle 8

Signed-off-by: Daniel Widdis <[email protected]>

* Revert minimumGradleVersion change

Signed-off-by: Daniel Widdis <[email protected]>

---------

Signed-off-by: Daniel Widdis <[email protected]>
(cherry picked from commit 36f5cfe)
  • Loading branch information
dbwiddis committed Feb 20, 2023
1 parent c0a4475 commit 8959f3b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 3 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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"
}
}
Expand Down

0 comments on commit 8959f3b

Please sign in to comment.