build.gradle.kts 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. plugins {
  2. id("otel.javaagent-instrumentation")
  3. }
  4. // note that muzzle is not run against the current SNAPSHOT instrumentation-api, but this is ok
  5. // because the tests are run against the current SNAPSHOT instrumentation-api which will catch any
  6. // muzzle issues in SNAPSHOT instrumentation-api
  7. muzzle {
  8. pass {
  9. group.set("io.opentelemetry.instrumentation")
  10. module.set("opentelemetry-instrumentation-api")
  11. // currently all 1.0.0+ versions are alpha so they are all skipped
  12. // if you want to test them anyways, comment out "alpha" from the exclusions in AcceptableVersions.kt
  13. versions.set("[1.14.0-alpha,)")
  14. assertInverse.set(true)
  15. excludeInstrumentationModule("io.opentelemetry.javaagent.instrumentation.opentelemetryapi.OpenTelemetryApiInstrumentationModule")
  16. }
  17. }
  18. dependencies {
  19. implementation(project(":instrumentation:opentelemetry-api:opentelemetry-api-1.0:javaagent"))
  20. compileOnly(project(":opentelemetry-api-shaded-for-instrumenting", configuration = "shadow"))
  21. compileOnly(project(":opentelemetry-instrumentation-api-shaded-for-instrumenting", configuration = "shadow"))
  22. testImplementation(project(":instrumentation-api-semconv"))
  23. testImplementation(project(":instrumentation:opentelemetry-instrumentation-api:testing"))
  24. testInstrumentation(project(":instrumentation:opentelemetry-instrumentation-api:testing"))
  25. }
  26. testing {
  27. suites {
  28. val testOldServerSpan by registering(JvmTestSuite::class) {
  29. dependencies {
  30. implementation("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api-semconv")
  31. implementation("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api")
  32. implementation(project(":instrumentation:opentelemetry-instrumentation-api:testing"))
  33. }
  34. }
  35. }
  36. }
  37. configurations.configureEach {
  38. if (name.startsWith("muzzle-Assert")) {
  39. // some names also start with "muzzle-AssertFail", which is conveniently the same length
  40. val ver = name.substring("muzzle-AssertPass-io.opentelemetry.instrumentation-opentelemetry-instrumentation-api-".length)
  41. resolutionStrategy {
  42. dependencySubstitution {
  43. substitute(module("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api"))
  44. .using(module("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api:$ver"))
  45. }
  46. }
  47. }
  48. if (name.startsWith("testOldServerSpan")) {
  49. resolutionStrategy {
  50. dependencySubstitution {
  51. // version 1.13.0 contains the old ServerSpan implementation that uses SERVER_KEY context key
  52. substitute(module("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api-semconv"))
  53. .using(module("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api-semconv:1.13.0-alpha"))
  54. substitute(module("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api"))
  55. .using(module("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api:1.13.0-alpha"))
  56. }
  57. }
  58. }
  59. }
  60. tasks {
  61. check {
  62. dependsOn(testing.suites)
  63. }
  64. }