Exclude duplicate project classes from inst/ (#5957)

This commit is contained in:
Mateusz Rzeszutek 2022-04-29 13:13:27 +02:00 committed by GitHub
parent a06f4b1e8e
commit dfa43d71a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 4 deletions

View File

@ -131,8 +131,7 @@ tasks {
val relocateBaseJavaagentLibs by registering(ShadowJar::class) {
configurations = listOf(baseJavaagentLibs)
// exclude the bootstrap part of the javaagent-extension-api
exclude("io/opentelemetry/javaagent/bootstrap/**")
excludeBootstrapClasses()
duplicatesStrategy = DuplicatesStrategy.FAIL
@ -142,8 +141,7 @@ tasks {
val relocateJavaagentLibs by registering(ShadowJar::class) {
configurations = listOf(javaagentLibs)
// exclude the bootstrap part of the javaagent-extension-api
exclude("io/opentelemetry/javaagent/bootstrap/**")
excludeBootstrapClasses()
duplicatesStrategy = DuplicatesStrategy.FAIL
@ -277,6 +275,20 @@ fun CopySpec.isolateClasses(jar: Provider<RegularFile>) {
}
}
// exclude bootstrap projects from javaagent libs - they won't be added to inst/
fun ShadowJar.excludeBootstrapClasses() {
dependencies {
exclude(project(":instrumentation-api"))
exclude(project(":instrumentation-api-semconv"))
exclude(project(":instrumentation-api-annotation-support"))
exclude(project(":instrumentation-appender-api-internal"))
exclude(project(":javaagent-bootstrap"))
}
// exclude the bootstrap part of the javaagent-extension-api
exclude("io/opentelemetry/javaagent/bootstrap/**")
}
class JavaagentProvider(
@InputFile
@PathSensitive(PathSensitivity.RELATIVE)