Skip to content

Commit

Permalink
Add semconv to alpha bom (#9425)
Browse files Browse the repository at this point in the history
  • Loading branch information
trask authored Sep 14, 2023
1 parent 10480ad commit b2b1eb1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
7 changes: 7 additions & 0 deletions bom-alpha/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
7 changes: 7 additions & 0 deletions conventions/src/main/kotlin/otel.bom-conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b2b1eb1

Please sign in to comment.