Skip to content

Commit

Permalink
Switch from buildSrc/version.properties to Gradle version catalog (…
Browse files Browse the repository at this point in the history
…`gradle/libs.versions.toml`) to enable dependabot to perform automated upgrades on common libs (opensearch-project#16284)

* WIP on lib toml

Signed-off-by: Craig Perkins <[email protected]>

* SpotlessApply

Signed-off-by: Craig Perkins <[email protected]>

* Remove unnecessary lines

Signed-off-by: Craig Perkins <[email protected]>

* Specify time when dependabot runs

Signed-off-by: Craig Perkins <[email protected]>

* Refer to version from libs.versions.toml

Signed-off-by: Craig Perkins <[email protected]>

* Use version

Signed-off-by: Craig Perkins <[email protected]>

* Specify version catalog

Signed-off-by: Craig Perkins <[email protected]>

* Call .get()

Signed-off-by: Craig Perkins <[email protected]>

* Define version catalog

Signed-off-by: Craig Perkins <[email protected]>

* Use libraries

Signed-off-by: Craig Perkins <[email protected]>

* Downgrade purposefully

Signed-off-by: Craig Perkins <[email protected]>

* Add mavenCentral

Signed-off-by: Craig Perkins <[email protected]>

* Try w/o libraries section

Signed-off-by: Craig Perkins <[email protected]>

* reinstate

Signed-off-by: Craig Perkins <[email protected]>

* Remove version.properties

Signed-off-by: Craig Perkins <[email protected]>

* Update syntax

Signed-off-by: Craig Perkins <[email protected]>

* Change back to weekly

Signed-off-by: Craig Perkins <[email protected]>

* Add grpc

Signed-off-by: Craig Perkins <[email protected]>

* Get relative to project root. Relative path not working on windows bc windows had gradle wrapper path

Signed-off-by: Craig Perkins <[email protected]>

* Add minimal version.properties with only opensearch version to accommodate external references

Signed-off-by: Craig Perkins <[email protected]>

* singularize version.properties

Signed-off-by: Craig Perkins <[email protected]>

* Get rootDir

Signed-off-by: Craig Perkins <[email protected]>

* Fix issue loading snapshot

Signed-off-by: Craig Perkins <[email protected]>

* Limit logic to generating version.properties file within buildSrc

Signed-off-by: Craig Perkins <[email protected]>

* Remove unused exports

Signed-off-by: Craig Perkins <[email protected]>

* Add import

Signed-off-by: Craig Perkins <[email protected]>

* Remove unused code

Signed-off-by: Craig Perkins <[email protected]>

* Remove mavenCentral from publication section

Signed-off-by: Craig Perkins <[email protected]>

* Add to CHANGELOG

Signed-off-by: Craig Perkins <[email protected]>

* Update reactor-netty version

Signed-off-by: Craig Perkins <[email protected]>

* Only keep versions section in toml

Signed-off-by: Craig Perkins <[email protected]>

* Replaces versions catalog TOML parsing with Gradle's VersionCatalogsExtension

Signed-off-by: Andriy Redko <[email protected]>

* Update bundled_jdk

Signed-off-by: Craig Perkins <[email protected]>

* Update bytebuddy and mockito

Signed-off-by: Craig Perkins <[email protected]>

---------

Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Andriy Redko <[email protected]>
Signed-off-by: Daniel (dB.) Doubrovkine <[email protected]>
Co-authored-by: Andriy Redko <[email protected]>
Co-authored-by: Daniel (dB.) Doubrovkine <[email protected]>
  • Loading branch information
3 people authored Oct 28, 2024
1 parent 9f7d3b6 commit af7a067
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 86 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Add support for restoring from snapshot with search replicas ([#16111](https://github.com/opensearch-project/OpenSearch/pull/16111))
- Add logic in master service to optimize performance and retain detailed logging for critical cluster operations. ([#14795](https://github.com/opensearch-project/OpenSearch/pull/14795))
- Add Setting to adjust the primary constraint weights ([#16471](https://github.com/opensearch-project/OpenSearch/pull/16471))
- Switch from `buildSrc/version.properties` to Gradle version catalog (`gradle/libs.versions.toml`) to enable dependabot to perform automated upgrades on common libs ([#16284](https://github.com/opensearch-project/OpenSearch/pull/16284))

### Dependencies
- Bump `com.azure:azure-identity` from 1.13.0 to 1.13.2 ([#15578](https://github.com/opensearch-project/OpenSearch/pull/15578))
Expand Down
20 changes: 12 additions & 8 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ if (project == rootProject) {
// we update the version property to reflect if we are building a snapshot or a release build
// we write this back out below to load it in the Build.java which will be shown in rest main action
// to indicate this being a snapshot build or a release build.
Properties props = VersionPropertiesLoader.loadBuildSrcVersion(project.file('version.properties'))
Properties props = VersionPropertiesLoader.loadBuildSrcVersion(project)
version = props.getProperty("opensearch")

def generateVersionProperties = tasks.register("generateVersionProperties", WriteProperties) {
Expand Down Expand Up @@ -287,15 +287,19 @@ if (project != rootProject) {
}
}

// Define this here because we need it early.
// Define this here because we need it early. It uses VersionCatalogsExtension to extract all versions
// and converts to a Java Properties object
class VersionPropertiesLoader {
static Properties loadBuildSrcVersion(File input) throws IOException {
static Properties loadBuildSrcVersion(Project project) throws IOException {
Properties props = new Properties();
InputStream is = new FileInputStream(input)
try {
props.load(is)
} finally {
is.close()

var catalogs = project.extensions.getByType(VersionCatalogsExtension)
var libs = catalogs.named("libs")
libs.getVersionAliases().forEach {
libs.findVersion(it).ifPresent { v ->
// Gradle replaces '_' with '.' so 'google_http_client' becomes 'google.http.client' instead
props.setProperty(it.replaceAll("[.]", "_"), v.requiredVersion)
}
}
loadBuildSrcVersion(props, System.getProperties())
return props
Expand Down
8 changes: 8 additions & 0 deletions buildSrc/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,11 @@
*/

include 'reaper'

dependencyResolutionManagement {
versionCatalogs {
libs {
from(files("../gradle/libs.versions.toml"))
}
}
}
79 changes: 1 addition & 78 deletions buildSrc/version.properties
Original file line number Diff line number Diff line change
@@ -1,79 +1,2 @@
# Please use ../gradle/libs.versions.toml for dependency management
opensearch = 3.0.0
lucene = 9.12.0

bundled_jdk_vendor = adoptium
bundled_jdk = 23.0.1+11

# optional dependencies
spatial4j = 0.7
jts = 1.15.0
jackson = 2.17.2
jackson_databind = 2.17.2
snakeyaml = 2.1
icu4j = 75.1
supercsv = 2.4.0
log4j = 2.21.0
slf4j = 1.7.36
asm = 9.7
jettison = 1.5.4
woodstox = 6.4.0
kotlin = 1.7.10
antlr4 = 4.13.1
guava = 32.1.1-jre
protobuf = 3.25.5
jakarta_annotation = 1.3.5
google_http_client = 1.44.1
tdigest = 3.3
hdrhistogram = 2.2.2
grpc = 1.68.0

# when updating the JNA version, also update the version in buildSrc/build.gradle
jna = 5.13.0

netty = 4.1.114.Final
joda = 2.12.7

# project reactor
reactor_netty = 1.1.23
reactor = 3.5.20

# client dependencies
httpclient5 = 5.3.1
httpcore5 = 5.2.5
httpclient = 4.5.14
httpcore = 4.4.16
httpasyncclient = 4.1.5
commonslogging = 1.2
commonscodec = 1.16.1
commonslang = 3.14.0
commonscompress = 1.26.1
commonsio = 2.16.0
# plugin dependencies
aws = 2.20.86
reactivestreams = 1.0.4

# when updating this version, you need to ensure compatibility with:
# - plugins/ingest-attachment (transitive dependency, check the upstream POM)
# - distribution/tools/plugin-cli
bouncycastle=1.78
# test dependencies
randomizedrunner = 2.7.1
junit = 4.13.2
hamcrest = 2.1
mockito = 5.14.1
objenesis = 3.2
bytebuddy = 1.15.4

# benchmark dependencies
jmh = 1.35

# compression
zstd = 1.5.5-5

jzlib = 1.1.3

resteasy = 6.2.4.Final

# opentelemetry dependencies
opentelemetry = 1.41.0
opentelemetrysemconv = 1.27.0-alpha
80 changes: 80 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
[versions]
opensearch = "3.0.0"
lucene = "9.12.0"

bundled_jdk_vendor = "adoptium"
bundled_jdk = "23.0.1+11"

# optional dependencies
spatial4j = "0.7"
jts = "1.15.0"
jackson = "2.17.2"
jackson_databind = "2.17.2"
snakeyaml = "2.1"
icu4j = "75.1"
supercsv = "2.4.0"
log4j = "2.21.0"
slf4j = "1.7.36"
asm = "9.7"
jettison = "1.5.4"
woodstox = "6.4.0"
kotlin = "1.7.10"
antlr4 = "4.13.1"
guava = "32.1.1-jre"
protobuf = "3.25.5"
jakarta_annotation = "1.3.5"
google_http_client = "1.44.1"
tdigest = "3.3"
hdrhistogram = "2.2.2"
grpc = "1.68.0"

# when updating the JNA version, also update the version in buildSrc/build.gradle
jna = "5.13.0"

netty = "4.1.114.Final"
joda = "2.12.7"

# project reactor
reactor_netty = "1.1.23"
reactor = "3.5.20"

# client dependencies
httpclient5 = "5.3.1"
httpcore5 = "5.2.5"
httpclient = "4.5.14"
httpcore = "4.4.16"
httpasyncclient = "4.1.5"
commonslogging = "1.2"
commonscodec = "1.16.1"
commonslang = "3.14.0"
commonscompress = "1.26.1"
commonsio = "2.16.0"
# plugin dependencies
aws = "2.20.86"
reactivestreams = "1.0.4"

# when updating this version, you need to ensure compatibility with:
# - plugins/ingest-attachment (transitive dependency, check the upstream POM)
# - distribution/tools/plugin-cli
bouncycastle="1.78"
# test dependencies
randomizedrunner = "2.7.1"
junit = "4.13.2"
hamcrest = "2.1"
mockito = "5.14.1"
objenesis = "3.2"
bytebuddy = "1.15.4"

# benchmark dependencies
jmh = "1.35"

# compression
zstd = "1.5.5-5"

jzlib = "1.1.3"

resteasy = "6.2.4.Final"

# opentelemetry dependencies
opentelemetry = "1.41.0"
opentelemetrysemconv = "1.27.0-alpha"

0 comments on commit af7a067

Please sign in to comment.