Migrate instrumentation/build.gradle to kotlin (#3444)

This commit is contained in:
Anuraag Agrawal 2021-06-30 19:09:13 +09:00 committed by GitHub
parent c46761b8a9
commit 92a04644d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 66 additions and 60 deletions

View File

@ -1,60 +0,0 @@
// this project will run in isolation under the agent's classloader
plugins {
id("otel.shadow-conventions")
id("otel.java-conventions")
}
Project instr_project = project
subprojects {
afterEvaluate { Project subProj ->
if (subProj.getPlugins().hasPlugin('java')) {
// Make it so all instrumentation subproject tests can be run with a single command.
instr_project.tasks.named('test').configure {
dependsOn(subProj.tasks.test)
}
if (subProj.name == 'javaagent') {
instr_project.dependencies {
implementation(project(subProj.getPath()))
}
}
}
}
}
dependencies {
compileOnly project(':instrumentation-api')
compileOnly project(':javaagent-api')
implementation project(':javaagent-tooling')
implementation project(':javaagent-extension-api')
}
configurations {
// exclude bootstrap dependencies from shadowJar
implementation.exclude group: 'org.slf4j'
implementation.exclude group: 'io.opentelemetry', module: 'opentelemetry-api'
implementation.exclude group: 'io.opentelemetry', module: 'opentelemetry-api-metrics'
implementation.exclude group: 'io.opentelemetry', module: 'opentelemetry-semconv'
}
shadowJar {
duplicatesStrategy = DuplicatesStrategy.FAIL
dependencies {
//These classes are added to bootstrap classloader by javaagent module
exclude(project(':javaagent-bootstrap'))
exclude(project(':instrumentation-api'))
exclude(project(':javaagent-api'))
}
}
tasks.register("listInstrumentations") {
group = "Help"
description = "List all available instrumentation modules"
doFirst {
subprojects
.findAll { it.plugins.hasPlugin("otel.muzzle-check") }
.collect { it.path }
.each { println it }
}
}

View File

@ -0,0 +1,66 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
// this project will run in isolation under the agent's classloader
plugins {
id("otel.shadow-conventions")
id("otel.java-conventions")
}
val instrumentationProjectTest = tasks.named("test")
val instrumentationProjectDependencies = dependencies
subprojects {
val subProj = this
plugins.withId("java") {
instrumentationProjectTest.configure {
dependsOn(subProj.tasks.named("test"))
}
}
plugins.withId("otel.javaagent-instrumentation") {
instrumentationProjectDependencies.run {
implementation(project(subProj.path))
}
}
}
dependencies {
compileOnly(project(":instrumentation-api"))
compileOnly(project(":javaagent-api"))
implementation(project(":javaagent-tooling"))
implementation(project(":javaagent-extension-api"))
}
configurations {
// exclude bootstrap dependencies from shadowJar
implementation {
exclude("org.slf4j")
exclude("io.opentelemetry", "opentelemetry-api")
exclude("io.opentelemetry", "opentelemetry-api-metrics")
exclude("io.opentelemetry", "opentelemetry-semconv")
}
}
tasks {
named<ShadowJar>("shadowJar") {
duplicatesStrategy = DuplicatesStrategy.FAIL
dependencies {
//These classes are added to bootstrap classloader by javaagent module
exclude(project(":javaagent-bootstrap"))
exclude(project(":instrumentation-api"))
exclude(project(":javaagent-api"))
}
}
register("listInstrumentations") {
group = "Help"
description = "List all available instrumentation modules"
doFirst {
subprojects
.filter { it.plugins.hasPlugin("otel.muzzle-check") }
.map { it.path }
.forEach { println(it) }
}
}
}