Skip to content

Commit af7a067

Browse files
cwperksretadblock
authored
Switch from buildSrc/version.properties to Gradle version catalog (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]>
1 parent 9f7d3b6 commit af7a067

File tree

5 files changed

+102
-86
lines changed

5 files changed

+102
-86
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
3333
- Add support for restoring from snapshot with search replicas ([#16111](https://github.com/opensearch-project/OpenSearch/pull/16111))
3434
- 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))
3535
- Add Setting to adjust the primary constraint weights ([#16471](https://github.com/opensearch-project/OpenSearch/pull/16471))
36+
- 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))
3637

3738
### Dependencies
3839
- Bump `com.azure:azure-identity` from 1.13.0 to 1.13.2 ([#15578](https://github.com/opensearch-project/OpenSearch/pull/15578))

buildSrc/build.gradle

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ if (project == rootProject) {
5757
// we update the version property to reflect if we are building a snapshot or a release build
5858
// we write this back out below to load it in the Build.java which will be shown in rest main action
5959
// to indicate this being a snapshot build or a release build.
60-
Properties props = VersionPropertiesLoader.loadBuildSrcVersion(project.file('version.properties'))
60+
Properties props = VersionPropertiesLoader.loadBuildSrcVersion(project)
6161
version = props.getProperty("opensearch")
6262

6363
def generateVersionProperties = tasks.register("generateVersionProperties", WriteProperties) {
@@ -287,15 +287,19 @@ if (project != rootProject) {
287287
}
288288
}
289289

290-
// Define this here because we need it early.
290+
// Define this here because we need it early. It uses VersionCatalogsExtension to extract all versions
291+
// and converts to a Java Properties object
291292
class VersionPropertiesLoader {
292-
static Properties loadBuildSrcVersion(File input) throws IOException {
293+
static Properties loadBuildSrcVersion(Project project) throws IOException {
293294
Properties props = new Properties();
294-
InputStream is = new FileInputStream(input)
295-
try {
296-
props.load(is)
297-
} finally {
298-
is.close()
295+
296+
var catalogs = project.extensions.getByType(VersionCatalogsExtension)
297+
var libs = catalogs.named("libs")
298+
libs.getVersionAliases().forEach {
299+
libs.findVersion(it).ifPresent { v ->
300+
// Gradle replaces '_' with '.' so 'google_http_client' becomes 'google.http.client' instead
301+
props.setProperty(it.replaceAll("[.]", "_"), v.requiredVersion)
302+
}
299303
}
300304
loadBuildSrcVersion(props, System.getProperties())
301305
return props

buildSrc/settings.gradle

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,11 @@
1010
*/
1111

1212
include 'reaper'
13+
14+
dependencyResolutionManagement {
15+
versionCatalogs {
16+
libs {
17+
from(files("../gradle/libs.versions.toml"))
18+
}
19+
}
20+
}

buildSrc/version.properties

Lines changed: 1 addition & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,2 @@
1+
# Please use ../gradle/libs.versions.toml for dependency management
12
opensearch = 3.0.0
2-
lucene = 9.12.0
3-
4-
bundled_jdk_vendor = adoptium
5-
bundled_jdk = 23.0.1+11
6-
7-
# optional dependencies
8-
spatial4j = 0.7
9-
jts = 1.15.0
10-
jackson = 2.17.2
11-
jackson_databind = 2.17.2
12-
snakeyaml = 2.1
13-
icu4j = 75.1
14-
supercsv = 2.4.0
15-
log4j = 2.21.0
16-
slf4j = 1.7.36
17-
asm = 9.7
18-
jettison = 1.5.4
19-
woodstox = 6.4.0
20-
kotlin = 1.7.10
21-
antlr4 = 4.13.1
22-
guava = 32.1.1-jre
23-
protobuf = 3.25.5
24-
jakarta_annotation = 1.3.5
25-
google_http_client = 1.44.1
26-
tdigest = 3.3
27-
hdrhistogram = 2.2.2
28-
grpc = 1.68.0
29-
30-
# when updating the JNA version, also update the version in buildSrc/build.gradle
31-
jna = 5.13.0
32-
33-
netty = 4.1.114.Final
34-
joda = 2.12.7
35-
36-
# project reactor
37-
reactor_netty = 1.1.23
38-
reactor = 3.5.20
39-
40-
# client dependencies
41-
httpclient5 = 5.3.1
42-
httpcore5 = 5.2.5
43-
httpclient = 4.5.14
44-
httpcore = 4.4.16
45-
httpasyncclient = 4.1.5
46-
commonslogging = 1.2
47-
commonscodec = 1.16.1
48-
commonslang = 3.14.0
49-
commonscompress = 1.26.1
50-
commonsio = 2.16.0
51-
# plugin dependencies
52-
aws = 2.20.86
53-
reactivestreams = 1.0.4
54-
55-
# when updating this version, you need to ensure compatibility with:
56-
# - plugins/ingest-attachment (transitive dependency, check the upstream POM)
57-
# - distribution/tools/plugin-cli
58-
bouncycastle=1.78
59-
# test dependencies
60-
randomizedrunner = 2.7.1
61-
junit = 4.13.2
62-
hamcrest = 2.1
63-
mockito = 5.14.1
64-
objenesis = 3.2
65-
bytebuddy = 1.15.4
66-
67-
# benchmark dependencies
68-
jmh = 1.35
69-
70-
# compression
71-
zstd = 1.5.5-5
72-
73-
jzlib = 1.1.3
74-
75-
resteasy = 6.2.4.Final
76-
77-
# opentelemetry dependencies
78-
opentelemetry = 1.41.0
79-
opentelemetrysemconv = 1.27.0-alpha

gradle/libs.versions.toml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
[versions]
2+
opensearch = "3.0.0"
3+
lucene = "9.12.0"
4+
5+
bundled_jdk_vendor = "adoptium"
6+
bundled_jdk = "23.0.1+11"
7+
8+
# optional dependencies
9+
spatial4j = "0.7"
10+
jts = "1.15.0"
11+
jackson = "2.17.2"
12+
jackson_databind = "2.17.2"
13+
snakeyaml = "2.1"
14+
icu4j = "75.1"
15+
supercsv = "2.4.0"
16+
log4j = "2.21.0"
17+
slf4j = "1.7.36"
18+
asm = "9.7"
19+
jettison = "1.5.4"
20+
woodstox = "6.4.0"
21+
kotlin = "1.7.10"
22+
antlr4 = "4.13.1"
23+
guava = "32.1.1-jre"
24+
protobuf = "3.25.5"
25+
jakarta_annotation = "1.3.5"
26+
google_http_client = "1.44.1"
27+
tdigest = "3.3"
28+
hdrhistogram = "2.2.2"
29+
grpc = "1.68.0"
30+
31+
# when updating the JNA version, also update the version in buildSrc/build.gradle
32+
jna = "5.13.0"
33+
34+
netty = "4.1.114.Final"
35+
joda = "2.12.7"
36+
37+
# project reactor
38+
reactor_netty = "1.1.23"
39+
reactor = "3.5.20"
40+
41+
# client dependencies
42+
httpclient5 = "5.3.1"
43+
httpcore5 = "5.2.5"
44+
httpclient = "4.5.14"
45+
httpcore = "4.4.16"
46+
httpasyncclient = "4.1.5"
47+
commonslogging = "1.2"
48+
commonscodec = "1.16.1"
49+
commonslang = "3.14.0"
50+
commonscompress = "1.26.1"
51+
commonsio = "2.16.0"
52+
# plugin dependencies
53+
aws = "2.20.86"
54+
reactivestreams = "1.0.4"
55+
56+
# when updating this version, you need to ensure compatibility with:
57+
# - plugins/ingest-attachment (transitive dependency, check the upstream POM)
58+
# - distribution/tools/plugin-cli
59+
bouncycastle="1.78"
60+
# test dependencies
61+
randomizedrunner = "2.7.1"
62+
junit = "4.13.2"
63+
hamcrest = "2.1"
64+
mockito = "5.14.1"
65+
objenesis = "3.2"
66+
bytebuddy = "1.15.4"
67+
68+
# benchmark dependencies
69+
jmh = "1.35"
70+
71+
# compression
72+
zstd = "1.5.5-5"
73+
74+
jzlib = "1.1.3"
75+
76+
resteasy = "6.2.4.Final"
77+
78+
# opentelemetry dependencies
79+
opentelemetry = "1.41.0"
80+
opentelemetrysemconv = "1.27.0-alpha"

0 commit comments

Comments
 (0)