build.gradle.kts 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. plugins {
  2. id("otel.javaagent-instrumentation")
  3. }
  4. muzzle {
  5. pass {
  6. group.set("org.springframework.kafka")
  7. module.set("spring-kafka")
  8. versions.set("[2.7.0,)")
  9. assertInverse.set(true)
  10. }
  11. }
  12. dependencies {
  13. compileOnly("com.google.auto.value:auto-value-annotations")
  14. annotationProcessor("com.google.auto.value:auto-value")
  15. bootstrap(project(":instrumentation:kafka:kafka-clients:kafka-clients-0.11:bootstrap"))
  16. bootstrap(project(":instrumentation:spring:spring-scheduling-3.1:bootstrap"))
  17. implementation(project(":instrumentation:kafka:kafka-clients:kafka-clients-common:library"))
  18. implementation(project(":instrumentation:spring:spring-kafka-2.7:library"))
  19. library("org.springframework.kafka:spring-kafka:2.7.0")
  20. testInstrumentation(project(":instrumentation:kafka:kafka-clients:kafka-clients-0.11:javaagent"))
  21. testInstrumentation(project(":instrumentation:spring:spring-scheduling-3.1:javaagent"))
  22. testImplementation(project(":instrumentation:spring:spring-kafka-2.7:testing"))
  23. testLibrary("org.springframework.boot:spring-boot-starter-test:2.5.3")
  24. testLibrary("org.springframework.boot:spring-boot-starter:2.5.3")
  25. }
  26. val latestDepTest = findProperty("testLatestDeps") as Boolean
  27. testing {
  28. suites {
  29. val testNoReceiveTelemetry by registering(JvmTestSuite::class) {
  30. dependencies {
  31. implementation(project(":instrumentation:spring:spring-kafka-2.7:testing"))
  32. // the "library" configuration is not recognized by the test suite plugin
  33. if (latestDepTest) {
  34. implementation("org.springframework.kafka:spring-kafka:+")
  35. implementation("org.springframework.boot:spring-boot-starter-test:+")
  36. implementation("org.springframework.boot:spring-boot-starter:+")
  37. } else {
  38. implementation("org.springframework.kafka:spring-kafka:2.7.0")
  39. implementation("org.springframework.boot:spring-boot-starter-test:2.5.3")
  40. implementation("org.springframework.boot:spring-boot-starter:2.5.3")
  41. }
  42. }
  43. targets {
  44. all {
  45. testTask.configure {
  46. usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service)
  47. jvmArgs("-Dotel.instrumentation.kafka.experimental-span-attributes=false")
  48. jvmArgs("-Dotel.instrumentation.messaging.experimental.receive-telemetry.enabled=false")
  49. }
  50. }
  51. }
  52. }
  53. }
  54. }
  55. tasks {
  56. test {
  57. usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service)
  58. jvmArgs("-Dotel.instrumentation.kafka.experimental-span-attributes=true")
  59. jvmArgs("-Dotel.instrumentation.messaging.experimental.receive-telemetry.enabled=true")
  60. }
  61. check {
  62. dependsOn(testing.suites)
  63. }
  64. }
  65. // spring 6 (which spring-kafka 3.+ uses) requires java 17
  66. if (latestDepTest) {
  67. otelJava {
  68. minJavaVersionSupported.set(JavaVersion.VERSION_17)
  69. }
  70. }
  71. // spring 6 uses slf4j 2.0
  72. if (!latestDepTest) {
  73. configurations {
  74. listOf(
  75. testRuntimeClasspath,
  76. named("testNoReceiveTelemetryRuntimeClasspath"),
  77. )
  78. .forEach {
  79. it.configure {
  80. resolutionStrategy {
  81. // requires old logback (and therefore also old slf4j)
  82. force("ch.qos.logback:logback-classic:1.2.11")
  83. force("org.slf4j:slf4j-api:1.7.36")
  84. }
  85. }
  86. }
  87. }
  88. }