build.gradle.kts 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. plugins {
  2. id("otel.javaagent-instrumentation")
  3. }
  4. muzzle {
  5. pass {
  6. coreJdk()
  7. }
  8. }
  9. dependencies {
  10. compileOnly("com.google.auto.value:auto-value-annotations")
  11. annotationProcessor("com.google.auto.value:auto-value")
  12. bootstrap(project(":instrumentation:rmi:bootstrap"))
  13. }
  14. // We cannot use "--release" javac option here because that will forbid importing "sun.rmi" package.
  15. // We also can't seem to use the toolchain without the "--release" option. So disable everything.
  16. java {
  17. sourceCompatibility = JavaVersion.VERSION_1_8
  18. targetCompatibility = JavaVersion.VERSION_1_8
  19. toolchain {
  20. languageVersion.set(null as JavaLanguageVersion?)
  21. }
  22. }
  23. tasks {
  24. withType<JavaCompile>().configureEach {
  25. options.release.set(null as Int?)
  26. }
  27. withType<GroovyCompile>().configureEach {
  28. options.release.set(null as Int?)
  29. }
  30. withType<Test>().configureEach {
  31. jvmArgs("-Djava.rmi.server.hostname=127.0.0.1")
  32. // Can only export on Java 9+
  33. val testJavaVersion =
  34. gradle.startParameter.projectProperties.get("testJavaVersion")?.let(JavaVersion::toVersion)
  35. ?: JavaVersion.current()
  36. if (testJavaVersion.isJava9Compatible) {
  37. jvmArgs("--add-exports=java.rmi/sun.rmi.server=ALL-UNNAMED")
  38. jvmArgs("--add-exports=java.rmi/sun.rmi.transport=ALL-UNNAMED")
  39. }
  40. }
  41. }