100 lines
		
	
	
		
			3.1 KiB
		
	
	
	
		
			Groovy
		
	
	
	
			
		
		
	
	
			100 lines
		
	
	
		
			3.1 KiB
		
	
	
	
		
			Groovy
		
	
	
	
| 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 += [
 | |
|   'datadog.agent.*',
 | |
|   'datadog.agent.decorators.*',
 | |
|   'io.opentracing.contrib.*',
 | |
|   'dd.opentracing.contrib.*',
 | |
| ]
 | |
| 
 | |
| dependencies {
 | |
|   compile project(':dd-trace-ot')
 | |
|   compile project(':dd-java-agent:tooling')
 | |
|   compile project(':dd-trace-api')
 | |
| 
 | |
|   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
 | |
| }
 | |
| // add all subprojects under 'instrumentation' to the agent's dependencies
 | |
| Project java_agent_project = project
 | |
| subprojects { subProj ->
 | |
|   if (subProj.getPath().startsWith(java_agent_project.getPath() + ':instrumentation:')) {
 | |
|     java_agent_project.dependencies {
 | |
|       compile(project(subProj.getPath()))
 | |
|     }
 | |
|   }
 | |
| }
 | |
| 
 | |
| jar {
 | |
|   classifier = 'unbundled'
 | |
| 
 | |
|   manifest {
 | |
|     attributes(
 | |
|       "Main-Class": "datadog.trace.agent.DDJavaAgentInfo",
 | |
|       "Agent-Class": "datadog.trace.agent.TracingAgent",
 | |
|       "Premain-Class": "datadog.trace.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', 'datadog.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('datadog.trace.api', 'datadog.trace.agent.api') {
 | |
|       // We want to ensure to not miss if a user is using the annotation.
 | |
|       exclude 'datadog.trace.api.Trace'
 | |
|     }
 | |
|     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'
 | |
|     }
 | |
| 
 | |
|     // rewrite dependencies calling Logger.getLogger
 | |
|     relocate 'java.util.logging.Logger', 'datadog.trace.agent.PatchLogger'
 | |
|   }
 | |
| 
 | |
|   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 }
 | |
| }
 |