99 lines
		
	
	
		
			2.9 KiB
		
	
	
	
		
			Groovy
		
	
	
	
			
		
		
	
	
			99 lines
		
	
	
		
			2.9 KiB
		
	
	
	
		
			Groovy
		
	
	
	
// this project will run in isolation under the agent's classloader
 | 
						|
buildscript {
 | 
						|
 | 
						|
  repositories {
 | 
						|
    mavenCentral()
 | 
						|
  }
 | 
						|
 | 
						|
  dependencies {
 | 
						|
    classpath "net.bytebuddy:byte-buddy-gradle-plugin:${versions.bytebuddy}"
 | 
						|
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}"
 | 
						|
  }
 | 
						|
}
 | 
						|
plugins {
 | 
						|
  id "com.github.johnrengelman.shadow"
 | 
						|
}
 | 
						|
apply from: "${rootDir}/gradle/java.gradle"
 | 
						|
 | 
						|
Project instr_project = project
 | 
						|
subprojects {Project subProj ->
 | 
						|
  apply plugin: "net.bytebuddy.byte-buddy"
 | 
						|
  apply plugin: 'muzzle'
 | 
						|
 | 
						|
  subProj.byteBuddy {
 | 
						|
    transformation {
 | 
						|
      // Applying NoOp optimizes build by applying bytebuddy plugin to only compileJava task
 | 
						|
      tasks = ['compileJava', 'compileScala', 'compileKotlin']
 | 
						|
      plugin = 'datadog.trace.agent.tooling.muzzle.MuzzleGradlePlugin$NoOp'
 | 
						|
    }
 | 
						|
  }
 | 
						|
 | 
						|
  subProj.afterEvaluate {
 | 
						|
    subProj.byteBuddy {
 | 
						|
      transformation {
 | 
						|
        tasks = ['compileJava', 'compileScala', 'compileKotlin']
 | 
						|
        plugin = 'datadog.trace.agent.tooling.muzzle.MuzzleGradlePlugin'
 | 
						|
        classPath = project(':dd-java-agent:agent-tooling').configurations.instrumentationMuzzle + subProj.configurations.compile + subProj.sourceSets.main.output
 | 
						|
      }
 | 
						|
    }
 | 
						|
 | 
						|
    String jdkCompile = null
 | 
						|
    if (project.hasProperty('minJavaVersionForTests') && project.getProperty('minJavaVersionForTests') != JavaVersion.VERSION_1_7) {
 | 
						|
      def version = JavaVersion.toVersion(project.getProperty('minJavaVersionForTests'))
 | 
						|
      def name = "java$version.majorVersion"
 | 
						|
      jdkCompile = "main_${name}Compile"
 | 
						|
    }
 | 
						|
    dependencies {
 | 
						|
      // Apply common dependencies for instrumentation.
 | 
						|
      compile project(':dd-trace-api')
 | 
						|
      compile project(':dd-java-agent:agent-tooling')
 | 
						|
      compile deps.bytebuddy
 | 
						|
      compile deps.opentracing
 | 
						|
      if(jdkCompile) {
 | 
						|
        "$jdkCompile" project(':dd-trace-api')
 | 
						|
        "$jdkCompile" project(':dd-java-agent:agent-tooling')
 | 
						|
        "$jdkCompile" deps.bytebuddy
 | 
						|
        "$jdkCompile" deps.opentracing
 | 
						|
      }
 | 
						|
      annotationProcessor deps.autoservice
 | 
						|
      implementation deps.autoservice
 | 
						|
 | 
						|
      testCompile project(':dd-java-agent:testing')
 | 
						|
      testAnnotationProcessor deps.autoservice
 | 
						|
      testImplementation deps.autoservice
 | 
						|
    }
 | 
						|
 | 
						|
    // Make it so all instrumentation subproject tests can be run with a single command.
 | 
						|
    instr_project.tasks.test.dependsOn(subProj.tasks.test)
 | 
						|
  }
 | 
						|
 | 
						|
  instr_project.dependencies {
 | 
						|
    compile(project(subProj.getPath()))
 | 
						|
  }
 | 
						|
}
 | 
						|
 | 
						|
dependencies {
 | 
						|
  compile(project(':dd-java-agent:agent-tooling')) {
 | 
						|
    exclude module: ':dd-java-agent:agent-bootstrap'
 | 
						|
  }
 | 
						|
}
 | 
						|
 | 
						|
configurations {
 | 
						|
  // exclude bootstrap dependencies from shadowJar
 | 
						|
  runtime.exclude module: deps.opentracing
 | 
						|
  runtime.exclude module: deps.slf4j
 | 
						|
  runtime.exclude group: 'org.slf4j'
 | 
						|
  runtime.exclude group: 'io.opentracing'
 | 
						|
}
 | 
						|
 | 
						|
shadowJar {
 | 
						|
  dependencies {
 | 
						|
    exclude(project(':dd-java-agent:agent-bootstrap'))
 | 
						|
    exclude(project(':dd-trace-api'))
 | 
						|
  }
 | 
						|
}
 | 
						|
 | 
						|
jar {
 | 
						|
  classifier = 'unbundled'
 | 
						|
}
 |