Skip to content

Commit 8cc9dd6

Browse files
committed
feat(build): Move to lib catalog
1 parent 46c883a commit 8cc9dd6

File tree

8 files changed

+140
-36
lines changed

8 files changed

+140
-36
lines changed

communication/build.gradle

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
apply from: "$rootDir/gradle/java.gradle"
22

33
dependencies {
4-
implementation deps.slf4j
4+
implementation libs.slf4j
55

66
api project(':remote-config')
77
implementation project(':internal-api')
88
implementation project(':utils:container-utils')
99
implementation project(':utils:socket-utils')
1010
implementation project(':utils:version-utils')
1111

12-
api deps.okio
13-
api deps.okhttp
14-
api group: 'com.squareup.moshi', name: 'moshi', version: versions.moshi
15-
implementation group: 'com.datadoghq', name: 'java-dogstatsd-client', version: "${versions.dogstatsd}"
12+
api libs.okio
13+
api libs.okhttp
14+
api libs.moshi
15+
implementation libs.dogstatsd
1616

1717
testImplementation project(':utils:test-utils')
18-
testImplementation deps.junit5
19-
testImplementation deps.truth
20-
testImplementation deps.bytebuddy
18+
testImplementation libs.bundles.junit5
19+
testImplementation libs.truth
20+
testImplementation libs.bytebuddy
2121
testImplementation group: 'org.msgpack', name: 'msgpack-core', version: '0.8.20'
2222
testImplementation group: 'org.msgpack', name: 'jackson-dataformat-msgpack', version: '0.8.20'
23-
testImplementation group: 'com.squareup.okhttp3', name: 'mockwebserver', version: versions.okhttp_legacy
23+
testImplementation group: 'com.squareup.okhttp3', name: 'mockwebserver', version: libs.versions.okhttp.legacy
2424
}
2525

2626
ext {

dd-java-agent/agent-bootstrap/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ dependencies {
2121
api project(':internal-api')
2222
api project(':internal-api:internal-api-9')
2323
api project(':dd-java-agent:agent-logging')
24-
api deps.slf4j
24+
api libs.slf4j
2525
// ^ Generally a bad idea for libraries, but we're shadowing.
2626

2727
testImplementation project(':dd-java-agent:testing')

dd-java-agent/agent-ci-visibility/build.gradle

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@ minimumBranchCoverage = 0.0
1010
minimumInstructionCoverage = 0.0
1111

1212
dependencies {
13-
api deps.slf4j
13+
api libs.slf4j
1414

15-
implementation deps.asm
16-
implementation deps.asmcommons
15+
implementation libs.bundles.asm
1716
implementation group: 'org.jacoco', name: 'org.jacoco.core', version: '0.8.9'
1817
implementation group: 'org.jacoco', name: 'org.jacoco.report', version: '0.8.9'
1918

dd-java-agent/build.gradle

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,9 @@ dependencies {
212212
testImplementation project(':dd-trace-core')
213213
testImplementation project(':utils:test-utils')
214214

215-
testImplementation deps.testLogging
216-
testImplementation deps.guava
217-
testImplementation deps.okhttp
215+
testImplementation libs.bundles.test.logging
216+
testImplementation libs.guava
217+
testImplementation libs.okhttp
218218
testImplementation group: 'io.opentracing', name: 'opentracing-util', version: '0.31.0'
219219

220220
// Includes for the top level shadow jar
@@ -225,8 +225,7 @@ dependencies {
225225
// Includes for the shared internal shadow jar
226226
sharedShadowInclude deps.shared
227227
// force a controlled version of ASM that is used by Debugger while pulled transitively by jnr
228-
sharedShadowInclude deps.asm
229-
sharedShadowInclude deps.asmcommons
228+
sharedShadowInclude libs.bundles.asm
230229
sharedShadowInclude project(':communication'), {
231230
transitive = false
232231
// do not bring along slf4j and dependent subprojects
@@ -237,7 +236,7 @@ dependencies {
237236
// do not bring along slf4j and dependent subprojects
238237
// (which are loaded on the bootstrap cl)
239238
}
240-
sharedShadowInclude deps.cafe_crypto
239+
sharedShadowInclude libs.bundles.cafe.crypto
241240
sharedShadowInclude project(':remote-config'), {
242241
transitive = false
243242
}

gradle/dependencies.gradle

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -105,18 +105,8 @@ final class CachedData {
105105
],
106106

107107
// Shared between appsec, agent tooling, iast, instrumentation, JMXFetch, profiling, and ci-visibility
108-
shared : [
109-
// Force specific version of okio required by com.squareup.moshi:moshi
110-
// When all of the dependencies are declared in dd-trace-core, moshi overrides the okhttp's
111-
// transitive dependency. Since okhttp is declared here and moshi is not, this lead to an incompatible version
112-
"com.datadoghq.okio:okio:${versions.okio}",
113-
"com.datadoghq.okhttp3:okhttp:${versions.okhttp}",
114-
"com.datadoghq:java-dogstatsd-client:${versions.dogstatsd}",
115-
"com.github.jnr:jnr-unixsocket:${versions.jnr_unixsocket}",
116-
"com.squareup.moshi:moshi:${versions.moshi}",
117-
"org.jctools:jctools-core:${versions.jctools}",
118-
"org.lz4:lz4-java:${versions.lz4}",
119-
],
108+
// Set in a non-static context to use lib catalog
109+
shared : [],
120110

121111
// Inverse of "shared". These exclude directives are part of shadowJar's DSL
122112
// which is similar but not exactly the same as the regular gradle dependency{} block
@@ -162,6 +152,19 @@ final class CachedData {
162152
]
163153
}
164154

155+
CachedData.deps.shared = [
156+
// Force specific version of okio required by com.squareup.moshi:moshi
157+
// When all of the dependencies are declared in dd-trace-core, moshi overrides the okhttp's
158+
// transitive dependency. Since okhttp is declared here and moshi is not, this lead to an incompatible version
159+
libs.okio,
160+
libs.okhttp,
161+
libs.dogstatsd,
162+
"com.github.jnr:jnr-unixsocket:${libs.versions.jnr.unixsocket}",
163+
libs.moshi,
164+
libs.jctools,
165+
libs.lz4
166+
]
167+
165168
ext {
166169
versions = CachedData.versions
167170
deps = CachedData.deps

gradle/java_deps.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apply plugin: 'groovy'
22

33
dependencies {
4-
testImplementation deps.spock
5-
testImplementation deps.groovy
6-
testImplementation deps.testLogging
4+
testImplementation libs.bundles.spock
5+
testImplementation libs.groovy
6+
testImplementation libs.bundles.test.logging
77
}

gradle/libs.versions.toml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
[versions]
2+
slf4j = "1.7.30"
3+
# The ranges are needed to allow instrumentation tests to specify the desired version.
4+
guava = "[16.0,20.0]" # Last version to support Java 7
5+
okhttp = "3.12.15" # Datadog fork to support Java 7
6+
okhttp-legacy = "[3.0,3.12.12]" # 3.12.x is last version to support Java7)
7+
okio = "1.17.6" # Datadog fork
8+
9+
spock = "2.2-groovy-3.0"
10+
groovy = "3.0.17"
11+
junit5 = "5.9.2"
12+
logback = "1.2.3"
13+
bytebuddy = "1.14.16"
14+
scala = "2.11.12" # Last version to support Java 7 (2.12+ require Java 8+)
15+
scala210 = "2.10.7"
16+
scala211 = "2.11.12"
17+
scala212 = "2.12.18"
18+
scala213 = "2.13.11"
19+
truth = "1.1.3"
20+
kotlin = "1.6.21"
21+
coroutines = "1.3.0"
22+
dogstatsd = "4.4.0"
23+
jnr_unixsocket = "0.38.22"
24+
jnr_posix = '3.1.19'
25+
commons = "3.2"
26+
mockito = '4.4.0'
27+
jctools = '3.3.0'
28+
moshi = '1.11.0'
29+
testcontainers = '1.19.3'
30+
jmc = "8.1.0"
31+
autoservice = "1.0-rc7"
32+
ddprof = "1.8.0"
33+
asm = "9.7"
34+
cafe_crypto = "0.1.0"
35+
lz4 = "1.7.1"
36+
37+
[libraries]
38+
slf4j = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" }
39+
guava = { module = "com.google.guava:guava", version.ref = "guava" }
40+
moshi = { module = "com.squareup.moshi:moshi", version.ref = "moshi" }
41+
jctools = { module = "org.jctools:jctools-core", version.ref = "jctools" }
42+
okhttp = { module = "com.datadoghq.okhttp3:okhttp", version.ref = "okhttp" }
43+
okhttp-legacy = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp_legacy" }
44+
okio = { module = "com.datadoghq.okio:okio", version.ref = "okio" }
45+
bytebuddy = { module = "net.bytebuddy:byte-buddy", version.ref = "bytebuddy" }
46+
bytebuddyagent = { module = "net.bytebuddy:byte-buddy-agent", version.ref = "bytebuddy" }
47+
autoservice-processor = { module = "com.google.auto.service:auto-service", version.ref = "autoservice" }
48+
autoservice-annotation = { module = "com.google.auto.service:auto-service-annotations", version.ref = "autoservice" }
49+
commons-math = { module = "org.apache.commons:commons-math3", version.ref = "commons" }
50+
ddprof = { module = "com.datadoghq:ddprof", version.ref = "ddprof" }
51+
asm = { module = "org.ow2.asm:asm", version.ref = "asm" }
52+
asmcommons = { module = "org.ow2.asm:asm-commons", version.ref = "asm" }
53+
dogstatsd = { module = "com.datadoghq:java-dogstatsd-client", version.ref = "dogstatsd" }
54+
55+
cafe-crypto-ed25519 = { module = "cafe.cryptography:ed25519-elisabeth", version.ref = "cafe_crypto" }
56+
cafe-crypto-curve25519 = { module = "cafe.cryptography:curve25519-elisabeth", version.ref = "cafe_crypto" }
57+
58+
lz4 = { module = "org.lz4:lz4-java", version.ref = "lz4" }
59+
60+
# Testing
61+
spock-core = { module = "org.spockframework:spock-core", version.ref = "spock" }
62+
spock-junit4 = { module = "org.spockframework:spock-junit4", version.ref = "spock" }
63+
objenesis = { module = "org.objenesis:objenesis", version = "3.3" } # Used by Spock for mocking:
64+
65+
groovy = { module = "org.codehaus.groovy:groovy-all", version.ref = "groovy" }
66+
junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit5" }
67+
junit-jupiter-params = { module = "org.junit.jupiter:junit-jupiter-params", version.ref = "junit5" }
68+
69+
mokito-core = { module = "org.mockito:mockito-core", version.ref = "mockito" }
70+
mokito-junit-jupiter = { module = "org.mockito:mockito-junit-jupiter", version.ref = "mockito" }
71+
# needed for Java 21 support
72+
byte-buddy = { module = "net.bytebuddy:byte-buddy", version.ref = "bytebuddy" }
73+
byte-buddy-agent = { module = "net.bytebuddy:byte-buddy-agent", version.ref = "bytebuddy" }
74+
75+
testcontainers = { module = "org.testcontainers:testcontainers", version.ref = "testcontainers" }
76+
77+
logback-classic = { module = "ch.qos.logback:logback-classic", version.ref = "logback" }
78+
log4j-over-slf4j = { module = "org.slf4j:log4j-over-slf4j", version.ref = "slf4j" }
79+
jcl-over-slf4j = { module = "org.slf4j:jcl-over-slf4j", version.ref = "slf4j" }
80+
jul-to-slf4j = { module = "org.slf4j:jul-to-slf4j", version.ref = "slf4j" }
81+
82+
scala = { module = "org.scala-lang:scala-library", version.ref = "scala" }
83+
scala210 = { module = "org.scala-lang:scala-library", version.ref = "scala210" }
84+
scala211 = { module = "org.scala-lang:scala-library", version.ref = "scala211" }
85+
scala212 = { module = "org.scala-lang:scala-library", version.ref = "scala212" }
86+
scala213 = { module = "org.scala-lang:scala-library", version.ref = "scala213" }
87+
truth = { module = "com.google.truth:truth", version.ref = "truth" }
88+
kotlin = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" }
89+
coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" }
90+
91+
jmc-common = { module = "org.openjdk.jmc:common", version.ref = "jmc" }
92+
jmc-flightrecorder = { module = "org.openjdk.jmc:flightrecorder", version.ref = "jmc" }
93+
94+
[bundles]
95+
asm = ["asm", "asmcommons"]
96+
cafe-crypto = ["cafe-crypto-curve25519", "cafe-crypto-ed25519"]
97+
# Testing
98+
spock = ["spock-core", "spock-junit4", "objenesis"]
99+
junit5 = ["junit-jupiter", "junit-jupiter-params"]
100+
mokito = ["mokito-core", "mokito-junit-jupiter", "byte-buddy", "byte-buddy-agent"]
101+
test-logging = ["logback-classic", "log4j-over-slf4j", "jcl-over-slf4j", "jul-to-slf4j"]
102+
103+
jmc = ["jmc-common", "jmc-flightrecorder"]

gradle/test-with-scala.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
apply plugin: 'scala'
44

55
dependencies {
6-
compileOnly deps.scala
7-
testImplementation deps.scala
6+
compileOnly libs.scala
7+
testImplementation libs.scala
88
}
99

1010
tasks.named("compileTestGroovy").configure {

0 commit comments

Comments
 (0)