build.gradle.kts 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. plugins {
  2. id("otel.javaagent-instrumentation")
  3. id("org.unbroken-dome.test-sets")
  4. }
  5. muzzle {
  6. pass {
  7. group.set("org.apache.logging.log4j")
  8. module.set("log4j-core")
  9. versions.set("[2.16.0,)")
  10. assertInverse.set(true)
  11. }
  12. }
  13. testSets {
  14. // Very different codepaths when threadlocals are enabled or not so we check both.
  15. // Regression test for https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/2403
  16. create("testDisableThreadLocals") {
  17. dirName = "test"
  18. }
  19. }
  20. dependencies {
  21. library("org.apache.logging.log4j:log4j-core:2.16.0")
  22. implementation(project(":instrumentation:log4j:log4j-context-data:log4j-context-data-2.16:library-autoconfigure"))
  23. testInstrumentation(project(":instrumentation:log4j:log4j-context-data:log4j-context-data-2.7:javaagent"))
  24. testImplementation(project(":instrumentation:log4j:log4j-context-data:log4j-context-data-2-common:testing"))
  25. }
  26. tasks {
  27. val testDisableThreadLocals by existing(Test::class) {
  28. jvmArgs("-Dlog4j2.is.webapp=false")
  29. jvmArgs("-Dlog4j2.enable.threadlocals=false")
  30. }
  31. // Threadlocals are always false if is.webapp is true, so we make sure to override it because as of
  32. // now testing-common includes jetty / servlet.
  33. test {
  34. jvmArgs("-Dlog4j2.is.webapp=false")
  35. jvmArgs("-Dlog4j2.enable.threadlocals=true")
  36. }
  37. named("check") {
  38. dependsOn(testDisableThreadLocals)
  39. }
  40. }