build.gradle.kts 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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.13.2,)")
  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.13.2")
  22. implementation(project(":instrumentation:log4j:log4j-2.13.2:library"))
  23. testImplementation(project(":instrumentation:log4j:log4j-2-testing"))
  24. }
  25. tasks {
  26. val testDisableThreadLocals by existing(Test::class) {
  27. jvmArgs("-Dlog4j2.is.webapp=false")
  28. jvmArgs("-Dlog4j2.enable.threadlocals=false")
  29. }
  30. // Threadlocals are always false if is.webapp is true, so we make sure to override it because as of
  31. // now testing-common includes jetty / servlet.
  32. named<Test>("test") {
  33. jvmArgs("-Dlog4j2.is.webapp=false")
  34. jvmArgs("-Dlog4j2.enable.threadlocals=true")
  35. }
  36. named("check") {
  37. dependsOn(testDisableThreadLocals)
  38. }
  39. }