Introduce non-alpha bom
MODIFY
bom-alpha/build.gradle.kts
bom-alpha/build.gradle.kts
plugins {
- id("java-platform")
-
- id("otel.publish-conventions")
+ id("otel.bom-conventions")
}
description = "OpenTelemetry Instrumentation Bill of Materials (Alpha)"
@@ -19,15 +17,4 @@ dependencies {
api(platform("io.opentelemetry:opentelemetry-bom-alpha:${otelVersion}-alpha"))
}
-dependencies {
- constraints {
- rootProject.subprojects {
- val proj = this
- if (!proj.name.startsWith("bom") && proj.name != "javaagent") {
- proj.plugins.withId("maven-publish") {
- api(proj)
- }
- }
- }
- }
-}
+otelBom.projectFilter.set { it.findProperty("otel.stable") != "true" }

ADD
bom/build.gradle.kts
+plugins {
+ id("otel.bom-conventions")
+}
+
+description = "OpenTelemetry Instrumentation Bill of Materials"
+group = "io.opentelemetry.instrumentation"
+base.archivesName.set("opentelemetry-instrumentation-bom")
+
+javaPlatform {
+ allowDependencies()
+}
+
+val otelVersion: String by project
+
+dependencies {
+ api(platform("io.opentelemetry:opentelemetry-bom:${otelVersion}"))
+}
+
+otelBom.projectFilter.set { it.findProperty("otel.stable") == "true" }

ADD
bom/gradle.properties
+otel.stable=true

ADD
conventions/src/main/kotlin/io/opentelemetry/instrumentation/gradle/OtelBomExtension.kt
+/*
+ * Copyright The OpenTelemetry Authors
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+package io.opentelemetry.instrumentation.gradle
+
+import org.gradle.api.Project
+import org.gradle.api.provider.Property
+import java.util.function.Predicate
+
+abstract class OtelBomExtension {
+ abstract val projectFilter: Property<Predicate<Project>>
+}

ADD
conventions/src/main/kotlin/otel.bom-conventions.gradle.kts
+import io.opentelemetry.instrumentation.gradle.OtelBomExtension
+
+plugins {
+ id("otel.publish-conventions")
+ id("java-platform")
+}
+
+if (!project.name.startsWith("bom")) {
+ throw IllegalStateException("Name of BOM projects must start with 'bom'.")
+}
+
+rootProject.subprojects.forEach { subproject ->
+ if (!subproject.name.startsWith("bom")) {
+ evaluationDependsOn(subproject.path)
+ }
+}
+val otelBom = extensions.create<OtelBomExtension>("otelBom")
+
+afterEvaluate {
+ otelBom.projectFilter.finalizeValue()
+ val bomProjects = rootProject.subprojects
+ .sortedBy { it.findProperty("archivesName") as String? }
+ .filter { !it.name.startsWith("bom") }
+ .filter { !it.name.equals("javaagent") }
+ .filter(otelBom.projectFilter.get()::test)
+ .filter { it.plugins.hasPlugin("maven-publish") }
+
+ bomProjects.forEach { project ->
+ dependencies {
+ constraints {
+ api(project)
+ }
+ }
+ }
+}

MODIFY
settings.gradle.kts
settings.gradle.kts
@@ -106,6 +106,7 @@ include(":javaagent-tooling")
include(":javaagent-tooling:javaagent-tooling-java9")
include(":javaagent")
+include(":bom")
include(":bom-alpha")
include(":instrumentation-api")
include(":instrumentation-api-semconv")

Introduce non-alpha bom (#6576)