Skip to content

Commit cf9bfa2

Browse files
author
Anuraag Agrawal
authored
Publish a BOM (#2339)
1 parent cc033a1 commit cf9bfa2

File tree

3 files changed

+46
-2
lines changed

3 files changed

+46
-2
lines changed

bom-alpha/bom-alpha.gradle

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
plugins {
2+
id("java-platform")
3+
}
4+
5+
apply from: "$rootDir/gradle/publish.gradle"
6+
7+
description = "OpenTelemetry Instrumentation Bill of Materials (Alpha)"
8+
group = "io.opentelemetry.instrumentation"
9+
archivesBaseName = "opentelemetry-instrumentation-bom-alpha"
10+
11+
rootProject.subprojects.forEach { subproject ->
12+
if (!project.name.startsWith("bom")) {
13+
evaluationDependsOn(subproject.path)
14+
}
15+
}
16+
17+
javaPlatform {
18+
allowDependencies()
19+
}
20+
21+
dependencies {
22+
api(platform("io.opentelemetry:opentelemetry-bom:${versions.opentelemetry}"))
23+
api(platform("io.opentelemetry:opentelemetry-bom-alpha:${versions.opentelemetryAlpha}"))
24+
}
25+
26+
afterEvaluate {
27+
dependencies {
28+
constraints {
29+
rootProject.subprojects.sort { "$it.archivesBaseName" }
30+
.collect { it }
31+
.findAll { it.name != project.name && it.name != 'javaagent'}
32+
.forEach { project ->
33+
project.plugins.withId("maven-publish") {
34+
api(project)
35+
}
36+
}
37+
}
38+
}
39+
}

gradle/publish.gradle

+6-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,12 @@ publishing {
2323
artifact sourcesJar
2424
artifact javadocJar
2525
} else {
26-
from components.java
26+
project.plugins.withId("java-platform") {
27+
from(components["javaPlatform"])
28+
}
29+
project.plugins.withId("java-library") {
30+
from components.java
31+
}
2732
}
2833

2934
def stable = findProperty("otel.stable") ?: false
@@ -47,7 +52,6 @@ publishing {
4752

4853
pom {
4954
name = 'OpenTelemetry Instrumentation for Java'
50-
packaging = 'jar'
5155
url = 'https://github.com/open-telemetry/opentelemetry-java-instrumentation'
5256

5357
licenses {

settings.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ include ':javaagent-tooling'
4040
include ':javaagent'
4141
include ':load-generator'
4242

43+
include ':bom-alpha'
4344
include ':instrumentation-api'
4445
include ':javaagent-api'
4546

0 commit comments

Comments
 (0)