Skip to content

Commit 02d75fa

Browse files
committed
Sync with upstream gradle files
1 parent b15550d commit 02d75fa

File tree

6 files changed

+32
-67
lines changed

6 files changed

+32
-67
lines changed

agent/instrumentation/azure-functions/build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ muzzle {
1212
val otelInstrumentationAlphaVersion: String by project
1313

1414
dependencies {
15+
compileOnly(project(":agent:agent-bootstrap"))
1516
compileOnly(project(":agent:instrumentation:azure-functions-worker-stub"))
1617

18+
testImplementation(project(":agent:agent-bootstrap"))
1719
testImplementation(project(":agent:instrumentation:azure-functions-worker-stub"))
1820

1921
// TODO remove when start using io.opentelemetry.instrumentation.javaagent-instrumentation plugin

agent/instrumentation/micrometer-1.0/build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@ muzzle {
2323
val otelInstrumentationAlphaVersion: String by project
2424

2525
dependencies {
26+
compileOnly(project(":agent:agent-bootstrap"))
2627
compileOnly("io.micrometer:micrometer-core:1.0.0")
2728
compileOnly("org.springframework.boot:spring-boot-actuator-autoconfigure:2.2.0.RELEASE")
2829
compileOnly("io.opentelemetry.javaagent:opentelemetry-javaagent-bootstrap:$otelInstrumentationAlphaVersion")
2930

31+
testImplementation(project(":agent:agent-bootstrap"))
3032
testImplementation("com.microsoft.azure:azure-spring-boot-metrics-starter:2.2.3") {
3133
exclude("io.micrometer", "micrometer-core")
3234
}
Lines changed: 2 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,5 @@
1-
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
2-
31
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")
613

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")
705
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// mostly copied from otel.javaagent-testing.gradle.kts
2+
3+
plugins {
4+
id("io.opentelemetry.instrumentation.javaagent-testing")
5+
6+
id("ai.java-conventions")
7+
}
8+
9+
evaluationDependsOn(":agent:agent-for-testing")
10+
11+
dependencies {
12+
annotationProcessor("com.google.auto.service:auto-service")
13+
compileOnly("com.google.auto.service:auto-service")
14+
15+
testImplementation("org.testcontainers:testcontainers")
16+
}
17+
18+
configurations.configureEach {
19+
if (name.endsWith("testruntimeclasspath", ignoreCase = true)) {
20+
// Added by agent, don't let Gradle bring it in when running tests.
21+
exclude(module = "javaagent-bootstrap")
22+
}
23+
}

buildSrc/src/main/kotlin/io.opentelemetry.instrumentation.base.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// mostly copied from upstream
2+
13
/** Common setup for manual instrumentation of libraries and javaagent instrumentation. */
24

35
plugins {

dependencyManagement/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ val DEPENDENCIES = listOf(
6969
"io.opentelemetry.contrib:opentelemetry-jfr-connection:${otelContribVersion}-alpha",
7070
"io.opentelemetry.contrib:opentelemetry-runtime-attach-core:${otelContribVersion}-alpha",
7171
"com.google.code.findbugs:jsr305:3.0.2",
72+
"com.google.code.findbugs:annotations:3.0.1",
7273
"com.github.spotbugs:spotbugs-annotations:4.9.3"
7374
)
7475

0 commit comments

Comments
 (0)