Skip to content

Commit 5eea7dc

Browse files
authored
Include the upstream components in our android bom (#1075)
* include the upstream components in our android bom * spotless * move core deps back into constraints block
1 parent b6099af commit 5eea7dc

3 files changed

Lines changed: 14 additions & 3 deletions

File tree

README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,18 @@ channel in the [CNCF slack](https://slack.cncf.io/). Please join us there for fu
3737

3838
## Gradle
3939

40-
To use this android instrumentation library in your application, first add a dependency
41-
in your gradle build script:
40+
To use this android instrumentation library in your application, you will first need to add
41+
a dependency in your application's `build.gradle.kts`. We publish a bill of materials (BOM) that
42+
helps to coordinate versions of the opentelemetry-android components and the upstream
43+
`opentelemetry-java-instrumentation` and `opentelemetry-java` dependencies. We recommend
44+
using the bom as a platform dependency, and then omitting explicit version information
45+
from all other opentelemetry dependencies:
4246

4347
```kotlin
4448
dependencies {
4549
//...
46-
implementation("io.opentelemetry.android:android-agent:0.12.0-alpha")
50+
api(platform("io.opentelemetry.android:opentelemetry-android-bom.12.0-alpha"))
51+
implementation("io.opentelemetry.android:android-agent") // Version is resolved thru bom
4752
//...
4853
}
4954
```

gradle/libs.versions.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ compose = "1.5.4"
1919
[libraries]
2020
opentelemetry-platform-alpha = { module = "io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha", version.ref = "opentelemetry-instrumentation-alpha" }
2121
opentelemetry-platform = { module = "io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom" }
22+
opentelemetry-core-bom = { module = "io.opentelemetry:opentelemetry-bom" }
2223
androidx-navigation-fragment = { group = "androidx.navigation", name = "navigation-fragment", version.ref = "androidx-navigation" }
2324
androidx-navigation-runtime-ktx = { group = "androidx.navigation", name = "navigation-runtime-ktx", version.ref = "androidx-navigation" }
2425
androidx-core = "androidx.core:core:1.16.0"

opentelemetry-android-bom/build.gradle.kts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@ plugins {
55

66
description = "OpenTelemetry Android Bill of Materials"
77

8+
javaPlatform.allowDependencies()
9+
810
dependencies {
11+
api(platform(libs.opentelemetry.platform.alpha))
12+
api(platform(libs.opentelemetry.platform))
13+
api(platform(libs.opentelemetry.core.bom))
914
constraints {
1015
rootProject.subprojects.forEach { subproject ->
1116
if (subproject != project) {

0 commit comments

Comments
 (0)