Skip to content

refactor(build): Use version catalog for Compose Multiplatform#4452

Merged
jamesarich merged 2 commits into
mainfrom
fix/dsl
Feb 4, 2026
Merged

refactor(build): Use version catalog for Compose Multiplatform#4452
jamesarich merged 2 commits into
mainfrom
fix/dsl

Conversation

@jamesarich

Copy link
Copy Markdown
Collaborator

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:

  • Refactored configureAndroidCompose and configureKotlinAndroid to avoid unnecessary type checks and casts, applying configuration directly to the CommonExtension and using simpler logic for setting build features and SDK versions. [1] [2]
  • Simplified flavor configuration in configureFlavors by restructuring the logic to use when statements instead of multiple type casts, making the code more readable and maintainable. [1] [2]

Dependency management improvements:

  • Switched from using the ComposeExtension for dependency resolution to directly referencing Compose Multiplatform libraries in the KmpLibraryComposeConventionPlugin, and added these libraries to libs.versions.toml for centralized version management. [1] [2]

Code cleanup:

  • Removed unused imports from several build logic files, reducing clutter and potential confusion. [1] [2] [3] [4]

Logging improvement:

  • Updated the version code logging in app/build.gradle.kts to use a more robust and future-proof method for accessing the version code.

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>
@github-actions github-actions Bot added the bugfix PR tag label Feb 4, 2026
@jamesarich jamesarich merged commit 6712046 into main Feb 4, 2026
6 of 7 checks passed
@jamesarich jamesarich deleted the fix/dsl branch February 4, 2026 22:31
@codecov

codecov Bot commented Feb 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 8.57%. Comparing base (854eff6) to head (00d9290).
⚠️ Report is 4 commits behind head on main.
✅ All tests successful. No failed tests found.

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.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix PR tag

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant