Skip to content

Commit b2b1eb1

Browse files
authored
Add semconv to alpha bom (#9425)
1 parent 10480ad commit b2b1eb1

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

bom-alpha/build.gradle.kts

+7
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ dependencies {
1414
api(platform("io.opentelemetry:opentelemetry-bom"))
1515
api(platform("io.opentelemetry:opentelemetry-bom-alpha"))
1616
api(platform(project(":bom")))
17+
18+
// Get the semconv version from :dependencyManagement
19+
val semconvConstraint = project(":dependencyManagement").dependencyProject.configurations["api"].allDependencyConstraints
20+
.find { it.group.equals("io.opentelemetry.semconv")
21+
&& it.name.equals("opentelemetry-semconv") }
22+
?: throw Exception("semconv constraint not found")
23+
otelBom.addExtra(semconvConstraint.group, semconvConstraint.name, semconvConstraint.version ?: throw Exception("missing version"))
1724
}
1825

1926
otelBom.projectFilter.set { it.findProperty("otel.stable") != "true" }

conventions/src/main/kotlin/io/opentelemetry/instrumentation/gradle/OtelBomExtension.kt

+5
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,9 @@ import java.util.function.Predicate
1111

1212
abstract class OtelBomExtension {
1313
abstract val projectFilter: Property<Predicate<Project>>
14+
val additionalDependencies: MutableSet<String> = hashSetOf()
15+
16+
fun addExtra(groupId: String, artifactId: String, version: String) {
17+
this.additionalDependencies.add(groupId + ":" + artifactId + ":" + version)
18+
}
1419
}

conventions/src/main/kotlin/otel.bom-conventions.gradle.kts

+7
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ afterEvaluate {
3131
}
3232
}
3333
}
34+
otelBom.additionalDependencies.forEach { dependency ->
35+
dependencies {
36+
constraints {
37+
api(dependency)
38+
}
39+
}
40+
}
3441
}
3542

3643
// this applies version numbers to the SDK bom and SDK alpha bom which are dependencies of the instrumentation boms

0 commit comments

Comments
 (0)