opentelemetry-java-instrume.../dd-java-agent/instrumentation/instrumentation.gradle

70 lines
1.8 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 { 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
}
}
}
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'
}