Skip to content

Commit b007f58

Browse files
authored
Use single shaded testing artifact (#14676)
1 parent 2f9f8bd commit b007f58

File tree

9 files changed

+38
-114
lines changed

9 files changed

+38
-114
lines changed

instrumentation/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ subprojects {
2424
// this only exists to make Intellij happy since it doesn't (currently at least) understand our
2525
// inclusion of this artifact inside :testing-common
2626
dependencies {
27-
compileOnly(project(":testing:armeria-shaded-for-testing", configuration = "shadow"))
28-
testCompileOnly(project(":testing:armeria-shaded-for-testing", configuration = "shadow"))
27+
compileOnly(project(":testing:dependencies-shaded-for-testing", configuration = "shadow"))
28+
testCompileOnly(project(":testing:dependencies-shaded-for-testing", configuration = "shadow"))
2929
}
3030
}
3131

instrumentation/pekko/pekko-http-1.0/javaagent/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ testing {
6969
dependencies {
7070
// this only exists to make Intellij happy since it doesn't (currently at least) understand our
7171
// inclusion of this artifact inside :testing-common
72-
compileOnly(project.dependencies.project(":testing:armeria-shaded-for-testing", configuration = "shadow"))
72+
compileOnly(project.dependencies.project(":testing:dependencies-shaded-for-testing", configuration = "shadow"))
7373

7474
if (findProperty("testLatestDeps") as Boolean) {
7575
implementation("com.typesafe.akka:akka-http_2.13:latest.release")

instrumentation/vertx/vertx-rx-java-3.5/javaagent/build.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ testing {
3535
dependencies {
3636
// this only exists to make Intellij happy since it doesn't (currently at least) understand our
3737
// inclusion of this artifact inside :testing-common
38-
compileOnly(project.dependencies.project(":testing:armeria-shaded-for-testing", configuration = "shadow"))
38+
compileOnly(project.dependencies.project(":testing:dependencies-shaded-for-testing", configuration = "shadow"))
3939

4040
val version = if (testLatestDeps) "3.+" else "3.5.0"
4141
implementation("org.hsqldb:hsqldb:2.3.4")
@@ -52,7 +52,7 @@ testing {
5252
dependencies {
5353
// this only exists to make Intellij happy since it doesn't (currently at least) understand our
5454
// inclusion of this artifact inside :testing-common
55-
compileOnly(project.dependencies.project(":testing:armeria-shaded-for-testing", configuration = "shadow"))
55+
compileOnly(project.dependencies.project(":testing:dependencies-shaded-for-testing", configuration = "shadow"))
5656

5757
val version = if (testLatestDeps) "4.+" else "4.1.0"
5858
implementation("org.hsqldb:hsqldb:2.3.4")
@@ -69,7 +69,7 @@ testing {
6969
dependencies {
7070
// this only exists to make Intellij happy since it doesn't (currently at least) understand our
7171
// inclusion of this artifact inside :testing-common
72-
compileOnly(project.dependencies.project(":testing:armeria-shaded-for-testing", configuration = "shadow"))
72+
compileOnly(project.dependencies.project(":testing:dependencies-shaded-for-testing", configuration = "shadow"))
7373

7474
val version = if (testLatestDeps) "latest.release" else "5.0.0"
7575
implementation("org.hsqldb:hsqldb:2.3.4")

settings.gradle.kts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,7 @@ include(":instrumentation-docs")
102102
include(":test-report")
103103
include(":testing:agent-exporter")
104104
include(":testing:agent-for-testing")
105-
include(":testing:armeria-shaded-for-testing")
106-
include(":testing:proto-shaded-for-testing")
107-
include(":testing:wiremock-shaded-for-testing")
105+
include(":testing:dependencies-shaded-for-testing")
108106
include(":testing-common")
109107
include(":testing-common:integration-tests")
110108
include(":testing-common:library-for-integration-tests")

smoke-tests/build.gradle.kts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,8 @@ dependencies {
3838
implementation("com.github.docker-java:docker-java-transport-httpclient5:$dockerJavaVersion")
3939

4040
// make IntelliJ see shaded Armeria and protobuf
41-
compileOnly(project(":testing:armeria-shaded-for-testing", configuration = "shadow"))
42-
testCompileOnly(project(":testing:armeria-shaded-for-testing", configuration = "shadow"))
43-
compileOnly(project(":testing:proto-shaded-for-testing", configuration = "shadow"))
41+
compileOnly(project(":testing:dependencies-shaded-for-testing", configuration = "shadow"))
42+
testCompileOnly(project(":testing:dependencies-shaded-for-testing", configuration = "shadow"))
4443
}
4544

4645
tasks {

testing-common/build.gradle.kts

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,10 @@ group = "io.opentelemetry.javaagent"
88

99
sourceSets {
1010
main {
11-
val armeriaShadedDeps = project(":testing:armeria-shaded-for-testing")
11+
val shadedDeps = project(":testing:dependencies-shaded-for-testing")
1212
output.dir(
13-
armeriaShadedDeps.file("build/extracted/shadow"),
14-
"builtBy" to ":testing:armeria-shaded-for-testing:extractShadowJar"
15-
)
16-
17-
val protoShadedDeps = project(":testing:proto-shaded-for-testing")
18-
output.dir(
19-
protoShadedDeps.file("build/extracted/shadow"),
20-
"builtBy" to ":testing:proto-shaded-for-testing:extractShadowJar"
21-
)
22-
23-
val wiremockShadedDeps = project(":testing:wiremock-shaded-for-testing")
24-
output.dir(
25-
wiremockShadedDeps.file("build/extracted/shadow"),
26-
"builtBy" to ":testing:wiremock-shaded-for-testing:extractShadowJar"
13+
shadedDeps.file("build/extracted/shadow"),
14+
"builtBy" to ":testing:dependencies-shaded-for-testing:extractShadowJar"
2715
)
2816
}
2917
}
@@ -59,11 +47,9 @@ dependencies {
5947
api("org.awaitility:awaitility")
6048
api("org.mockito:mockito-core")
6149
api("org.slf4j:slf4j-api")
50+
api("com.google.code.findbugs:annotations")
6251

63-
compileOnly(project(":testing:armeria-shaded-for-testing", configuration = "shadow"))
64-
compileOnly(project(":testing:proto-shaded-for-testing", configuration = "shadow"))
65-
// used to record LLM responses in gen AI tests
66-
compileOnly(project(":testing:wiremock-shaded-for-testing", configuration = "shadow"))
52+
compileOnly(project(":testing:dependencies-shaded-for-testing", configuration = "shadow"))
6753
compileOnly(project(":javaagent-bootstrap"))
6854

6955
compileOnly("com.google.auto.value:auto-value-annotations")

testing/armeria-shaded-for-testing/build.gradle.kts renamed to testing/dependencies-shaded-for-testing/build.gradle.kts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ plugins {
66
dependencies {
77
implementation("com.linecorp.armeria:armeria-junit5:1.33.2")
88
implementation("com.google.errorprone:error_prone_annotations")
9+
implementation("io.opentelemetry.proto:opentelemetry-proto")
10+
implementation("com.google.protobuf:protobuf-java-util:4.32.1")
11+
implementation("com.github.tomakehurst:wiremock-jre8:2.35.2")
12+
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.20.0")
913
}
1014

1115
tasks {
@@ -14,6 +18,7 @@ tasks {
1418
exclude(dependency("org.slf4j:slf4j-api"))
1519
exclude(dependency("org.junit.jupiter:junit-jupiter-api"))
1620
exclude(dependency("org.junit.platform:junit-platform-commons"))
21+
exclude(dependency("com.google.code.findbugs:annotations"))
1722
}
1823

1924
// Ensures tests are not affected by Armeria instrumentation
@@ -37,11 +42,30 @@ tasks {
3742
relocate("org.HdrHistogram", "io.opentelemetry.testing.internal.org.hdrhistogram")
3843
relocate("org.LatencyUtils", "io.opentelemetry.testing.internal.org.latencyutils")
3944

45+
relocate("io.opentelemetry.proto", "io.opentelemetry.testing.internal.proto")
46+
relocate("com.google.protobuf", "io.opentelemetry.testing.internal.protobuf")
47+
relocate("com.google.gson", "io.opentelemetry.testing.internal.gson")
48+
relocate("com.google.common", "io.opentelemetry.testing.internal.guava")
49+
relocate("org.apache.commons", "io.opentelemetry.testing.internal.apachecommons")
50+
relocate("org.apache.hc", "io.opentelemetry.testing.internal.apachehttp")
51+
relocate("org.eclipse.jetty", "io.opentelemetry.testing.internal.jetty")
52+
relocate("com.fasterxml.jackson", "io.opentelemetry.testing.internal.jackson")
53+
relocate("com.jayway.jsonpath", "io.opentelemetry.testing.internal.jsonpath")
54+
relocate("javax.servlet", "io.opentelemetry.testing.internal.servlet")
55+
relocate("org.yaml", "io.opentelemetry.testing.internal.yaml")
56+
57+
// don't relocate wiremock itself
58+
relocate("com.github.tomakehurst.wiremock", "com.github.tomakehurst.wiremock")
59+
4060
mergeServiceFiles()
4161
// mergeServiceFiles requires that duplicate strategy is set to include
4262
filesMatching("META-INF/services/**") {
4363
duplicatesStrategy = DuplicatesStrategy.INCLUDE
4464
}
65+
66+
// relocate everything else
67+
enableAutoRelocation = true
68+
relocationPrefix = "io.opentelemetry.testing.internal"
4569
}
4670

4771
val extractShadowJar by registering(Copy::class) {

testing/proto-shaded-for-testing/build.gradle.kts

Lines changed: 0 additions & 28 deletions
This file was deleted.

testing/wiremock-shaded-for-testing/build.gradle.kts

Lines changed: 0 additions & 55 deletions
This file was deleted.

0 commit comments

Comments
 (0)