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.trace.agent.integration.*", 'com.datadoghq.trace.agent.AnnotationsTracingAgent', 'com.datadoghq.trace.agent.AgentTracerConfig', 'com.datadoghq.trace.agent.TraceAnnotationsManager', 'com.datadoghq.trace.agent.InstrumentationChecker', 'com.datadoghq.trace.agent.DDJavaAgentInfo', 'io.opentracing.contrib.mongo.TracingCommandListenerFactory', 'com.datadoghq.trace.agent.InstrumentationChecker.1', 'com.datadoghq.trace.agent.InstrumentationChecker.ArtifactSupport', ] dependencies { compile project(':dd-trace') compile project(':dd-trace-annotations') compile group: 'io.opentracing.contrib', name: 'opentracing-agent', version: '0.1.0' compile group: 'org.reflections', name: 'reflections', version: '0.9.11' compile group: 'com.google.auto.service', name: 'auto-service', version: '1.0-rc3' compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.25' compile(group: 'io.opentracing.contrib', name: 'opentracing-web-servlet-filter', version: '0.0.9') { exclude(group: 'org.eclipse.jetty', module: 'jetty-servlet') } compile(group: 'io.opentracing.contrib', name: 'opentracing-mongo-driver', version: '0.0.3') { exclude(group: 'org.mongodb', module: 'mongodb-driver-async') exclude(group: 'org.mongodb', module: 'mongo-java-driver') } compile group: 'io.opentracing.contrib', name: 'opentracing-jdbc', version: '0.0.2' compile(group: 'io.opentracing.contrib', name: 'opentracing-okhttp3', version: '0.0.5') { exclude(group: 'com.squareup.okhttp3', module: 'okhttp') } compile(group: 'io.opentracing.contrib', name: 'opentracing-jms-2', version: '0.0.3') { exclude(group: 'javax.jms', module: 'javax.jms-api') } compile(group: 'io.opentracing.contrib', name: 'opentracing-aws-sdk', version: '0.0.2') { exclude(group: 'com.amazonaws', module: 'aws-java-sdk') } compile(group: 'io.opentracing.contrib', name: 'opentracing-cassandra-driver', version: '0.0.2') { exclude(group: 'com.datastax.cassandra', module: 'cassandra-driver-core') } compile(group: 'io.opentracing.contrib', name: 'opentracing-apache-httpclient', version: '0.0.2') { exclude(group: 'org.apache.httpcomponents', module: 'httpclient') } testCompile group: 'org.mongodb', name: 'mongo-java-driver', version: '3.4.2' testCompile group: 'io.opentracing', name: 'opentracing-mock', version: '0.30.0' testCompile group: 'junit', name: 'junit', version: '4.12' testCompile group: 'org.assertj', name: 'assertj-core', version: '3.6.2' testCompile group: 'org.mockito', name: 'mockito-core', version: '2.7.22' testCompile group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3' compileOnly group: 'org.eclipse.jetty', name: 'jetty-servlet', version: '9.3.6.v20151106' compileOnly group: 'org.apache.tomcat.embed', name: 'tomcat-embed-core', version: '9.0.0.M1' compileOnly group: 'org.mongodb', name: 'mongo-java-driver', version: '3.4.2' compileOnly group: 'org.mongodb', name: 'mongodb-driver-async', version: '3.4.2' compileOnly group: 'com.squareup.okhttp3', name: 'okhttp', version: '3.6.0' compileOnly group: 'javax.jms', name: 'javax.jms-api', version: '2.0.1' compileOnly group: 'com.amazonaws', name: 'aws-java-sdk', version: '1.11.119' compileOnly group: 'com.datastax.cassandra', name: 'cassandra-driver-core', version: '3.2.0' compileOnly group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.3' } jar { classifier = 'unbundled' manifest { attributes( // I don't think we want to define this since we can't really load after startup: //"Agent-Class": "com.datadoghq.trace.agent.AnnotationsTracingAgent", "Premain-Class": "com.datadoghq.trace.agent.AnnotationsTracingAgent", "Can-Redefine-Classes": true, "Can-Retransform-Classes": true, // It is dangerous putting everything on the bootstrap classpath, // but kept for consistency with previous versions. "Boot-Class-Path": "./${jar.archiveName}.jar" ) } } shadowJar { classifier null // mergeServiceFiles() // Don't relocate slf4j or opentracing deps. relocate 'com.fasterxml', 'dd.deps.com.fasterxml' relocate 'javassist', 'dd.deps.javassist' relocate 'org.reflections', 'dd.deps.org.reflections' relocate 'org.yaml', 'dd.deps.org.yaml' relocate('org.jboss.byteman', 'dd.deps.org.jboss.byteman') { // Renaming these causes a verify error in the tests. exclude 'org.jboss.byteman.rule.*' exclude 'org.jboss.byteman.rule.helper.*' } 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' } //Exclude Java 9 compiled classes: exclude 'org/jboss/byteman/agent/JigsawAccessEnablerGenerator.class' exclude 'org/jboss/byteman/agent/JigsawAccessManager$1.class' exclude 'org/jboss/byteman/agent/JigsawAccessManager.class' exclude 'org/jboss/byteman/layer/LayerFactory.class' exclude 'org/jboss/byteman/layer/LayerModuleFinder$1.class' exclude 'org/jboss/byteman/layer/LayerModuleFinder.class' exclude 'org/jboss/byteman/layer/LayerModuleReader.class' exclude 'org/jboss/byteman/layer/LayerModuleReference.class' 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 } }