build.gradle.kts 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. }
  74. tasks.withType<Test>().configureEach {
  75. // required on jdk17
  76. jvmArgs("--add-opens=java.base/java.lang=ALL-UNNAMED")
  77. jvmArgs("-XX:+IgnoreUnrecognizedVMOptions")
  78. }
  79. // com.fasterxml.jackson.module:jackson-module-scala_2.11:2.15.2 is missing force using jackson 2.15.1
  80. // remove this when a new version of jackson is released
  81. configurations.configureEach {
  82. resolutionStrategy {
  83. eachDependency {
  84. if (requested.group == "com.fasterxml.jackson" && requested.name == "jackson-bom" && requested.version == "2.15.2") {
  85. useVersion("2.15.1")
  86. }
  87. }
  88. }
  89. }