-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract agent shadow configuration to conventions script. (open-telem…
…etry#3256) * Extract agent shadow configuration to conventions script. * Remove redundant plugin version declaration * Resource loader doesn't load from buildSrc * Comments about byte buddy version * Fix ReferenceCollectorTest Co-authored-by: Trask Stalnaker <[email protected]>
- Loading branch information
Showing
13 changed files
with
113 additions
and
188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
plugins { | ||
`java-gradle-plugin` | ||
`kotlin-dsl` | ||
id("com.diffplug.spotless") version "5.12.4" | ||
} | ||
|
||
spotless { | ||
java { | ||
googleJavaFormat("1.10.0") | ||
licenseHeaderFile(rootProject.file("../gradle/enforcement/spotless.license.java"), "(package|import|public)") | ||
target("src/**/*.java") | ||
} | ||
} | ||
|
||
gradlePlugin { | ||
plugins { | ||
create("muzzle-plugin") { | ||
id = "muzzle" | ||
implementationClass = "io.opentelemetry.instrumentation.gradle.muzzle.MuzzlePlugin" | ||
} | ||
} | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
gradlePluginPortal() | ||
mavenLocal() | ||
} | ||
|
||
tasks.withType<Test>().configureEach { | ||
useJUnitPlatform() | ||
} | ||
|
||
dependencies { | ||
implementation(gradleApi()) | ||
implementation(localGroovy()) | ||
|
||
implementation("org.eclipse.aether:aether-connector-basic:1.1.0") | ||
implementation("org.eclipse.aether:aether-transport-http:1.1.0") | ||
implementation("org.apache.maven:maven-aether-provider:3.3.9") | ||
|
||
implementation("com.google.guava:guava:30.1-jre") | ||
implementation("gradle.plugin.com.github.jengelman.gradle.plugins:shadow:7.0.0") | ||
implementation("org.ow2.asm:asm:7.0-beta") | ||
implementation("org.ow2.asm:asm-tree:7.0-beta") | ||
implementation("org.apache.httpcomponents:httpclient:4.5.10") | ||
// When updating, also update dependencyManagement/dependencyManagement.gradle.kts | ||
implementation("net.bytebuddy:byte-buddy-gradle-plugin:1.11.2") | ||
|
||
testImplementation("org.junit.jupiter:junit-jupiter-api:5.7.1") | ||
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.7.1") | ||
testImplementation("org.assertj:assertj-core:3.19.0") | ||
} |
33 changes: 33 additions & 0 deletions
33
buildSrc/src/main/kotlin/otel.shadow-conventions.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar | ||
|
||
plugins { | ||
id("com.github.johnrengelman.shadow") | ||
} | ||
|
||
tasks.withType<ShadowJar>().configureEach { | ||
mergeServiceFiles() | ||
|
||
exclude("**/module-info.class") | ||
|
||
// Prevents conflict with other SLF4J instances. Important for premain. | ||
relocate("org.slf4j", "io.opentelemetry.javaagent.slf4j") | ||
// rewrite dependencies calling Logger.getLogger | ||
relocate("java.util.logging.Logger", "io.opentelemetry.javaagent.bootstrap.PatchLogger") | ||
|
||
// prevents conflict with library instrumentation | ||
relocate("io.opentelemetry.instrumentation", "io.opentelemetry.javaagent.shaded.instrumentation") | ||
|
||
// relocate(OpenTelemetry API) | ||
relocate("io.opentelemetry.api", "io.opentelemetry.javaagent.shaded.io.opentelemetry.api") | ||
relocate("io.opentelemetry.semconv", "io.opentelemetry.javaagent.shaded.io.opentelemetry.semconv") | ||
relocate("io.opentelemetry.context", "io.opentelemetry.javaagent.shaded.io.opentelemetry.context") | ||
|
||
// relocate(the OpenTelemetry extensions that are used by instrumentation modules) | ||
// these extensions live in the AgentClassLoader, and are injected into the user"s class loader | ||
// by the instrumentation modules that use them | ||
relocate("io.opentelemetry.extension.aws", "io.opentelemetry.javaagent.shaded.io.opentelemetry.extension.aws") | ||
relocate("io.opentelemetry.extension.kotlin", "io.opentelemetry.javaagent.shaded.io.opentelemetry.extension.kotlin") | ||
|
||
// this is for instrumentation on opentelemetry-api itself | ||
relocate("application.io.opentelemetry", "io.opentelemetry") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.