-
Notifications
You must be signed in to change notification settings - Fork 872
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
72 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
otel.stable=true |
14 changes: 14 additions & 0 deletions
14
conventions/src/main/kotlin/io/opentelemetry/instrumentation/gradle/OtelBomExtension.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
35
conventions/src/main/kotlin/otel.bom-conventions.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters