Skip to content

Commit e1a1de3

Browse files
committed
chore: Lazy configurations access
1 parent 86d9a27 commit e1a1de3

File tree

17 files changed

+98
-88
lines changed

17 files changed

+98
-88
lines changed

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@ apply from: "$rootDir/gradle/java.gradle"
1111
apply plugin: 'instrument'
1212

1313
configurations {
14-
embeddedClasspath {
14+
def ec = register('embeddedClasspath') {
1515
visible = false
1616
canBeConsumed = false
1717
canBeResolved = true
1818
}
19-
compileClasspath.extendsFrom(embeddedClasspath)
19+
named('compileClasspath') {
20+
compileClasspath.extendsFrom(ec.get())
21+
}
2022
instrumentPluginClasspath {
2123
visible = false
2224
canBeConsumed = false
@@ -55,13 +57,12 @@ dependencies {
5557

5658
// unpack embeddedClasspath to same path as compiled classes so it can get instrumented
5759
tasks.register('unpackJars', Copy) {
58-
dependsOn configurations.embeddedClasspath
60+
dependsOn configurations.named('embeddedClasspath')
5961
exclude 'META-INF/'
6062
exclude '**/module-info.class'
6163
exclude '**/package-info.class'
62-
from {
63-
configurations.embeddedClasspath.collect { zipTree(it) }
64-
}
64+
65+
from(configurations.named('embeddedClasspath').map { it.collect { zipTree(it) } })
6566
into compileJava.destinationDirectory
6667
}
6768

dd-java-agent/appsec/appsec-test-fixtures/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ dependencies {
66
api project(':dd-java-agent:instrumentation-testing')
77
}
88

9-
configurations.api {
9+
configurations.named('api') {
1010
exclude group: 'org.eclipse.jetty', module: 'jetty-server'
1111
}

dd-java-agent/instrumentation/cxf-2.1/build.gradle

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,16 @@ dependencies {
7676
latestDepTestImplementation group: 'org.apache.cxf', name: 'cxf-rt-frontend-jaxrs', version: '+'
7777
latestDepTestImplementation group: 'org.apache.cxf', name:'cxf-rt-transports-http-jetty', version: '+'
7878

79-
configurations.findAll {it.name in ['latestDepTestRuntimeClasspath', 'cxf3LatestDepTestRuntimeClasspath'] }.each {
80-
it.resolutionStrategy {
81-
force libs.slf4j
82-
}
79+
}
80+
81+
configurations.named('latestDepTestRuntimeClasspath') {
82+
resolutionStrategy {
83+
force libs.slf4j
84+
}
85+
}
86+
87+
configurations.named('cxf3LatestDepTestRuntimeClasspath') {
88+
resolutionStrategy {
89+
force libs.slf4j
8390
}
8491
}

dd-java-agent/instrumentation/elasticsearch/rest-5/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,6 @@ dependencies {
4646
latestDepTestImplementation group: 'org.elasticsearch.plugin', name: 'transport-netty4-client', version: '6.3.+'
4747
}
4848

49-
configurations.latestDepTestImplementation {
49+
configurations.named('latestDepTestImplementation') {
5050
exclude group: "org.elasticsearch.client", module: "rest"
5151
}

dd-java-agent/instrumentation/grizzly/grizzly-2.0/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ dependencies {
2626
latestDepTestImplementation group: 'org.glassfish.jersey.inject', name: 'jersey-hk2', version: '2.+'
2727
}
2828

29-
configurations.testRuntimeOnly {
29+
configurations.named('testRuntimeOnly') {
3030
// jersey-container-grizzly2-http transitively imports its own set repackaged asm classes
3131
exclude group: 'org.ow2.asm'
3232
}

dd-java-agent/instrumentation/netty/netty-3.8/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ dependencies {
3333
}
3434

3535
// We need to force the dependency to the earliest supported version because other libraries declare newer versions.
36-
configurations.testImplementation {
36+
configurations.named('testImplementation') {
3737
resolutionStrategy {
3838
eachDependency { DependencyResolveDetails details ->
3939
//specifying a fixed version for all libraries with io.netty' group

dd-java-agent/instrumentation/netty/netty-4.0/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ dependencies {
4747
}
4848

4949
// We need to force the dependency to the earliest supported version because other libraries declare newer versions.
50-
configurations.testImplementation {
50+
configurations.named('testImplementation') {
5151
resolutionStrategy {
5252
eachDependency { DependencyResolveDetails details ->
5353
//specifying a fixed version for all libraries with io.netty' group

dd-java-agent/instrumentation/netty/netty-4.1/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ dependencies {
5858
}
5959

6060
// We need to force the dependency to the earliest supported version because other libraries declare newer versions.
61-
configurations.testImplementation {
61+
configurations.named('testImplementation') {
6262
resolutionStrategy {
6363
eachDependency { DependencyResolveDetails details ->
6464
//specifying a fixed version for all libraries with io.netty' group

dd-java-agent/instrumentation/rabbitmq-amqp-2.7/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ dependencies {
3030
latestReactorTestImplementation group: 'io.projectreactor.rabbitmq', name: 'reactor-rabbitmq', version: '+'
3131
}
3232

33-
configurations.testRuntimeOnly {
33+
configurations.named('testRuntimeOnly') {
3434
resolutionStrategy {
3535
force group: 'com.rabbitmq', name: 'amqp-client', version: '2.7.0'
3636
}
@@ -41,5 +41,5 @@ tasks.withType(Test).configureEach {
4141
}
4242

4343
tasks.named("latestDepTest", Test) {
44-
finalizedBy latestReactorTest
44+
finalizedBy 'latestReactorTest'
4545
}

dd-java-agent/instrumentation/tomcat/tomcat-5.5/build.gradle

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -156,14 +156,15 @@ tasks.withType(Test).configureEach {
156156
}
157157

158158
// Exclude all the dependencies from test for latestDepTest since the names are completely different.
159-
configurations.findAll { it.name in ["latestDepTestImplementation", "tomcat9TestImplementation", "latest10TestImplementation"] }
160-
.each {
161-
it.exclude group: 'tomcat', module: 'catalina'
162-
it.exclude group: 'tomcat', module: 'tomcat-coyote'
163-
it.exclude group: 'tomcat', module: 'tomcat-util'
164-
it.exclude group: 'tomcat', module: 'tomcat-http'
165-
it.exclude group: 'tomcat', module: 'naming-resources'
166-
it.exclude group: 'tomcat', module: 'naming-factory'
167-
it.exclude group: 'commons-modeler', module: 'commons-modeler'
168-
it.exclude group: 'javax.servlet', module: 'servlet-api'
159+
["latestDepTestImplementation", "tomcat9TestImplementation", "latest10TestImplementation"].each {
160+
configurations.named(it) {
161+
it.exclude group: 'tomcat', module: 'catalina'
162+
it.exclude group: 'tomcat', module: 'tomcat-coyote'
163+
it.exclude group: 'tomcat', module: 'tomcat-util'
164+
it.exclude group: 'tomcat', module: 'tomcat-http'
165+
it.exclude group: 'tomcat', module: 'naming-resources'
166+
it.exclude group: 'tomcat', module: 'naming-factory'
167+
it.exclude group: 'commons-modeler', module: 'commons-modeler'
168+
it.exclude group: 'javax.servlet', module: 'servlet-api'
169+
}
169170
}

0 commit comments

Comments
 (0)