Add semconv to alpha bom (#9425)

This commit is contained in:
Trask Stalnaker 2023-09-13 18:54:25 -07:00 committed by GitHub
parent 10480adc64
commit b2b1eb19e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 0 deletions

View File

@ -14,6 +14,13 @@ dependencies {
api(platform("io.opentelemetry:opentelemetry-bom"))
api(platform("io.opentelemetry:opentelemetry-bom-alpha"))
api(platform(project(":bom")))
// Get the semconv version from :dependencyManagement
val semconvConstraint = project(":dependencyManagement").dependencyProject.configurations["api"].allDependencyConstraints
.find { it.group.equals("io.opentelemetry.semconv")
&& it.name.equals("opentelemetry-semconv") }
?: throw Exception("semconv constraint not found")
otelBom.addExtra(semconvConstraint.group, semconvConstraint.name, semconvConstraint.version ?: throw Exception("missing version"))
}
otelBom.projectFilter.set { it.findProperty("otel.stable") != "true" }

View File

@ -11,4 +11,9 @@ import java.util.function.Predicate
abstract class OtelBomExtension {
abstract val projectFilter: Property<Predicate<Project>>
val additionalDependencies: MutableSet<String> = hashSetOf()
fun addExtra(groupId: String, artifactId: String, version: String) {
this.additionalDependencies.add(groupId + ":" + artifactId + ":" + version)
}
}

View File

@ -31,6 +31,13 @@ afterEvaluate {
}
}
}
otelBom.additionalDependencies.forEach { dependency ->
dependencies {
constraints {
api(dependency)
}
}
}
}
// this applies version numbers to the SDK bom and SDK alpha bom which are dependencies of the instrumentation boms