|
1 | | -import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar |
2 | | - |
3 | 1 | plugins { |
4 | | - id("ai.java-conventions") |
5 | | - id("ai.shadow-conventions") |
6 | | - |
7 | | - id("io.opentelemetry.instrumentation.muzzle-generation") |
8 | | - id("io.opentelemetry.instrumentation.muzzle-check") |
9 | | -} |
10 | | - |
11 | | -val otelInstrumentationAlphaVersion: String by project |
12 | | - |
13 | | -val testInstrumentation by configurations.creating |
14 | | - |
15 | | -dependencies { |
16 | | - compileOnly("io.opentelemetry:opentelemetry-sdk") |
17 | | - compileOnly("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure") |
18 | | - compileOnly("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure-spi") |
19 | | - compileOnly("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api") |
20 | | - compileOnly("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api-incubator") |
21 | | - compileOnly("io.opentelemetry.javaagent:opentelemetry-javaagent-extension-api:$otelInstrumentationAlphaVersion") |
22 | | - annotationProcessor("com.google.auto.service:auto-service") |
23 | | - compileOnly("com.google.auto.service:auto-service") |
24 | | - compileOnly(project(":agent:agent-bootstrap")) |
25 | | - |
26 | | - testImplementation("io.opentelemetry.javaagent:opentelemetry-testing-common:$otelInstrumentationAlphaVersion") |
27 | | - // the bootstrap module is provided by the javaagent in the instrumentation test runtime, no need to include it |
28 | | - // (especially when it's not being shaded) |
29 | | - testCompileOnly(project(":agent:agent-bootstrap")) |
30 | | -} |
31 | | - |
32 | | -tasks.named<ShadowJar>("shadowJar").configure { |
33 | | - configurations = listOf(project.configurations.runtimeClasspath.get(), testInstrumentation) |
34 | | - |
35 | | - archiveFileName.set("agent-testing.jar") |
36 | | -} |
37 | | - |
38 | | -evaluationDependsOn(":agent:agent-for-testing") |
39 | | - |
40 | | -tasks.withType<Test>().configureEach { |
41 | | - val shadowJar = tasks.shadowJar.get() |
42 | | - val agentShadowJar = project(":agent:agent-for-testing").tasks.shadowJar.get() |
43 | | - |
44 | | - inputs.file(shadowJar.archiveFile) |
45 | | - |
46 | | - dependsOn(shadowJar) |
47 | | - dependsOn(agentShadowJar) |
48 | | - |
49 | | - jvmArgs("-Dotel.javaagent.debug=true") |
50 | | - jvmArgs("-javaagent:${agentShadowJar.archiveFile.get().asFile.absolutePath}") |
51 | | - jvmArgs("-Dotel.javaagent.experimental.initializer.jar=${shadowJar.archiveFile.get().asFile.absolutePath}") |
52 | | - jvmArgs("-Dotel.javaagent.testing.additional-library-ignores.enabled=false") |
53 | | - jvmArgs("-Dotel.javaagent.testing.fail-on-context-leak=true") |
54 | | - // prevent sporadic gradle deadlocks, see SafeLogger for more details |
55 | | - jvmArgs("-Dotel.javaagent.testing.transform-safe-logging.enabled=true") |
56 | | - // Reduce noise in assertion messages since we don't need to verify this in most tests. We check |
57 | | - // in smoke tests instead. |
58 | | - jvmArgs("-Dotel.javaagent.add-thread-details=false") |
59 | | - // needed for proper GlobalMeterProvider registration |
60 | | - jvmArgs("-Dotel.metrics.exporter=otlp") |
| 2 | + id("ai.javaagent-testing") |
61 | 3 |
|
62 | | - // The sources are packaged into the testing jar so we need to make sure to exclude from the test |
63 | | - // classpath, which automatically inherits them, to ensure our shaded versions are used. |
64 | | - classpath = classpath.filter { |
65 | | - if (file("$buildDir/resources/main") == it || file("$buildDir/classes/java/main") == it) { |
66 | | - return@filter false |
67 | | - } |
68 | | - return@filter true |
69 | | - } |
| 4 | + id("io.opentelemetry.instrumentation.javaagent-instrumentation") |
70 | 5 | } |
0 commit comments