build.gradle.kts 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import java.time.Duration
  2. plugins {
  3. id("idea")
  4. id("com.github.ben-manes.versions")
  5. id("io.github.gradle-nexus.publish-plugin")
  6. id("otel.spotless-conventions")
  7. }
  8. apply(from = "version.gradle.kts")
  9. nexusPublishing {
  10. packageGroup.set("io.opentelemetry")
  11. repositories {
  12. sonatype {
  13. username.set(System.getenv("SONATYPE_USER"))
  14. password.set(System.getenv("SONATYPE_KEY"))
  15. }
  16. }
  17. connectTimeout.set(Duration.ofMinutes(5))
  18. clientTimeout.set(Duration.ofMinutes(5))
  19. transitionCheckOptions {
  20. // We have many artifacts so Maven Central takes a long time on its compliance checks. This sets
  21. // the timeout for waiting for the repository to close to a comfortable 50 minutes.
  22. maxRetries.set(300)
  23. delayBetween.set(Duration.ofSeconds(10))
  24. }
  25. }
  26. description = "OpenTelemetry instrumentations for Java"
  27. // total of 4 partitions (see modulo 4 below)
  28. var testPartition = (project.findProperty("testPartition") as String?)?.toInt()
  29. if (testPartition != null) {
  30. var testPartitionCounter = 0
  31. subprojects {
  32. // relying on predictable ordering of subprojects
  33. // (see https://docs.gradle.org/current/dsl/org.gradle.api.Project.html#N14CB4)
  34. // since we are splitting these tasks across different github action jobs
  35. val enabled = testPartitionCounter++ % 4 == testPartition
  36. tasks.withType<Test>().configureEach {
  37. this.enabled = enabled
  38. }
  39. }
  40. }