|
| 1 | +group = "io.opentelemetry.example" |
| 2 | +version = "1.0-SNAPSHOT" |
| 3 | + |
| 4 | +buildscript { |
| 5 | + repositories { |
| 6 | + maven { |
| 7 | + url = uri("https://plugins.gradle.org/m2/") |
| 8 | + } |
| 9 | + maven { |
| 10 | + name = "sonatype" |
| 11 | + url = uri("https://central.sonatype.com/repository/maven-snapshots/") |
| 12 | + } |
| 13 | + } |
| 14 | + dependencies { |
| 15 | + classpath("com.diffplug.spotless:spotless-plugin-gradle:8.1.0") |
| 16 | + classpath("com.gradleup.shadow:shadow-gradle-plugin:9.3.1") |
| 17 | + classpath("io.opentelemetry.instrumentation:gradle-plugins:2.24.0-alpha-SNAPSHOT") |
| 18 | + } |
| 19 | +} |
| 20 | + |
| 21 | +subprojects { |
| 22 | + version = rootProject.version |
| 23 | + |
| 24 | + apply(plugin = "java") |
| 25 | + apply(plugin = "com.diffplug.spotless") |
| 26 | + |
| 27 | + val versions = mapOf( |
| 28 | + // this line is managed by .github/scripts/update-sdk-version.sh |
| 29 | + "opentelemetrySdk" to "1.57.0", |
| 30 | + |
| 31 | + // these lines are managed by .github/scripts/update-version.sh |
| 32 | + "opentelemetryJavaagent" to "2.24.0-SNAPSHOT", |
| 33 | + "opentelemetryJavaagentAlpha" to "2.24.0-alpha-SNAPSHOT", |
| 34 | + |
| 35 | + "autoservice" to "1.1.1" |
| 36 | + ) |
| 37 | + |
| 38 | + val deps = mapOf( |
| 39 | + "autoservice" to listOf( |
| 40 | + "com.google.auto.service:auto-service:${versions["autoservice"]}", |
| 41 | + "com.google.auto.service:auto-service-annotations:${versions["autoservice"]}" |
| 42 | + ) |
| 43 | + ) |
| 44 | + |
| 45 | + extra["versions"] = versions |
| 46 | + extra["deps"] = deps |
| 47 | + |
| 48 | + repositories { |
| 49 | + mavenCentral() |
| 50 | + maven { |
| 51 | + name = "sonatype" |
| 52 | + url = uri("https://central.sonatype.com/repository/maven-snapshots/") |
| 53 | + } |
| 54 | + } |
| 55 | + |
| 56 | + configure<com.diffplug.gradle.spotless.SpotlessExtension> { |
| 57 | + java { |
| 58 | + googleJavaFormat() |
| 59 | + licenseHeaderFile(rootProject.file("../../buildscripts/spotless.license.java"), "(package|import|public)") |
| 60 | + target("src/**/*.java") |
| 61 | + } |
| 62 | + } |
| 63 | + |
| 64 | + afterEvaluate { |
| 65 | + dependencies { |
| 66 | + add("implementation", platform("io.opentelemetry:opentelemetry-bom:${versions["opentelemetrySdk"]}")) |
| 67 | + |
| 68 | + // these serve as a test of the instrumentation boms |
| 69 | + add("implementation", platform("io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom:${versions["opentelemetryJavaagent"]}")) |
| 70 | + add("implementation", platform("io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha:${versions["opentelemetryJavaagentAlpha"]}")) |
| 71 | + |
| 72 | + add("testImplementation", "org.mockito:mockito-core:5.21.0") |
| 73 | + |
| 74 | + add("testImplementation", enforcedPlatform("org.junit:junit-bom:5.14.2")) |
| 75 | + add("testImplementation", "org.junit.jupiter:junit-jupiter-api") |
| 76 | + add("testRuntimeOnly", "org.junit.jupiter:junit-jupiter-engine") |
| 77 | + add("testRuntimeOnly", "org.junit.platform:junit-platform-launcher") |
| 78 | + } |
| 79 | + } |
| 80 | + |
| 81 | + tasks.named<Test>("test") { |
| 82 | + useJUnitPlatform() |
| 83 | + } |
| 84 | + |
| 85 | + tasks.named<JavaCompile>("compileJava") { |
| 86 | + options.release.set(8) |
| 87 | + } |
| 88 | +} |
0 commit comments