Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix javaagent publishing #3929

Merged
merged 2 commits into from
Aug 24, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions benchmark-e2e/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ dependencies {

tasks {
test {
dependsOn(":javaagent:shadowJar")
dependsOn(":javaagent:fullJavaagentJar")
maxParallelForks = 2

doFirst {
jvmArgs("-Dio.opentelemetry.smoketest.agent.shadowJar.path=${project(":javaagent").tasks.getByName<ShadowJar>("shadowJar").archivePath}")
jvmArgs("-Dio.opentelemetry.smoketest.agent.shadowJar.path=${project(":javaagent").tasks.getByName<ShadowJar>("fullJavaagentJar").archivePath}")
}
}
}
2 changes: 1 addition & 1 deletion benchmark-overhead-jmh/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ tasks {
val jmhStartFlightRecording = gradle.startParameter.projectProperties.get("jmh.startFlightRecording")

named<JMHTask>("jmh") {
val shadowTask = project(":javaagent").tasks.named<ShadowJar>("shadowJar").get()
val shadowTask = project(":javaagent").tasks.named<ShadowJar>("fullJavaagentJar").get()
inputs.files(layout.files(shadowTask))

// note: without an exporter, toSpanData() won't even be called
Expand Down
2 changes: 1 addition & 1 deletion benchmark/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ tasks {
}

named("jmh") {
dependsOn(":javaagent:shadowJar")
dependsOn(":javaagent:fullJavaagentJar")
}
}

Expand Down
21 changes: 8 additions & 13 deletions javaagent/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,6 @@ tasks {
}
}

// lightShadow is the default classifier we publish so disable the default jar.
jar {
enabled = false
}

val relocateJavaagentLibs by registering(ShadowJar::class) {
configurations = listOf(javaagentLibs)

Expand All @@ -128,7 +123,7 @@ tasks {
}

//Includes instrumentations, but not exporters
val lightShadow by registering(ShadowJar::class) {
val shadowJar by existing(ShadowJar::class) {
configurations = listOf(bootstrapLibs)

dependsOn(relocateJavaagentLibs)
Expand All @@ -148,7 +143,7 @@ tasks {
}

//Includes everything needed for OOTB experience
val shadowJar by existing(ShadowJar::class) {
val fullJavaagentJar by registering(ShadowJar::class) {
configurations = listOf(bootstrapLibs)

dependsOn(relocateJavaagentLibs, relocateExporterLibs)
Expand All @@ -160,23 +155,23 @@ tasks {
archiveClassifier.set("all")

manifest {
attributes(lightShadow.get().manifest.attributes)
attributes(shadowJar.get().manifest.attributes)
}
}

assemble {
dependsOn(lightShadow, shadowJar)
dependsOn(shadowJar, fullJavaagentJar)
}

withType<Test>().configureEach {
dependsOn(shadowJar)
inputs.file(shadowJar.get().archiveFile)
dependsOn(fullJavaagentJar)
inputs.file(fullJavaagentJar.get().archiveFile)

jvmArgs("-Dotel.javaagent.debug=true")

doFirst {
// Defining here to allow jacoco to be first on the command line.
jvmArgs("-javaagent:${shadowJar.get().archiveFile.get().asFile}")
jvmArgs("-javaagent:${fullJavaagentJar.get().archiveFile.get().asFile}")
}

testLogging {
Expand All @@ -195,7 +190,7 @@ tasks {
publishing {
publications {
named<MavenPublication>("maven") {
artifact(lightShadow)
artifact(fullJavaagentJar)
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions smoke-tests/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ dependencies {

tasks {
test {
inputs.files(project(":javaagent").tasks.getByName("shadowJar").outputs.files)
inputs.files(project(":javaagent").tasks.getByName("fullJavaagentJar").outputs.files)
maxParallelForks = 2

testLogging.showStandardStreams = true
Expand Down Expand Up @@ -79,7 +79,7 @@ tasks {
}
}

val shadowTask = project(":javaagent").tasks.named<ShadowJar>("shadowJar").get()
val shadowTask = project(":javaagent").tasks.named<ShadowJar>("fullJavaagentJar").get()
inputs.files(layout.files(shadowTask))

doFirst {
Expand Down