123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200 |
- import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
- plugins {
- id("com.github.johnrengelman.shadow")
- id("otel.java-conventions")
- }
- description = "opentelemetry-api shaded for internal javaagent usage"
- group = "io.opentelemetry.javaagent"
- val latestDeps by configurations.creating {
- isCanBeResolved = true
- isCanBeConsumed = false
- }
- val v1_10Deps by configurations.creating {
- isCanBeResolved = true
- isCanBeConsumed = false
- // exclude the bom added by dependencyManagement
- exclude("io.opentelemetry", "opentelemetry-bom")
- }
- val v1_15Deps by configurations.creating {
- isCanBeResolved = true
- isCanBeConsumed = false
- // exclude the bom added by dependencyManagement
- exclude("io.opentelemetry", "opentelemetry-bom")
- }
- val v1_27Deps by configurations.creating {
- isCanBeResolved = true
- isCanBeConsumed = false
- // exclude the bom added by dependencyManagement
- exclude("io.opentelemetry", "opentelemetry-bom")
- }
- val v1_31Deps by configurations.creating {
- isCanBeResolved = true
- isCanBeConsumed = false
- // exclude the bom added by dependencyManagement
- exclude("io.opentelemetry", "opentelemetry-bom")
- exclude("io.opentelemetry", "opentelemetry-bom-alpha")
- }
- val v1_32Deps by configurations.creating {
- isCanBeResolved = true
- isCanBeConsumed = false
- // exclude the bom added by dependencyManagement
- exclude("io.opentelemetry", "opentelemetry-bom")
- exclude("io.opentelemetry", "opentelemetry-bom-alpha")
- }
- val v1_37Deps by configurations.creating {
- isCanBeResolved = true
- isCanBeConsumed = false
- // exclude the bom added by dependencyManagement
- exclude("io.opentelemetry", "opentelemetry-bom")
- exclude("io.opentelemetry", "opentelemetry-bom-alpha")
- }
- val v1_38Deps by configurations.creating {
- isCanBeResolved = true
- isCanBeConsumed = false
- // exclude the bom added by dependencyManagement
- exclude("io.opentelemetry", "opentelemetry-bom")
- exclude("io.opentelemetry", "opentelemetry-bom-alpha")
- }
- // configuration for publishing the shadowed artifact
- val v1_10 by configurations.creating {
- isCanBeConsumed = true
- isCanBeResolved = false
- }
- val v1_15 by configurations.creating {
- isCanBeConsumed = true
- isCanBeResolved = false
- }
- val v1_27 by configurations.creating {
- isCanBeConsumed = true
- isCanBeResolved = false
- }
- val v1_31 by configurations.creating {
- isCanBeConsumed = true
- isCanBeResolved = false
- }
- val v1_32 by configurations.creating {
- isCanBeConsumed = true
- isCanBeResolved = false
- }
- val v1_37 by configurations.creating {
- isCanBeConsumed = true
- isCanBeResolved = false
- }
- val v1_38 by configurations.creating {
- isCanBeConsumed = true
- isCanBeResolved = false
- }
- dependencies {
- latestDeps("io.opentelemetry:opentelemetry-api")
- listOf("opentelemetry-api", "opentelemetry-context").forEach {
- v1_10Deps("io.opentelemetry:$it") {
- version {
- strictly("1.10.0")
- }
- }
- v1_15Deps("io.opentelemetry:$it") {
- version {
- strictly("1.15.0")
- }
- }
- v1_27Deps("io.opentelemetry:$it") {
- version {
- strictly("1.27.0")
- }
- }
- v1_31Deps("io.opentelemetry:$it") {
- version {
- strictly("1.31.0")
- }
- }
- v1_32Deps("io.opentelemetry:$it") {
- version {
- strictly("1.32.0")
- }
- }
- }
- listOf("opentelemetry-extension-incubator").forEach {
- v1_31Deps("io.opentelemetry:$it") {
- version {
- strictly("1.31.0-alpha")
- }
- }
- v1_32Deps("io.opentelemetry:$it") {
- version {
- strictly("1.32.0-alpha")
- }
- }
- }
- listOf("opentelemetry-api-incubator").forEach {
- v1_37Deps("io.opentelemetry:$it") {
- version {
- strictly("1.37.0-alpha")
- }
- }
- v1_38Deps("io.opentelemetry:$it") {
- version {
- strictly("1.38.0-alpha")
- }
- }
- }
- }
- // OpenTelemetry API shaded so that it can be used in instrumentation of OpenTelemetry API itself,
- // and then its usage can be unshaded after OpenTelemetry API is shaded
- // (see more explanation in opentelemetry-api-1.0.gradle)
- tasks {
- withType<ShadowJar>().configureEach {
- relocate("io.opentelemetry", "application.io.opentelemetry")
- }
- shadowJar {
- configurations = listOf(latestDeps)
- }
- val v1_10Shadow by registering(ShadowJar::class) {
- configurations = listOf(v1_10Deps)
- archiveClassifier.set("v1_10")
- }
- val v1_15Shadow by registering(ShadowJar::class) {
- configurations = listOf(v1_15Deps)
- archiveClassifier.set("v1_15")
- }
- val v1_27Shadow by registering(ShadowJar::class) {
- configurations = listOf(v1_27Deps)
- archiveClassifier.set("v1_27")
- }
- val v1_31Shadow by registering(ShadowJar::class) {
- configurations = listOf(v1_31Deps)
- archiveClassifier.set("v1_31")
- }
- val v1_32Shadow by registering(ShadowJar::class) {
- configurations = listOf(v1_32Deps)
- archiveClassifier.set("v1_32")
- }
- val v1_37Shadow by registering(ShadowJar::class) {
- configurations = listOf(v1_37Deps)
- archiveClassifier.set("v1_37")
- }
- val v1_38Shadow by registering(ShadowJar::class) {
- configurations = listOf(v1_38Deps)
- archiveClassifier.set("v1_38")
- }
- artifacts {
- add(v1_10.name, v1_10Shadow)
- add(v1_15.name, v1_15Shadow)
- add(v1_27.name, v1_27Shadow)
- add(v1_31.name, v1_31Shadow)
- add(v1_32.name, v1_32Shadow)
- add(v1_37.name, v1_37Shadow)
- add(v1_38.name, v1_38Shadow)
- }
- }
|