123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- plugins {
- id "com.github.johnrengelman.shadow" version "2.0.1"
- }
- 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 += [
- 'com.datadoghq.agent.*',
- 'com.datadoghq.agent.integration.*',
- 'io.opentracing.contrib.*',
- 'dd.opentracing.contrib.*',
- ]
- dependencies {
- compile project(':dd-trace')
- compile project(':dd-java-agent:tooling')
- compile project(':dd-trace-annotations')
- compile(project(':dd-java-agent:integrations:apache-httpclient-4.3')) {
- transitive = false
- }
- compile(project(':dd-java-agent:integrations:aws-sdk')) {
- transitive = false
- }
- compile(project(':dd-java-agent:integrations:datastax-cassandra-3.2')) {
- transitive = false
- }
- compile(project(':dd-java-agent:integrations:jms-1')) {
- transitive = false
- }
- compile(project(':dd-java-agent:integrations:jms-2')) {
- transitive = false
- }
- compile(project(':dd-java-agent:integrations:mongo-3.1')) {
- transitive = false
- }
- compile(project(':dd-java-agent:integrations:mongo-async-3.3')) {
- transitive = false
- }
- compile(project(':dd-java-agent:integrations:okhttp-3')) {
- transitive = false
- }
- compile(project(':dd-java-agent:integrations:servlet-2')) {
- transitive = false
- }
- compile(project(':dd-java-agent:integrations:servlet-3')) {
- transitive = false
- }
- compile(project(':dd-java-agent:integrations:spring-web')) {
- transitive = false
- }
- compile deps.bytebuddy
- compile deps.autoservice
- compile deps.slf4j
- compile group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.25'
- // ^ Generally a bad idea for libraries, but we're shadowing.
- testCompile deps.opentracingMock
- testCompile(project(path: ':dd-java-agent:integrations:helpers')) {
- transitive = false
- }
- }
- project(':dd-java-agent:integrations:helpers').afterEvaluate { helperProject ->
- project.processResources {
- from(helperProject.tasks.shadowJar)
- rename {
- it.startsWith("helpers") && it.endsWith(".jar") ?
- "helpers.jar.zip" :
- it
- }
- }
- project.processResources.dependsOn helperProject.tasks.shadowJar
- }
- jar {
- classifier = 'unbundled'
- manifest {
- attributes(
- "Main-Class": "com.datadoghq.agent.DDJavaAgentInfo",
- // I don't think we want to define this since we can't really load after startup:
- //"Agent-Class": "com.datadoghq.trace.agent.TracingAgent",
- "Premain-Class": "com.datadoghq.agent.TracingAgent",
- "Can-Redefine-Classes": true,
- "Can-Retransform-Classes": true,
- )
- }
- }
- shadowJar {
- classifier null
- mergeServiceFiles() // This triggers shadow to also apply the relocate rules below to the service files.
- relocate 'org.slf4j', 'dd.slf4j' // Prevents conflict with other SLF4J instances. Important for premain.
- if (!project.hasProperty("disableShadowRelocate") || !disableShadowRelocate) {
- // These need to be relocated to prevent conflicts in case the regular dd-trace is already on the classpath.
- relocate('com.datadoghq.trace', 'com.datadoghq.agent.tracer') {
- // We want to ensure to not miss if a user is using the annotation.
- exclude 'com.datadoghq.trace.Trace'
- }
- relocate 'io.opentracing.contrib', 'dd.opentracing.contrib'
- relocate 'org.yaml', 'dd.deps.org.yaml'
- relocate 'org.msgpack', 'dd.deps.org.msgpack'
- relocate 'com.fasterxml', 'dd.deps.com.fasterxml'
- relocate 'net.bytebuddy', 'dd.deps.net.bytebuddy'
- relocate('com.google', 'dd.deps.com.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'
- }
- }
- dependencies {
- exclude(dependency('org.projectlombok:lombok:1.16.18'))
- }
- }
- // We don't want bundled dependencies to show up in the pom.
- modifyPom {
- dependencies.removeAll { true }
- }
|