Move helpers to a separate project for future bundling
This will allow us to eventually inject these classes in the correct classpath rather than having them on the system classpath.
MODIFY
dd-java-agent/dd-java-agent.gradle
dd-java-agent/dd-java-agent.gradle
@@ -24,6 +24,9 @@ whitelistedInstructionClasses += whitelistedBranchClasses += [
dependencies {
compile project(':dd-trace')
compile project(':dd-trace-annotations')
+ compile(project(path: ':dd-java-agent:integrations:helpers', configuration: "shadow")) {
+ transitive = false
+ }
compile group: 'io.opentracing.contrib', name: 'opentracing-agent', version: '0.1.0'
compile group: 'org.reflections', name: 'reflections', version: '0.9.11'
@@ -33,50 +36,18 @@ dependencies {
compile group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.25'
// ^ Generally a bad idea for libraries, but we're shadowing.
-
- 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-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: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
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'
// Not bundled in with the agent. Usage requires being on the app's classpath (eg. Spring Boot's executable jar)
compileOnly group: 'io.opentracing.contrib', name: 'opentracing-jdbc', version: '0.0.3'
}
+project(':dd-java-agent:integrations:helpers').afterEvaluate { helperProject ->
+ project.compileJava.dependsOn helperProject.tasks.shadowJar
+}
+
jar {
classifier = 'unbundled'

ADD
dd-java-agent/integrations/helpers/helpers.gradle
+apply plugin: "com.github.johnrengelman.shadow"
+apply from: "${rootDir}/gradle/java.gradle"
+
+// We want to keep this jar as lean as possible. Only helpers and OT contrib classes.
+configurations.compile {
+ transitive = false
+}
+
+dependencies {
+ compileOnly project(':dd-trace')
+ compileOnly project(':dd-trace-annotations')
+ compileOnly group: 'org.slf4j', name: 'slf4j-api', version: '1.7.25'
+
+ compileOnly group: 'io.opentracing.contrib', name: 'opentracing-agent', version: '0.1.0'
+
+ compile group: 'io.opentracing.contrib', name: 'opentracing-web-servlet-filter', version: '0.0.9'
+ compile group: 'io.opentracing.contrib', name: 'opentracing-mongo-driver', version: '0.0.3'
+ compile group: 'io.opentracing.contrib', name: 'opentracing-okhttp3', version: '0.0.5'
+ compile group: 'io.opentracing.contrib', name: 'opentracing-jms-common', version: '0.0.3'
+ compile group: 'io.opentracing.contrib', name: 'opentracing-jms-2', version: '0.0.3'
+ compile group: 'io.opentracing.contrib', name: 'opentracing-aws-sdk', version: '0.0.2'
+ compile group: 'io.opentracing.contrib', name: 'opentracing-cassandra-driver', version: '0.0.2'
+ compile group: 'io.opentracing.contrib', name: 'opentracing-apache-httpclient', version: '0.0.2'
+
+ compileOnly group: 'org.eclipse.jetty', name: 'jetty-util', version: '9.3.6.v20151106'
+ compileOnly group: 'org.eclipse.jetty', name: 'jetty-server', version: '9.3.6.v20151106'
+ 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-core', 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'
+}
+
+shadowJar {
+ classifier null
+ configurations = [project.configurations.compile]
+
+ dependencies {
+ exclude(dependency('org.projectlombok:lombok:1.16.18'))
+ }
+}

RENAME
dd-java-agent/src/main/java/com/datadoghq/trace/agent/integration/AWSClientHelper.java
dd-java-agent/integrations/helpers/src/main/java/com/datadoghq/trace/agent/integration/AWSClientHelper.java
RENAME
dd-java-agent/src/main/java/com/datadoghq/trace/agent/integration/ApacheHTTPClientHelper.java
dd-java-agent/integrations/helpers/src/main/java/com/datadoghq/trace/agent/integration/ApacheHTTPClientHelper.java
RENAME
dd-java-agent/src/main/java/com/datadoghq/trace/agent/integration/CassandraHelper.java
dd-java-agent/integrations/helpers/src/main/java/com/datadoghq/trace/agent/integration/CassandraHelper.java
RENAME
dd-java-agent/src/main/java/com/datadoghq/trace/agent/integration/DDAgentTracingHelper.java
dd-java-agent/integrations/helpers/src/main/java/com/datadoghq/trace/agent/integration/DDAgentTracingHelper.java
RENAME
dd-java-agent/src/main/java/com/datadoghq/trace/agent/integration/JMSMessageConsumerHelper.java
dd-java-agent/integrations/helpers/src/main/java/com/datadoghq/trace/agent/integration/JMSMessageConsumerHelper.java
RENAME
dd-java-agent/src/main/java/com/datadoghq/trace/agent/integration/JMSMessageProducerHelper.java
dd-java-agent/integrations/helpers/src/main/java/com/datadoghq/trace/agent/integration/JMSMessageProducerHelper.java
RENAME
dd-java-agent/src/main/java/com/datadoghq/trace/agent/integration/JettyServletHelper.java
dd-java-agent/integrations/helpers/src/main/java/com/datadoghq/trace/agent/integration/JettyServletHelper.java
RENAME
dd-java-agent/src/main/java/com/datadoghq/trace/agent/integration/MongoHelper.java
dd-java-agent/integrations/helpers/src/main/java/com/datadoghq/trace/agent/integration/MongoHelper.java
RENAME
dd-java-agent/src/main/java/com/datadoghq/trace/agent/integration/OkHttpHelper.java
dd-java-agent/integrations/helpers/src/main/java/com/datadoghq/trace/agent/integration/OkHttpHelper.java
RENAME
dd-java-agent/src/main/java/com/datadoghq/trace/agent/integration/TomcatServletHelper.java
dd-java-agent/integrations/helpers/src/main/java/com/datadoghq/trace/agent/integration/TomcatServletHelper.java
RENAME
dd-java-agent/src/main/java/io/opentracing/contrib/mongo/TracingCommandListenerFactory.java
dd-java-agent/integrations/helpers/src/main/java/io/opentracing/contrib/mongo/TracingCommandListenerFactory.java
MODIFY
settings.gradle
settings.gradle
@@ -11,6 +11,7 @@ include ':dd-trace-examples'
include ':dd-trace-annotations'
// integrations:
+include ':dd-java-agent:integrations:helpers'
include ':dd-java-agent:integrations:apache-httpclient'
include ':dd-java-agent:integrations:aws-sdk'
include ':dd-java-agent:integrations:cassandra'

Move helpers to a separate project for future bundling

This will allow us to eventually inject these classes in the correct classpath rather than having them on the system classpath.