build.gradle 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. plugins {
  2. id("com.github.johnrengelman.shadow") version "6.0.0"
  3. }
  4. Project instr_project = project
  5. subprojects {
  6. afterEvaluate { Project subProj ->
  7. if (subProj.getPlugins().hasPlugin('java')) {
  8. // Make it so all instrumentation subproject tests can be run with a single command.
  9. instr_project.tasks.test.dependsOn(subProj.tasks.test)
  10. dependencies {
  11. compileOnly("io.opentelemetry:opentelemetry-sdk:${versions.opentelemetry}")
  12. compileOnly("io.opentelemetry.javaagent:opentelemetry-javaagent-tooling:${versions.opentelemetryJavaagent}")
  13. compileOnly deps.bytebuddy
  14. compileOnly deps.bytebuddyagent
  15. annotationProcessor deps.autoservice
  16. compileOnly deps.autoservice
  17. }
  18. instr_project.dependencies {
  19. implementation(project(subProj.getPath()))
  20. }
  21. }
  22. }
  23. }
  24. shadowJar {
  25. mergeServiceFiles()
  26. exclude '**/module-info.class'
  27. // Prevents conflict with other SLF4J instances. Important for premain.
  28. relocate 'org.slf4j', 'io.opentelemetry.javaagent.slf4j'
  29. duplicatesStrategy = DuplicatesStrategy.FAIL
  30. // rewrite library instrumentation dependencies
  31. relocate("io.opentelemetry.instrumentation", "io.opentelemetry.javaagent.shaded.instrumentation") {
  32. exclude "io.opentelemetry.javaagent.instrumentation.**"
  33. }
  34. // rewrite dependencies calling Logger.getLogger
  35. relocate 'java.util.logging.Logger', 'io.opentelemetry.javaagent.bootstrap.PatchLogger'
  36. // prevents conflict with library instrumentation
  37. relocate 'io.opentelemetry.instrumentation.api', 'io.opentelemetry.javaagent.shaded.instrumentation.api'
  38. // relocate OpenTelemetry API usage
  39. relocate "io.opentelemetry.api", "io.opentelemetry.javaagent.shaded.io.opentelemetry.api"
  40. relocate "io.opentelemetry.spi", "io.opentelemetry.javaagent.shaded.io.opentelemetry.spi"
  41. relocate "io.opentelemetry.context", "io.opentelemetry.javaagent.shaded.io.opentelemetry.context"
  42. // relocate OpenTelemetry extensions
  43. relocate "io.opentelemetry.extension.aws", "io.opentelemetry.javaagent.shaded.io.opentelemetry.extension.aws"
  44. relocate "io.opentelemetry.extension.kotlin", "io.opentelemetry.javaagent.shaded.io.opentelemetry.extension.kotlin"
  45. }