Migrate javaagent-* to kotlin dsl (#3434)

This commit is contained in:
Anuraag Agrawal 2021-06-29 23:56:01 +09:00 committed by GitHub
parent c1a0333cdb
commit c46761b8a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 188 additions and 186 deletions

View File

@ -1,22 +0,0 @@
plugins {
id("otel.java-conventions")
id("otel.jacoco-conventions")
id("otel.publish-conventions")
}
group = 'io.opentelemetry.javaagent'
dependencies {
api "io.opentelemetry:opentelemetry-api"
compileOnly "io.opentelemetry:opentelemetry-sdk"
implementation "org.slf4j:slf4j-api"
implementation project(':instrumentation-api')
compileOnly "com.google.auto.value:auto-value-annotations"
annotationProcessor "com.google.auto.value:auto-value"
testImplementation project(':testing-common')
testImplementation "org.mockito:mockito-core"
testImplementation "org.mockito:mockito-junit-jupiter"
testImplementation "org.assertj:assertj-core"
}

View File

@ -0,0 +1,23 @@
plugins {
id("otel.java-conventions")
id("otel.jacoco-conventions")
id("otel.publish-conventions")
}
group = "io.opentelemetry.javaagent"
dependencies {
api("io.opentelemetry:opentelemetry-api")
compileOnly("io.opentelemetry:opentelemetry-sdk")
implementation(project(":instrumentation-api"))
implementation("org.slf4j:slf4j-api")
compileOnly("com.google.auto.value:auto-value-annotations")
annotationProcessor("com.google.auto.value:auto-value")
testImplementation(project(":testing-common"))
testImplementation("org.mockito:mockito-core")
testImplementation("org.mockito:mockito-junit-jupiter")
testImplementation("org.assertj:assertj-core")
}

View File

@ -5,8 +5,8 @@ plugins {
dependencies {
// For testing javaagent-bootstrap's Caffeine patch, we need to compile against our cache API
// but make sure to run against javaagent-bootstrap
testCompileOnly project(':instrumentation-api-caching')
testRuntimeOnly project(":javaagent-bootstrap")
testCompileOnly(project(":instrumentation-api-caching"))
testRuntimeOnly(project(":javaagent-bootstrap"))
testImplementation "org.assertj:assertj-core"
}
testImplementation("org.assertj:assertj-core")
}

View File

@ -1,43 +0,0 @@
plugins {
id("otel.java-conventions")
id("otel.publish-conventions")
}
group = 'io.opentelemetry.javaagent'
// patch inner class from Caffeine to avoid ForkJoinTask from being loaded too early
sourceSets {
patch {
java {}
}
}
jar {
from(sourceSets.patch.output) {
include 'io/opentelemetry/instrumentation/api/internal/shaded/caffeine/cache/BoundedLocalCache$PerformCleanupTask.class'
}
}
configurations {
// classpath used by the instrumentation muzzle plugin
instrumentationMuzzle {
canBeConsumed = true
canBeResolved = false
extendsFrom implementation
}
}
dependencies {
api "io.opentelemetry:opentelemetry-api"
api "io.opentelemetry:opentelemetry-api-metrics"
compileOnly "io.opentelemetry:opentelemetry-sdk"
implementation "org.slf4j:slf4j-api"
implementation "org.slf4j:slf4j-simple"
// ^ Generally a bad idea for libraries, but we're shadowing.
implementation project(':javaagent-api')
implementation project(':instrumentation-api')
testImplementation project(':testing-common')
testImplementation "org.mockito:mockito-core"
testImplementation "org.assertj:assertj-core"
}

View File

@ -0,0 +1,42 @@
plugins {
id("otel.java-conventions")
id("otel.publish-conventions")
}
group = "io.opentelemetry.javaagent"
// patch inner class from Caffeine to avoid ForkJoinTask from being loaded too early
val patch = sourceSets.create("patch")
patch.java {}
tasks {
named<Jar>("jar") {
from(patch.output) {
include("io/opentelemetry/instrumentation/api/internal/shaded/caffeine/cache/BoundedLocalCache\$PerformCleanupTask.class")
}
}
}
val instrumentationMuzzle by configurations.creating {
isCanBeConsumed = true
isCanBeResolved = false
extendsFrom(configurations.implementation.get())
}
dependencies {
api("io.opentelemetry:opentelemetry-api")
api("io.opentelemetry:opentelemetry-api-metrics")
compileOnly("io.opentelemetry:opentelemetry-sdk")
implementation(project(":instrumentation-api"))
implementation(project(":javaagent-api"))
implementation("org.slf4j:slf4j-api")
implementation("org.slf4j:slf4j-simple")
// ^ Generally a bad idea for libraries, but we're shadowing.
testImplementation(project(":testing-common"))
testImplementation("org.mockito:mockito-core")
testImplementation("org.assertj:assertj-core")
}

View File

@ -1,28 +0,0 @@
// Project to collect and shade exporter dependencies included in the agent's full distribution.
plugins {
id("otel.java-conventions")
id("otel.shadow-conventions")
}
dependencies {
implementation "io.opentelemetry:opentelemetry-exporter-jaeger"
implementation "io.opentelemetry:opentelemetry-exporter-otlp"
implementation "io.opentelemetry:opentelemetry-exporter-otlp-metrics"
implementation "io.opentelemetry:opentelemetry-exporter-prometheus"
implementation "io.prometheus:simpleclient"
implementation "io.prometheus:simpleclient_httpserver"
implementation "io.opentelemetry:opentelemetry-exporter-zipkin"
// TODO(anuraaga): Move version to dependency management
implementation "io.grpc:grpc-netty-shaded:1.38.0"
}
configurations {
// exclude bootstrap dependencies from shadowJar
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'
}

View File

@ -0,0 +1,29 @@
// Project to collect and shade exporter dependencies included in the agent's full distribution.
plugins {
id("otel.java-conventions")
id("otel.shadow-conventions")
}
dependencies {
implementation("io.opentelemetry:opentelemetry-exporter-jaeger")
implementation("io.opentelemetry:opentelemetry-exporter-otlp")
implementation("io.opentelemetry:opentelemetry-exporter-otlp-metrics")
implementation("io.opentelemetry:opentelemetry-exporter-prometheus")
implementation("io.prometheus:simpleclient")
implementation("io.prometheus:simpleclient_httpserver")
implementation("io.opentelemetry:opentelemetry-exporter-zipkin")
// TODO(anuraaga): Move version to dependency management
implementation("io.grpc:grpc-netty-shaded:1.38.0")
}
configurations {
implementation {
exclude("io.opentelemetry", "opentelemetry-api")
exclude("io.opentelemetry", "opentelemetry-api-metrics")
exclude("io.opentelemetry", "opentelemetry-semconv")
}
}

View File

@ -1,30 +0,0 @@
plugins {
id("otel.java-conventions")
id("otel.publish-conventions")
}
group = 'io.opentelemetry.javaagent'
configurations {
// classpath used by the instrumentation muzzle plugin
instrumentationMuzzle {
canBeConsumed = true
canBeResolved = false
extendsFrom api, implementation
}
}
dependencies {
api "io.opentelemetry:opentelemetry-sdk"
// metrics are unstable, do not expose as api
implementation "io.opentelemetry:opentelemetry-sdk-metrics"
api "net.bytebuddy:byte-buddy"
api "org.slf4j:slf4j-api"
implementation project(":instrumentation-api")
implementation project(":javaagent-api")
// TODO: ideally this module should not depend on bootstrap, bootstrap should be an internal component
implementation project(":javaagent-bootstrap")
instrumentationMuzzle sourceSets.main.output
}

View File

@ -0,0 +1,31 @@
plugins {
id("otel.java-conventions")
id("otel.publish-conventions")
}
group = "io.opentelemetry.javaagent"
val instrumentationMuzzle by configurations.creating {
isCanBeConsumed = true
isCanBeResolved = false
// TODO(anuraaga): Should be compileClasspath?
extendsFrom(configurations.api.get())
extendsFrom(configurations.implementation.get())
}
dependencies {
api("io.opentelemetry:opentelemetry-sdk")
api("net.bytebuddy:byte-buddy")
api("org.slf4j:slf4j-api")
implementation(project(":instrumentation-api"))
implementation(project(":javaagent-api"))
// TODO: ideally this module should not depend on bootstrap, bootstrap should be an internal component
implementation(project(":javaagent-bootstrap"))
// metrics are unstable, do not expose as api
implementation("io.opentelemetry:opentelemetry-sdk-metrics")
instrumentationMuzzle(sourceSets.main.get().output)
}

View File

@ -1,59 +0,0 @@
plugins {
id("otel.java-conventions")
id("otel.publish-conventions")
}
group = 'io.opentelemetry.javaagent'
configurations {
// classpath used by the instrumentation muzzle plugin
instrumentationMuzzle {
canBeConsumed = true
canBeResolved = false
extendsFrom implementation
}
}
dependencies {
// Only used during compilation by bytebuddy plugin
compileOnly "com.google.guava:guava"
implementation project(':javaagent-bootstrap')
implementation project(':javaagent-extension-api')
implementation project(':javaagent-api')
implementation project(':instrumentation-api')
implementation "io.opentelemetry:opentelemetry-api"
implementation "io.opentelemetry:opentelemetry-api-metrics"
implementation "io.opentelemetry:opentelemetry-sdk"
implementation "io.opentelemetry:opentelemetry-sdk-extension-autoconfigure"
implementation "io.opentelemetry:opentelemetry-sdk-metrics"
implementation("io.opentelemetry:opentelemetry-extension-kotlin")
implementation "io.opentelemetry:opentelemetry-extension-aws"
implementation "io.opentelemetry:opentelemetry-extension-trace-propagators"
implementation "io.opentelemetry:opentelemetry-sdk-extension-resources"
// Only the logging exporter is included in our slim distribution so we include it here.
// Other exporters are in javaagent-exporters
implementation "io.opentelemetry:opentelemetry-exporter-logging"
api "net.bytebuddy:byte-buddy"
annotationProcessor "com.google.auto.service:auto-service"
compileOnly "com.google.auto.service:auto-service"
implementation "org.slf4j:slf4j-api"
testImplementation project(':testing-common')
testImplementation "com.google.guava:guava"
testImplementation "org.assertj:assertj-core"
testImplementation "org.mockito:mockito-core"
testImplementation "org.mockito:mockito-junit-jupiter"
instrumentationMuzzle sourceSets.main.output
}
// Here we only include autoconfigure but don't include OTLP exporters to ensure they are only in
// the full distribution. We need to override the default exporter setting of OTLP as a result.
tasks.withType(Test).configureEach {
environment "OTEL_TRACES_EXPORTER", "none"
environment "OTEL_METRICS_EXPORTER", "none"
}

View File

@ -0,0 +1,59 @@
plugins {
id("otel.java-conventions")
id("otel.publish-conventions")
}
group = "io.opentelemetry.javaagent"
val instrumentationMuzzle by configurations.creating {
isCanBeConsumed = true
isCanBeResolved = false
extendsFrom(configurations.implementation.get())
}
dependencies {
// Only used during compilation by bytebuddy plugin
compileOnly("com.google.guava:guava")
implementation(project(":javaagent-bootstrap"))
implementation(project(":javaagent-extension-api"))
implementation(project(":javaagent-api"))
implementation(project(":instrumentation-api"))
implementation("io.opentelemetry:opentelemetry-api")
implementation("io.opentelemetry:opentelemetry-api-metrics")
implementation("io.opentelemetry:opentelemetry-sdk")
implementation("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure")
implementation("io.opentelemetry:opentelemetry-sdk-metrics")
implementation("io.opentelemetry:opentelemetry-extension-kotlin")
implementation("io.opentelemetry:opentelemetry-extension-aws")
implementation("io.opentelemetry:opentelemetry-extension-trace-propagators")
implementation("io.opentelemetry:opentelemetry-sdk-extension-resources")
// Only the logging exporter is included in our slim distribution so we include it here.
// Other exporters are in javaagent-exporters
implementation("io.opentelemetry:opentelemetry-exporter-logging")
api("net.bytebuddy:byte-buddy")
implementation("org.slf4j:slf4j-api")
annotationProcessor("com.google.auto.service:auto-service")
compileOnly("com.google.auto.service:auto-service")
testImplementation(project(":testing-common"))
testImplementation("com.google.guava:guava")
testImplementation("org.assertj:assertj-core")
testImplementation("org.mockito:mockito-core")
testImplementation("org.mockito:mockito-junit-jupiter")
instrumentationMuzzle(sourceSets.main.get().output)
}
// Here we only include autoconfigure but don"t include OTLP exporters to ensure they are only in
// the full distribution. We need to override the default exporter setting of OTLP as a result.
tasks {
withType<Test>().configureEach {
environment("OTEL_TRACES_EXPORTER", "none")
environment("OTEL_METRICS_EXPORTER", "none")
}
}