build.gradle.kts 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. plugins {
  2. id("otel.library-instrumentation")
  3. id("org.graalvm.buildtools.native")
  4. }
  5. dependencies {
  6. compileOnly(project(":muzzle"))
  7. // pin the version strictly to avoid overriding by dependencyManagement versions
  8. compileOnly("ch.qos.logback:logback-classic") {
  9. version {
  10. // compiling against newer version than the earliest supported version (1.0.0) to support
  11. // features added in 1.3.0
  12. strictly("1.3.0")
  13. }
  14. }
  15. compileOnly("org.slf4j:slf4j-api") {
  16. version {
  17. strictly("2.0.0")
  18. }
  19. }
  20. if (findProperty("testLatestDeps") as Boolean) {
  21. testImplementation("ch.qos.logback:logback-classic:+")
  22. } else {
  23. testImplementation("ch.qos.logback:logback-classic") {
  24. version {
  25. strictly("1.0.0")
  26. }
  27. }
  28. testImplementation("org.slf4j:slf4j-api") {
  29. version {
  30. strictly("1.6.4")
  31. }
  32. }
  33. }
  34. testImplementation("io.opentelemetry:opentelemetry-sdk-testing")
  35. }
  36. graalvmNative {
  37. binaries.all {
  38. resources.autodetect()
  39. // Workaround for https://github.com/junit-team/junit5/issues/3405
  40. buildArgs.add("--initialize-at-build-time=org.junit.platform.launcher.core.LauncherConfig")
  41. buildArgs.add("--initialize-at-build-time=org.junit.jupiter.engine.config.InstantiatingConfigurationParameterConverter")
  42. }
  43. // See https://github.com/graalvm/native-build-tools/issues/572
  44. metadataRepository {
  45. enabled.set(false)
  46. }
  47. toolchainDetection.set(false)
  48. }
  49. // To be able to execute the tests as GraalVM native executables
  50. configurations.configureEach {
  51. exclude("org.apache.groovy", "groovy")
  52. exclude("org.apache.groovy", "groovy-json")
  53. exclude("org.spockframework", "spock-core")
  54. }
  55. val latestDepTest = findProperty("testLatestDeps") as Boolean
  56. testing {
  57. suites {
  58. val slf4j2ApiTest by registering(JvmTestSuite::class) {
  59. dependencies {
  60. implementation(project(":instrumentation:logback:logback-appender-1.0:library"))
  61. implementation("io.opentelemetry:opentelemetry-sdk-testing")
  62. if (latestDepTest) {
  63. implementation("ch.qos.logback:logback-classic:+")
  64. implementation("org.slf4j:slf4j-api:+")
  65. } else {
  66. implementation("ch.qos.logback:logback-classic") {
  67. version {
  68. strictly("1.3.0")
  69. }
  70. }
  71. implementation("org.slf4j:slf4j-api") {
  72. version {
  73. strictly("2.0.0")
  74. }
  75. }
  76. }
  77. }
  78. }
  79. }
  80. }
  81. tasks {
  82. check {
  83. dependsOn(testing.suites)
  84. }
  85. }
  86. tasks.withType<Test>().configureEach {
  87. jvmArgs("-Dotel.instrumentation.common.experimental.controller-telemetry.enabled=true")
  88. }