Skip to content

Commit

Permalink
Introduce non-alpha bom (open-telemetry#6576)
Browse files Browse the repository at this point in the history
  • Loading branch information
trask authored and LironKS committed Oct 31, 2022
1 parent 880f269 commit 070bf30
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 15 deletions.
17 changes: 2 additions & 15 deletions bom-alpha/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
plugins {
id("java-platform")

id("otel.publish-conventions")
id("otel.bom-conventions")
}

description = "OpenTelemetry Instrumentation Bill of Materials (Alpha)"
Expand All @@ -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" }
19 changes: 19 additions & 0 deletions bom/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
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" }
1 change: 1 addition & 0 deletions bom/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
otel.stable=true
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* 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>>
}
35 changes: 35 additions & 0 deletions conventions/src/main/kotlin/otel.bom-conventions.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
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)
}
}
}
}
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 070bf30

Please sign in to comment.