refactor(build): Use version catalog for Compose Multiplatform#4452
Merged
Conversation
Replaces direct `compose.dependencies` access with type-safe accessors from the version catalog for Compose Multiplatform dependencies (`runtime` and `components-resources`). This change improves consistency and maintainability by centralizing dependency management in `libs.versions.toml`. Additionally, the `afterEvaluate` block in `app/build.gradle.kts` is updated to use the modern `extensions.getByType<ApplicationExtension>()` API. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
Refactored the Android convention plugins to reduce code duplication and improve clarity. - Removed redundant `when` blocks for `ApplicationExtension` and `LibraryExtension` by applying common configurations directly to `CommonExtension`. - Simplified the logic for setting `compileSdk`, `minSdk`, and enabling Compose features. - In `MeshtasticFlavor.kt`, a `when` statement is now used to configure product flavors, replacing separate logic blocks for application and library modules. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4452 +/- ##
=====================================
Coverage 8.57% 8.57%
=====================================
Files 420 420
Lines 14184 14184
Branches 2358 2358
=====================================
Hits 1216 1216
Misses 12748 12748
Partials 220 220 ☔ View full report in Codecov by Sentry. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request refactors and simplifies the Gradle build logic for Android and Compose Multiplatform projects. The main improvements include streamlining how build features and flavors are configured, removing unnecessary imports and type casts, and switching to explicit dependency declarations for Compose Multiplatform libraries.
Build logic and configuration simplification:
configureAndroidComposeandconfigureKotlinAndroidto avoid unnecessary type checks and casts, applying configuration directly to theCommonExtensionand using simpler logic for setting build features and SDK versions. [1] [2]configureFlavorsby restructuring the logic to usewhenstatements instead of multiple type casts, making the code more readable and maintainable. [1] [2]Dependency management improvements:
ComposeExtensionfor dependency resolution to directly referencing Compose Multiplatform libraries in theKmpLibraryComposeConventionPlugin, and added these libraries tolibs.versions.tomlfor centralized version management. [1] [2]Code cleanup:
Logging improvement:
app/build.gradle.ktsto use a more robust and future-proof method for accessing the version code.