build.gradle.kts 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. plugins {
  2. id("com.github.johnrengelman.shadow")
  3. id("otel.java-conventions")
  4. }
  5. val shadowInclude by configurations.creating {
  6. isCanBeResolved = true
  7. isCanBeConsumed = false
  8. }
  9. dependencies {
  10. compileOnly("com.github.ben-manes.caffeine:caffeine")
  11. shadowInclude("com.github.ben-manes.caffeine:caffeine") {
  12. exclude("com.google.errorprone", "error_prone_annotations")
  13. exclude("org.checkerframework", "checker-qual")
  14. }
  15. compileOnly("com.blogspot.mydailyjava:weak-lock-free")
  16. shadowInclude("com.blogspot.mydailyjava:weak-lock-free")
  17. }
  18. tasks {
  19. shadowJar {
  20. configurations = listOf(shadowInclude)
  21. relocate("com.github.benmanes.caffeine", "io.opentelemetry.instrumentation.api.internal.shaded.caffeine")
  22. relocate("com.blogspot.mydailyjava.weaklockfree", "io.opentelemetry.instrumentation.api.internal.shaded.weaklockfree")
  23. minimize()
  24. }
  25. val extractShadowJar by registering(Copy::class) {
  26. dependsOn(shadowJar)
  27. from(zipTree(shadowJar.get().archiveFile))
  28. into("build/extracted/shadow")
  29. // prevents empty com/github/benmanes/caffeine/cache path from ending up in instrumentation-api
  30. includeEmptyDirs = false
  31. }
  32. }