60 lines
1.5 KiB
Groovy
60 lines
1.5 KiB
Groovy
plugins {
|
|
id("com.github.johnrengelman.shadow") version "7.1.2"
|
|
}
|
|
|
|
apply from: "$rootDir/gradle/shadow.gradle"
|
|
|
|
def relocatePackages = ext.relocatePackages
|
|
|
|
configurations {
|
|
customShadow
|
|
}
|
|
|
|
dependencies {
|
|
customShadow project(path: ":custom", configuration: "shadow")
|
|
customShadow project(path: ":instrumentation", configuration: "shadow")
|
|
implementation "io.opentelemetry.javaagent:opentelemetry-javaagent:${versions.opentelemetryJavaagent}"
|
|
}
|
|
|
|
CopySpec isolateSpec() {
|
|
return copySpec {
|
|
configurations.customShadow.files.each {
|
|
from(zipTree(it)) {
|
|
into("inst")
|
|
rename("(^.*)\\.class\$", "\$1.classdata")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
tasks {
|
|
shadowJar {
|
|
dependsOn ':custom:shadowJar'
|
|
dependsOn ':instrumentation:shadowJar'
|
|
with isolateSpec()
|
|
|
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
|
|
|
mergeServiceFiles {
|
|
include("inst/META-INF/services/*")
|
|
}
|
|
exclude("**/module-info.class")
|
|
|
|
relocatePackages(it)
|
|
|
|
manifest {
|
|
attributes.put("Main-Class", "io.opentelemetry.javaagent.OpenTelemetryAgent")
|
|
attributes.put("Agent-Class", "io.opentelemetry.javaagent.OpenTelemetryAgent")
|
|
attributes.put("Premain-Class", "io.opentelemetry.javaagent.OpenTelemetryAgent")
|
|
attributes.put("Can-Redefine-Classes", "true")
|
|
attributes.put("Can-Retransform-Classes", "true")
|
|
attributes.put("Implementation-Vendor", "Demo")
|
|
attributes.put("Implementation-Version", "demo-${project.version}-otel-${versions.opentelemetryJavaagent}")
|
|
}
|
|
}
|
|
|
|
assemble {
|
|
dependsOn(shadowJar)
|
|
}
|
|
} |