build.gradle.kts 2.5 KB

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