Skip to content

Commit

Permalink
Move caffeine patching to instrumentation-api-caching (#3559)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mateusz Rzeszutek authored Jul 14, 2021
1 parent 8318d5a commit c1b5c08
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 26 deletions.
15 changes: 14 additions & 1 deletion instrumentation-api-caching/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ dependencies {
shadowInclude("com.blogspot.mydailyjava:weak-lock-free")
}

// patch inner class from Caffeine to avoid ForkJoinTask from being loaded too early in the javaagent
val patch by sourceSets.creating {
java {}
}

tasks {
shadowJar {
configurations = listOf(shadowInclude)
Expand All @@ -32,7 +37,15 @@ tasks {

val extractShadowJar by registering(Copy::class) {
dependsOn(shadowJar)
from(zipTree(shadowJar.get().archiveFile))

// replace caffeine class with our patched version
from(zipTree(shadowJar.get().archiveFile)) {
exclude("io/opentelemetry/instrumentation/api/internal/shaded/caffeine/cache/BoundedLocalCache\$PerformCleanupTask.class")
}
from(patch.output) {
include("io/opentelemetry/instrumentation/api/internal/shaded/caffeine/cache/BoundedLocalCache\$PerformCleanupTask.class")
}

into("build/extracted/shadow")
// prevents empty com/github/benmanes/caffeine/cache path from ending up in instrumentation-api
includeEmptyDirs = false
Expand Down
1 change: 1 addition & 0 deletions instrumentation-api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ dependencies {
compileOnly("com.google.auto.value:auto-value-annotations")
annotationProcessor("com.google.auto.value:auto-value")

testCompileOnly(project(":instrumentation-api-caching"))
testImplementation(project(":testing-common"))
testImplementation("org.mockito:mockito-core")
testImplementation("org.mockito:mockito-junit-jupiter")
Expand Down
12 changes: 0 additions & 12 deletions javaagent-bootstrap-tests/build.gradle.kts

This file was deleted.

12 changes: 0 additions & 12 deletions javaagent-bootstrap/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,6 @@ plugins {

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")
}
}
}

dependencies {
api("io.opentelemetry:opentelemetry-api")
api("io.opentelemetry:opentelemetry-api-metrics")
Expand Down
1 change: 0 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ rootProject.name = "opentelemetry-java-instrumentation"
include(":opentelemetry-api-shaded-for-instrumenting")
include(":opentelemetry-ext-annotations-shaded-for-instrumenting")
include(":javaagent-bootstrap")
include(":javaagent-bootstrap-tests")
include(":javaagent-exporters")
include(":javaagent-extension-api")
include(":javaagent-tooling")
Expand Down

0 comments on commit c1b5c08

Please sign in to comment.