65 lines
2.4 KiB
Groovy
65 lines
2.4 KiB
Groovy
// common gradle file for instrumentation
|
|
|
|
apply plugin: 'net.bytebuddy.byte-buddy'
|
|
apply plugin: 'muzzle'
|
|
|
|
byteBuddy {
|
|
transformation {
|
|
// Applying NoOp optimizes build by applying bytebuddy plugin to only compileJava task
|
|
tasks = ['compileJava', 'compileScala', 'compileKotlin']
|
|
plugin = 'io.opentelemetry.auto.tooling.muzzle.MuzzleGradlePlugin$NoOp'
|
|
}
|
|
}
|
|
|
|
apply from: "${rootDir}/gradle/java.gradle"
|
|
|
|
tasks.withType(Test) {
|
|
forkEvery = 1
|
|
}
|
|
|
|
afterEvaluate {
|
|
byteBuddy {
|
|
transformation {
|
|
tasks = ['compileJava', 'compileScala', 'compileKotlin']
|
|
plugin = 'io.opentelemetry.auto.tooling.muzzle.MuzzleGradlePlugin'
|
|
classPath = project(':auto-tooling').configurations.instrumentationMuzzle + configurations.compile + 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(':auto-tooling')) {
|
|
// OpenTelemetry SDK is not needed for compilation, and :opentelemetry-sdk-shaded-for-testing
|
|
// is brought in for tests by project(:testing) below
|
|
exclude group: 'io.opentelemetry', module: 'opentelemetry-sdk'
|
|
}
|
|
compile deps.bytebuddy
|
|
if (jdkCompile) {
|
|
"$jdkCompile"(project(':auto-tooling')) {
|
|
// OpenTelemetry SDK is not needed for compilation, and :opentelemetry-sdk-shaded-for-testing
|
|
// is brought in for tests by project(:testing) below
|
|
exclude group: 'io.opentelemetry', module: 'opentelemetry-sdk'
|
|
}
|
|
"$jdkCompile" deps.bytebuddy
|
|
}
|
|
annotationProcessor deps.autoservice
|
|
implementation deps.autoservice
|
|
|
|
// Include instrumentations instrumenting core JDK classes tp ensure interoperability with other instrumentation
|
|
testCompile project(':instrumentation:java-concurrent')
|
|
// FIXME: we should enable this, but currently this fails tests for google http client
|
|
//testCompile project(':instrumentation:http-url-connection')
|
|
testCompile project(':instrumentation:java-class-loader')
|
|
|
|
testCompile project(':testing')
|
|
testAnnotationProcessor deps.autoservice
|
|
testImplementation deps.autoservice
|
|
}
|
|
}
|