refactor: Migrate to Android Gradle Plugin 9.0#4072
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4072 +/- ##
========================================
- Coverage 0.59% 0.00% -0.60%
========================================
Files 407 2 -405
Lines 24793 19 -24774
Branches 3189 7 -3182
========================================
- Hits 148 0 -148
+ Misses 24622 19 -24603
+ Partials 23 0 -23 ☔ View full report in Codecov by Sentry. |
5300235 to
f931218
Compare
This commit migrates the project to use the new Android Gradle Plugin (AGP) 9.0 API.
Key changes include:
* Updating from `android { ... }` block to the `configure<LibraryExtension> { ... }` syntax in module-level `build.gradle.kts` files.
* Refactoring convention plugins to use the new `CommonExtension` and type casting for `ApplicationExtension` and `LibraryExtension` specific configurations.
* Removing the now-redundant `com.android.library` and `org.jetbrains.kotlin.android` plugin applications from convention plugins.
* Updating the Android Gradle Plugin version to `9.0.0-rc01`.
* Adding a dependency on `androidx.lifecycle.runtime`.
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
f931218 to
dd3f199
Compare
Adds the `androidx.core.ktx` library as a dependency to the `core/data` module. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
Removes redundant `extension.apply` blocks and simplifies the `compileOptions` configuration in the `KotlinAndroid` convention plugin. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
Refactor the convention plugins to use type-safe accessors for the `libs` version catalog. - Add a dependency on the version catalog itself to `build-logic/convention/build.gradle.kts`, enabling type-safe accessors in the plugins' source code. - Introduce extension functions (`library`, `plugin`, etc.) for `VersionCatalog` to simplify dependency declarations. - Update `AndroidRoomConventionPlugin`, `AnalyticsConventionPlugin`, and `KotlinXSerializationConventionPlugin` to use these new type-safe accessors instead of `findLibrary()` and string-based plugin IDs. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
Replaces `findLibrary`, `findPlugin`, and `findVersion` calls with the type-safe accessors `library`, `plugin`, and `version` across the build logic convention plugins. This change also: * Sets `targetSdk` from project properties for application modules. * Adds `hilt-core` to the version catalog for JVM modules. * Removes redundant plugin applications and hardcoded values, relying on the new type-safe accessors and properties. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
Refactors the Detekt and Spotless convention plugins for better Gradle compatibility and conciseness. - Updates Detekt to use the project-specific `buildDirectory` for reports, preventing conflicts in multi-project builds. - Simplifies `DetektConventionPlugin` and `SpotlessConventionPlugin` by using `pluginManager.apply` and the `extensions.configure` block, removing redundant `configureKotlinJvm` calls. - Cleans up Spotless configuration by removing the explicit receiver `extension` and extracting the `ktlintVersion`. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit refactors the Gradle build logic for Kotlin Multiplatform (KMP) modules. Key changes: * A new `configureKotlinMultiplatform` extension function has been created to centralize KMP configuration, including setting the Android `compileSdk` and `minSdk`. * The `KmpLibraryConventionPlugin` is simplified to use this new centralized function. * Detekt source sets are updated to include KMP source directories (`commonMain`, `androidMain`, `jvmMain`). * The `KotlinXSerializationConventionPlugin` is improved to correctly apply the serialization dependency to the appropriate source sets for KMP, Android, and JVM projects. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit introduces a new convention plugin `meshtastic.kmp.library.compose` to streamline the setup for Kotlin Multiplatform modules that use Jetpack Compose.
Key changes include:
* **New KMP Compose Plugin**: Created `KmpLibraryComposeConventionPlugin.kt` to handle Compose Multiplatform and compiler plugin application, along with common Compose dependencies for KMP modules. This simplifies the build configuration for modules like `core/strings`.
* **Build Logic Refactoring**:
* Hardcoded plugin IDs in `build-logic/convention/build.gradle.kts` have been replaced with direct strings to improve maintainability.
* Updated the dependency resolution for the `libs` accessor.
* `AndroidRoomConventionPlugin` is now compatible with Kotlin Multiplatform, applying dependencies to the correct source sets (e.g., `commonMain`, `androidMain`).
* **Linting for KMP**: The `AndroidLintConventionPlugin` is now correctly applied to Kotlin Multiplatform library targets.
* **Dependency Updates**: Added and organized dependencies for Compose Multiplatform in `gradle/libs.versions.toml`.
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
Adds kotlinx.serialization.core to the navigation module and the Room compiler (ksp) to the database module. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
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 commit migrates the project to use the new Android Gradle Plugin (AGP) 9.0 API.
Key changes include:
android { ... }block to theconfigure<LibraryExtension> { ... }syntax in module-levelbuild.gradle.ktsfiles.CommonExtensionand type casting forApplicationExtensionandLibraryExtensionspecific configurations.com.android.libraryandorg.jetbrains.kotlin.androidplugin applications from convention plugins.9.0.0-rc01.androidx.lifecycle.runtime.