100 lines
2.9 KiB
Groovy
100 lines
2.9 KiB
Groovy
plugins {
|
|
id "com.github.johnrengelman.shadow" version "2.0.4"
|
|
}
|
|
|
|
description = 'dd-java-agent'
|
|
|
|
apply from: "${rootDir}/gradle/java.gradle"
|
|
apply from: "${rootDir}/gradle/publish.gradle"
|
|
apply from: "${rootDir}/gradle/jacoco.gradle"
|
|
jacocoTestReport.dependsOn ':dd-java-agent-ittests:test'
|
|
|
|
whitelistedInstructionClasses += whitelistedBranchClasses += [
|
|
'datadog.agent.*',
|
|
'datadog.agent.decorators.*',
|
|
]
|
|
|
|
/*
|
|
* Include subproject's shadowJar in the dd-java-agent jar.
|
|
* Note jarname must end in .zip, or its classes will be on the classpath of
|
|
* the dd-java-agent jar.
|
|
*/
|
|
def includeShadowJar(subproject, jarname) {
|
|
def agent_project = project
|
|
subproject.afterEvaluate {
|
|
agent_project.processResources {
|
|
from(subproject.tasks.shadowJar)
|
|
rename {
|
|
it.equals(subproject.shadowJar.archivePath.getName()) ?
|
|
jarname :
|
|
it
|
|
}
|
|
}
|
|
agent_project.processResources.dependsOn subproject.tasks.shadowJar
|
|
subproject.shadowJar {
|
|
classifier null
|
|
|
|
mergeServiceFiles()
|
|
|
|
dependencies {
|
|
exclude(dependency('org.projectlombok:lombok:1.16.20'))
|
|
}
|
|
|
|
// Prevents conflict with other SLF4J instances. Important for premain.
|
|
relocate 'org.slf4j', 'datadog.slf4j'
|
|
// rewrite dependencies calling Logger.getLogger
|
|
relocate 'java.util.logging.Logger', 'datadog.trace.bootstrap.PatchLogger'
|
|
|
|
if (!project.hasProperty("disableShadowRelocate") || !disableShadowRelocate) {
|
|
relocate 'datadog.trace.common', 'datadog.trace.agent.common'
|
|
relocate 'datadog.opentracing', 'datadog.trace.agent.ot'
|
|
|
|
relocate 'io.opentracing.contrib', 'datadog.trace.agent.opentracing.contrib'
|
|
|
|
relocate 'org.yaml', 'datadog.trace.agent.deps.yaml'
|
|
relocate 'org.msgpack', 'datadog.trace.agent.deps.msgpack'
|
|
relocate 'com.fasterxml', 'datadog.trace.agent.deps.fasterxml'
|
|
|
|
relocate 'net.bytebuddy', 'datadog.trace.agent.deps.bytebuddy'
|
|
relocate('com.google', 'datadog.trace.agent.deps.google') {
|
|
// This is used in the Cassandra Cluster.connectAsync signature so we can't relocate it. :fingers_crossed:
|
|
exclude 'com.google.common.util.concurrent.ListenableFuture'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
includeShadowJar(project(':dd-java-agent:agent-bootstrap'), 'agent-bootstrap.jar.zip')
|
|
includeShadowJar(project(':dd-java-agent:instrumentation'), 'agent-tooling-and-instrumentation.jar.zip')
|
|
|
|
|
|
jar {
|
|
classifier = 'unbundled'
|
|
|
|
manifest {
|
|
attributes(
|
|
"Main-Class": "datadog.trace.agent.TracingAgent",
|
|
"Agent-Class": "datadog.trace.agent.TracingAgent",
|
|
"Premain-Class": "datadog.trace.agent.TracingAgent",
|
|
"Can-Redefine-Classes": true,
|
|
"Can-Retransform-Classes": true,
|
|
)
|
|
}
|
|
}
|
|
|
|
shadowJar {
|
|
classifier null
|
|
|
|
mergeServiceFiles()
|
|
|
|
dependencies {
|
|
exclude(dependency('org.projectlombok:lombok:1.16.20'))
|
|
}
|
|
}
|
|
|
|
// We don't want bundled dependencies to show up in the pom.
|
|
modifyPom {
|
|
dependencies.removeAll { true }
|
|
}
|