Skip to content

Commit 9c6945d

Browse files
authored
Remove BOM dependency on Compose & use explicit versions (#393)
1 parent ba367cd commit 9c6945d

File tree

3 files changed

+20
-13
lines changed

3 files changed

+20
-13
lines changed

build-logic/src/main/kotlin/Dependencies.kt

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ object libs {
77
const val junitVintage = "5.14.0"
88
const val junitPlatform = "1.14.0"
99

10-
const val composeBom = "2025.03.00"
10+
const val compose = "1.7.8"
1111
const val androidXMultidex = "2.0.1"
1212
const val androidXTestAnnotation = "1.0.1"
1313
const val androidXTestCore = "1.6.1"
@@ -60,11 +60,10 @@ object libs {
6060
const val junitPlatformRunner = "org.junit.platform:junit-platform-runner:${versions.junitPlatform}"
6161
const val apiguardianApi = "org.apiguardian:apiguardian-api:${versions.apiGuardian}"
6262

63-
const val composeBom = "androidx.compose:compose-bom:${versions.composeBom}"
64-
const val composeUi = "androidx.compose.ui:ui"
65-
const val composeUiTooling = "androidx.compose.ui:ui-tooling"
66-
const val composeFoundation = "androidx.compose.foundation:foundation"
67-
const val composeMaterial = "androidx.compose.material:material"
63+
const val composeUi = "androidx.compose.ui:ui:${versions.compose}"
64+
const val composeUiTooling = "androidx.compose.ui:ui-tooling:${versions.compose}"
65+
const val composeFoundation = "androidx.compose.foundation:foundation:${versions.compose}"
66+
const val composeMaterial = "androidx.compose.material:material:${versions.compose}"
6867
const val composeActivity = "androidx.activity:activity-compose:${versions.activityCompose}"
6968

7069
// Testing
@@ -84,9 +83,9 @@ object libs {
8483
const val androidXTestRunner = "androidx.test:runner:${versions.androidXTestRunner}"
8584
const val espressoCore = "androidx.test.espresso:espresso-core:${versions.espresso}"
8685

87-
const val composeUiTest = "androidx.compose.ui:ui-test"
88-
const val composeUiTestJUnit4 = "androidx.compose.ui:ui-test-junit4"
89-
const val composeUiTestManifest = "androidx.compose.ui:ui-test-manifest"
86+
const val composeUiTest = "androidx.compose.ui:ui-test:${versions.compose}"
87+
const val composeUiTestJUnit4 = "androidx.compose.ui:ui-test-junit4:${versions.compose}"
88+
const val composeUiTestManifest = "androidx.compose.ui:ui-test-manifest:${versions.compose}"
9089

9190
// Documentation
9291
// For the latest version refer to GitHub repo neboskreb/instant-task-executor-extension

build-logic/src/main/kotlin/Deployment.kt

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,16 +204,25 @@ private fun MavenPublication.applyPublicationDetails(
204204
.mapValues { entry -> entry.value.filter { it.name != "unspecified" } }
205205
.forEach { (scope, dependencies) ->
206206
dependencies.forEach { dep ->
207+
// Do not allow BOM dependencies for our own packaged libraries,
208+
// instead its artifact versions should be unrolled explicitly
209+
if ("-bom" in dep.name) {
210+
throw IllegalArgumentException(
211+
"Found a BOM declaration in the dependencies of project" +
212+
"${project.path}: $dep. Prefer declaring its " +
213+
"transitive artifacts explicitly by " +
214+
"adding a version contraint to them."
215+
)
216+
}
217+
207218
with(dependenciesNode.appendNode("dependency")) {
208219
if (dep is ProjectDependency) {
209220
appendProjectDependencyCoordinates(dep)
210221
} else {
211222
appendExternalDependencyCoordinates(dep)
212223
}
213224

214-
// Rewrite scope definition for BOM dependencies
215-
val isBom = "-bom" in dep.name
216-
appendNode("scope", if (isBom) "import" else scope)
225+
appendNode("scope", scope)
217226
}
218227
}
219228
}

instrumentation/compose/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ dependencies {
7474
implementation(libs.junit4)
7575
implementation(libs.espressoCore)
7676

77-
implementation(platform(libs.composeBom))
7877
implementation(libs.composeActivity)
7978
implementation(libs.composeUi)
8079
implementation(libs.composeUiTooling)

0 commit comments

Comments
 (0)