build.gradle.kts 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. plugins {
  2. id("otel.javaagent-instrumentation")
  3. id("otel.scala-conventions")
  4. }
  5. muzzle {
  6. // There are some weird library issues below 2.9 so can't assert inverse
  7. pass {
  8. group.set("com.twitter")
  9. module.set("finatra-http_2.11")
  10. versions.set("[2.9.0,]")
  11. excludeDependency("io.netty:netty-transport-native-epoll")
  12. }
  13. pass {
  14. group.set("com.twitter")
  15. module.set("finatra-http_2.12")
  16. versions.set("[2.9.0,]")
  17. excludeDependency("io.netty:netty-transport-native-epoll")
  18. }
  19. }
  20. // Test suites don't allow excluding transitive dependencies. We use this configuration to declare
  21. // dependency to latest finatra and exclude netty-transport-native-epoll.
  22. val finatraLatest by configurations.creating {
  23. isCanBeConsumed = false
  24. isCanBeResolved = false
  25. }
  26. dependencies {
  27. // TODO(anuraaga): Something about library configuration doesn't work well with scala compilation
  28. // here.
  29. compileOnly("com.twitter:finatra-http_2.11:2.9.0")
  30. testInstrumentation(project(":instrumentation:netty:netty-4.1:javaagent"))
  31. testImplementation(enforcedPlatform("com.fasterxml.jackson:jackson-bom:2.9.10"))
  32. testImplementation("com.twitter:finatra-http_2.11:19.12.0") {
  33. // Finatra POM references linux-aarch64 version of this which we don't need. Including it
  34. // prevents us from managing Netty version because the classifier name changed to linux-aarch_64
  35. // in recent releases. So we exclude and force the linux-x86_64 classifier instead.
  36. exclude("io.netty", "netty-transport-native-epoll")
  37. }
  38. testImplementation("io.netty:netty-transport-native-epoll:4.1.51.Final:linux-x86_64")
  39. // Required for older versions of finatra on JDKs >= 11
  40. testImplementation("com.sun.activation:javax.activation:1.2.0")
  41. finatraLatest("com.twitter:finatra-http_2.13:+") {
  42. exclude("io.netty", "netty-transport-native-epoll")
  43. }
  44. }
  45. testing {
  46. suites {
  47. val latestDepTest by registering(JvmTestSuite::class) {
  48. dependencies {
  49. // finatra is included via finatraLatest configuation
  50. implementation("io.netty:netty-transport-native-epoll:4.1.51.Final:linux-x86_64")
  51. }
  52. }
  53. }
  54. }
  55. configurations {
  56. named("latestDepTestImplementation") {
  57. extendsFrom(configurations["finatraLatest"])
  58. }
  59. }
  60. tasks {
  61. if (findProperty("testLatestDeps") as Boolean) {
  62. // Separate task
  63. named("test") {
  64. enabled = false
  65. }
  66. named("compileTestScala") {
  67. enabled = false
  68. }
  69. check {
  70. dependsOn(testing.suites)
  71. }
  72. }
  73. withType<Test>().configureEach {
  74. // required on jdk17
  75. jvmArgs("--add-opens=java.base/java.lang=ALL-UNNAMED")
  76. jvmArgs("-XX:+IgnoreUnrecognizedVMOptions")
  77. jvmArgs("-Dotel.instrumentation.common.experimental.controller-telemetry.enabled=true")
  78. }
  79. }