build.gradle.kts 2.8 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. excludeInstrumentationName("opentelemetry-api")
  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-incubator"))
  23. testImplementation(project(":instrumentation:opentelemetry-instrumentation-api:testing"))
  24. testInstrumentation(project(":instrumentation:opentelemetry-instrumentation-api:testing"))
  25. }
  26. // version 1.13.0 contains the old ServerSpan implementation that uses SERVER_KEY context key
  27. val oldServerSpanVersion = "1.13.0-alpha"
  28. testing {
  29. suites {
  30. val testOldServerSpan by registering(JvmTestSuite::class) {
  31. dependencies {
  32. implementation("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api-semconv:$oldServerSpanVersion")
  33. implementation("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api")
  34. implementation(project(":instrumentation:opentelemetry-instrumentation-api:testing"))
  35. }
  36. }
  37. }
  38. }
  39. configurations.configureEach {
  40. if (name.startsWith("muzzle-Assert")) {
  41. // some names also start with "muzzle-AssertFail", which is conveniently the same length
  42. val ver = name.substring("muzzle-AssertPass-io.opentelemetry.instrumentation-opentelemetry-instrumentation-api-".length)
  43. resolutionStrategy {
  44. dependencySubstitution {
  45. substitute(module("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api"))
  46. .using(module("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api:$ver"))
  47. }
  48. }
  49. }
  50. if (name.startsWith("testOldServerSpan")) {
  51. resolutionStrategy {
  52. dependencySubstitution {
  53. substitute(module("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api"))
  54. .using(module("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api:$oldServerSpanVersion"))
  55. }
  56. }
  57. }
  58. }
  59. tasks {
  60. check {
  61. dependsOn(testing.suites)
  62. }
  63. }