build: align Compose Multiplatform versions and exclude transitive BOMs

Updates the Android Compose build logic to ensure Compose Multiplatform (CMP) versioning takes precedence over transitive dependencies and avoids version conflicts.

Key changes:
- **Global BOM Exclusion:** Excludes `androidx.compose:compose-bom` from all configurations. This prevents third-party libraries (such as `maps-compose` or `datadog`) from introducing transitive BOM constraints that conflict with CMP-published AndroidX artifacts.
- **Expanded Version Alignment:** Added `androidx.compose.material` to the `cmpAlignedGroups` set, forcing it to align with the specific CMP version tag.
- **Documentation:** Updated comments to clarify that CMP is now the sole authority for Compose versions following the removal of the BOM from the version catalog.

Specific changes:
- Modified `build-logic/convention/src/main/kotlin/org/meshtastic/buildlogic/AndroidCompose.kt` to implement global `compose-bom` exclusion.
- Updated the `cmpAlignedGroups` list within `configureAndroidCompose`.
This commit is contained in:
James Rich
2026-04-13 06:24:27 -05:00
committed by James Rich
parent 4dd591af25
commit 43dc59cea8

View File

@@ -24,13 +24,22 @@ import org.gradle.kotlin.dsl.dependencies
internal fun Project.configureAndroidCompose(commonExtension: CommonExtension) {
commonExtension.apply { buildFeatures.compose = true }
// CMP skips Android version enforcement; third-party BOMs and atomic-group alignment
// can silently override AndroidX Compose versions. Force core groups to the CMP version.
// Material/Material3 excluded — CMP maps those to different AndroidX version numbers.
// CMP is the sole Compose version authority (BOM removed from the catalog).
// Third-party libraries (maps-compose, datadog, etc.) carry a transitive
// compose-bom whose constraints conflict with CMP-published AndroidX artifacts.
// Exclude it globally so CMP's own dependency graph wins.
configurations.configureEach {
exclude(mapOf("group" to "androidx.compose", "module" to "compose-bom"))
}
// CMP publishes core AndroidX groups at the CMP version tag (e.g. 1.11.0-beta02).
// Material/Material3/Adaptive are intentionally excluded — CMP maps those to
// different AndroidX version numbers (see release notes for the mapping table).
val cmpVersion = libs.version("compose-multiplatform")
val cmpAlignedGroups = setOf(
"androidx.compose.animation",
"androidx.compose.foundation",
"androidx.compose.material",
"androidx.compose.runtime",
"androidx.compose.ui",
)