Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a convention plugin (AndroidLibraryPlugin) to centralize common Android library module build configurations, eliminating duplicated code across library modules. The plugin is implemented in a separate build-logic module and consolidates settings like compileSdk, minSdk, compile options, and Kotlin configuration that were previously repeated in each library module's build.gradle.kts file. The PR also includes dependency version updates across the version catalog.
Key changes:
- Created
AndroidLibraryPluginconvention plugin to centralize Android library configurations - Added
build-logicmodule with convention plugin infrastructure - Updated all library modules (store, directdownload, compose, appupdater) to use the new convention plugin
- Updated multiple dependency versions in the version catalog (AGP, Kotlin, AndroidX libraries, Compose, testing libraries)
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| build-logic/convention/src/main/java/com/pouyaheydari/appupdater/convention/plugins/AndroidLibraryPlugin.kt | Implements the convention plugin that centralizes Android library configurations including SDK versions, compile options, and Kotlin toolchain setup |
| build-logic/convention/src/main/java/com/pouyaheydari/appupdater/convention/helpers/ProjectHelper.kt | Provides helper functions to extract configuration values (compileSdk, minSdk, javaVersion) from the version catalog |
| build-logic/convention/build.gradle.kts | Configures the convention plugin module with necessary dependencies and plugin registration |
| build-logic/settings.gradle.kts | Sets up dependency resolution and version catalog access for the build-logic module |
| build-logic/convention/.gitignore | Excludes the build directory from version control |
| settings.gradle.kts | Includes the build-logic module in the composite build |
| gradle/libs.versions.toml | Adds new library dependencies for Gradle plugins and declares the custom androidLibrary convention plugin, also updates multiple dependency versions |
| store/build.gradle.kts | Replaces plugin declarations and Android configuration with the new convention plugin |
| directdownload/build.gradle.kts | Replaces plugin declarations and Android configuration with the new convention plugin, fixes formatting in test dependencies |
| compose/build.gradle.kts | Replaces plugin declarations and Android configuration with the new convention plugin |
| appupdater/build.gradle.kts | Replaces plugin declarations and Android configuration with the new convention plugin, fixes formatting in test dependencies |
| app/build.gradle.kts | Updates Kotlin configuration from kotlinOptions to kotlin.jvmToolchain pattern |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...vention/src/main/java/com/pouyaheydari/appupdater/convention/plugins/AndroidLibraryPlugin.kt
Outdated
Show resolved
Hide resolved
...gic/convention/src/main/java/com/pouyaheydari/appupdater/convention/helpers/ProjectHelper.kt
Outdated
Show resolved
Hide resolved
297ea00 to
a119cf0
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughA new build-convention Gradle composite is added (build-logic) that provides an Android library plugin and helpers sourcing values from the version catalog. Module build files switch to using the convention plugin (project.androidLibrary) and remove explicit SDK/toolchain settings; libs versions and plugin entries are updated. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
store/build.gradle.kts (1)
8-11: Remove thejavablock.The
javablock has no effect because the Java Gradle plugin is not applied to this module—onlyandroidLibraryis. TheAndroidLibraryPluginalready configuressourceCompatibilityandtargetCompatibilityviacompileOptionsin the Android extension and sets up the Kotlin JVM toolchain. Thisjavablock is redundant and should be deleted.
♻️ Duplicate comments (1)
gradle/libs.versions.toml (1)
23-23: Typo: "roboelectric" should be "robolectric".The version key and library name reference contain a typo. The correct spelling is "robolectric" (with an 'l').
-roboelectric = "4.16" +robolectric = "4.16"Also update line 45:
-roboelectric = { group = "org.robolectric", name = "robolectric", version.ref = "roboelectric" } +robolectric = { group = "org.robolectric", name = "robolectric", version.ref = "robolectric" }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (13)
app/build.gradle.kts(1 hunks)appupdater/build.gradle.kts(2 hunks)build-logic/convention/.gitignore(1 hunks)build-logic/convention/build.gradle.kts(1 hunks)build-logic/convention/src/main/java/com/pouyaheydari/appupdater/convention/helpers/JavaVersionHelper.kt(1 hunks)build-logic/convention/src/main/java/com/pouyaheydari/appupdater/convention/helpers/ProjectHelper.kt(1 hunks)build-logic/convention/src/main/java/com/pouyaheydari/appupdater/convention/plugins/AndroidLibraryPlugin.kt(1 hunks)build-logic/settings.gradle.kts(1 hunks)compose/build.gradle.kts(1 hunks)directdownload/build.gradle.kts(2 hunks)gradle/libs.versions.toml(3 hunks)settings.gradle.kts(1 hunks)store/build.gradle.kts(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
build-logic/convention/src/main/java/com/pouyaheydari/appupdater/convention/plugins/AndroidLibraryPlugin.kt (2)
build-logic/convention/src/main/java/com/pouyaheydari/appupdater/convention/helpers/ProjectHelper.kt (2)
compileSdk(8-8)minSdk(10-10)build-logic/convention/src/main/java/com/pouyaheydari/appupdater/convention/helpers/JavaVersionHelper.kt (1)
javaVersion(5-5)
🔇 Additional comments (18)
build-logic/convention/.gitignore (1)
1-1: Remove this .gitignore file as it is redundant.The root
.gitignorealready covers the/buildpattern (present as both/buildandbuild/), making this module-level file unnecessary. Since there is only one.gitignorefile in the repository (this one) and the root already handles Gradle build output globally, this file should be deleted.Likely an incorrect or invalid review comment.
build-logic/convention/src/main/java/com/pouyaheydari/appupdater/convention/helpers/JavaVersionHelper.kt (1)
1-5: LGTM!The helper function provides a centralized Java version constant for convention plugins, aligning with the Java 17 toolchain strategy implemented across the project.
settings.gradle.kts (1)
2-3: LGTM!The composite build inclusion is correctly placed within the
pluginManagementblock, enabling the convention plugins to be resolved and applied across the project.app/build.gradle.kts (1)
27-29: LGTM!The migration from explicit
jvmTargetto the Kotlin JVM toolchain is the correct modern approach, ensuring consistent Java 17 runtime across compilation and execution.store/build.gradle.kts (1)
1-3: LGTM!The migration to the centralized
project.androidLibraryplugin correctly consolidates the previously explicit plugin declarations.directdownload/build.gradle.kts (1)
1-7: LGTM!Clean migration to the
project.androidLibraryconvention plugin with appropriate removal of explicit Android configuration.compose/build.gradle.kts (1)
1-24: LGTM!The migration correctly uses the convention plugin while appropriately retaining Compose-specific configurations (build features, vector drawables, test options, and packaging rules).
build-logic/convention/build.gradle.kts (3)
1-5: LGTM!Standard Gradle convention plugin setup with appropriate
kotlin-dslplugin and namespaced group coordinates.
7-15: LGTM! Java 17 compatibility andcompileOnlydependencies on Android/Kotlin Gradle plugins are correctly configured for convention plugin development. Bothandroid-gradlePluginandkotlin-gradlePluginare properly defined in the version catalog with AGP 8.13.2 and Kotlin 2.2.21.
17-24: The plugin registration and implementation are correct. TheAndroidLibraryPluginclass exists and properly applies the required base plugins (Android library, Kotlin Android, and Maven Publish), along with appropriate SDK and toolchain configuration. The version catalog correctly mapsproject-androidLibrarytocom.pouyaheydari.androidLibraryPlugin.build-logic/settings.gradle.kts (2)
1-13: LGTM!The dependency resolution configuration correctly establishes repositories and creates a version catalog sourcing from the parent project's
libs.versions.toml, enabling shared dependency versions across build logic and application modules.
15-16: LGTM!Project name and convention module inclusion are correctly configured.
build-logic/convention/src/main/java/com/pouyaheydari/appupdater/convention/plugins/AndroidLibraryPlugin.kt (2)
14-21: LGTM on plugin application pattern.The plugin correctly applies base plugins via the version catalog, ensuring consistent versioning across modules. The use of
baseLibs.findPlugin()pattern is a good approach for centralized plugin management.
23-33: LGTM on LibraryExtension configuration.The Android library configuration correctly uses helper functions for
compileSdk()andminSdk(), and the compile options use the centralizedjavaVersion()helper. This ensures consistency across library modules.build-logic/convention/src/main/java/com/pouyaheydari/appupdater/convention/helpers/ProjectHelper.kt (1)
12-13: LGTM on baseLibs extension property.The extension property correctly retrieves the version catalog using the Gradle DSL and provides a clean API for accessing catalog entries throughout the convention plugins.
appupdater/build.gradle.kts (1)
3-5: LGTM on convention plugin adoption.The migration to
libs.plugins.project.androidLibrarycorrectly centralizes the Android library configuration. The simplifiedandroidblock retains only module-specific settings (buildFeatures,namespace), which is the intended pattern for convention plugins.gradle/libs.versions.toml (2)
7-7: **Verify Kotlin version 2.2.21 exists.**Kotlin 2.2.21 is a valid release, released on October 23rd. The version is confirmed.
57-58: LGTM on new plugin infrastructure entries.The android-gradlePlugin and kotlin-gradlePlugin library entries are correctly defined for use in the build-logic composite build. The
project-androidLibraryplugin entry correctly omits a version since it's a local convention plugin resolved via the included build.Also applies to: 67-67
...gic/convention/src/main/java/com/pouyaheydari/appupdater/convention/helpers/ProjectHelper.kt
Show resolved
Hide resolved
...vention/src/main/java/com/pouyaheydari/appupdater/convention/plugins/AndroidLibraryPlugin.kt
Show resolved
Hide resolved
…d library configurations * Added build-logic module with convention plugin infrastructure * Updated all library modules (store, directdownload, compose, appupdater) to use the new convention plugin
a119cf0 to
5a45c1b
Compare
There was a problem hiding this comment.
Actionable comments posted: 4
♻️ Duplicate comments (3)
build-logic/convention/src/main/java/com/pouyaheydari/appupdater/convention/helpers/ProjectHelper.kt (1)
8-10: Add defensive error handling for missing version catalog entries.The
.get()calls onfindVersion()will throwNoSuchElementExceptionif the version keys are missing from the catalog, producing cryptic build configuration errors.Consider using
orElseThrowwith a descriptive message:+import org.gradle.api.GradleException + -fun Project.compileSdk(): Int = baseLibs.findVersion("compileSdkVersion").get().requiredVersion.toInt() +fun Project.compileSdk(): Int = baseLibs.findVersion("compileSdkVersion") + .orElseThrow { GradleException("Missing 'compileSdkVersion' in version catalog") } + .requiredVersion.toInt() -fun Project.minSdk(): Int = baseLibs.findVersion("minSdkVersion").get().requiredVersion.toInt() +fun Project.minSdk(): Int = baseLibs.findVersion("minSdkVersion") + .orElseThrow { GradleException("Missing 'minSdkVersion' in version catalog") } + .requiredVersion.toInt()build-logic/convention/src/main/java/com/pouyaheydari/appupdater/convention/plugins/AndroidLibraryPlugin.kt (1)
34-38: Replace hardcoded Java version with centralized helper.Line 36 hardcodes
17while lines 30-31 use thejavaVersion()helper, creating maintenance inconsistency.Consider extracting the numeric version to maintain consistency:
+private const val JAVA_VERSION = 17 + extensions.configure<KotlinAndroidProjectExtension> { jvmToolchain { - languageVersion.set(JavaLanguageVersion.of(17)) + languageVersion.set(JavaLanguageVersion.of(JAVA_VERSION)) } }Alternatively, update
JavaVersionHelper.ktto expose the numeric version and reference it here.gradle/libs.versions.toml (1)
23-23: Fix the typo in the version key.The key is spelled "roboelectric" but should be "robolectric" to match the correct library name.
Apply this diff:
-roboelectric = "4.16" +robolectric = "4.16"Also update the library reference on line 45:
-roboelectric = { group = "org.robolectric", name = "robolectric", version.ref = "roboelectric" } +robolectric = { group = "org.robolectric", name = "robolectric", version.ref = "robolectric" }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (13)
appupdater/build.gradle.kts(2 hunks)build-logic/convention/.gitignore(1 hunks)build-logic/convention/build.gradle.kts(1 hunks)build-logic/convention/src/main/java/com/pouyaheydari/appupdater/convention/helpers/JavaVersionHelper.kt(1 hunks)build-logic/convention/src/main/java/com/pouyaheydari/appupdater/convention/helpers/ProjectHelper.kt(1 hunks)build-logic/convention/src/main/java/com/pouyaheydari/appupdater/convention/plugins/AndroidLibraryPlugin.kt(1 hunks)build-logic/settings.gradle.kts(1 hunks)build.gradle.kts(0 hunks)compose/build.gradle.kts(1 hunks)directdownload/build.gradle.kts(2 hunks)gradle/libs.versions.toml(3 hunks)settings.gradle.kts(1 hunks)store/build.gradle.kts(1 hunks)
💤 Files with no reviewable changes (1)
- build.gradle.kts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build
🔇 Additional comments (11)
build-logic/convention/.gitignore (1)
1-1: LGTM!Standard gitignore pattern for Gradle build artifacts.
settings.gradle.kts (1)
2-3: LGTM!The composite build inclusion is correctly placed and enables the new convention plugin infrastructure.
build-logic/convention/src/main/java/com/pouyaheydari/appupdater/convention/helpers/JavaVersionHelper.kt (1)
1-5: LGTM!The standalone helper function is appropriate since it returns a project-agnostic constant.
build-logic/settings.gradle.kts (1)
1-16: LGTM!The composite build settings are correctly configured with proper repository management and version catalog references.
gradle/libs.versions.toml (2)
6-7: LGTM!Version updates are reasonable and align with the convention plugin infrastructure.
Also applies to: 9-10, 16-20, 21-23, 26-26
57-58: LGTM!New gradle plugin library entries and project-androidLibrary plugin alias correctly support the convention plugin infrastructure.
Also applies to: 67-67
directdownload/build.gradle.kts (1)
1-7: LGTM!The migration to the convention plugin is correct. Android DSL configuration is now centralized in the
AndroidLibraryPlugin, reducing boilerplate.store/build.gradle.kts (1)
1-8: Verify convention plugin provides all removed Android configuration.The store module has been successfully simplified to rely entirely on the convention plugin for SDK versions, compiler options, and Kotlin toolchain configuration. Ensure
AndroidLibraryPluginis correctly configured with appropriate defaults for all library modules.The configuration is clean and minimal post-migration. Pending verification of the convention plugin implementation.
appupdater/build.gradle.kts (1)
3-5: Verify convention plugin applies jetbrainsKotlinAndroid plugin.The explicit
alias(libs.plugins.jetbrainsKotlinAndroid)alias has been removed, assuming the convention plugin now applies it. ConfirmAndroidLibraryPlugin.ktincludes this plugin in itsapply()chain.compose/build.gradle.kts (2)
1-4: The plugin alias is correctly registered ingradle/libs.versions.tomland maps to the convention plugin ID"com.pouyaheydari.androidLibraryPlugin". No action needed.
1-24: AndroidLibraryPlugin correctly applies jetbrainsKotlinAndroid plugin.Confirmed that
AndroidLibraryPlugin.ktapplies thejetbrainsKotlinAndroidalias (line 19) along withandroidLibraryandmaven.publish. All centralized Android SDK configuration (compileSdk, minSdk, compileOptions, jvmToolchain) is properly configured in the convention plugin, supporting the removal from this file.
This PR adds AndroidLibraryPlugin as a convention plugin to centralize all necessary codes for gradle files of library modules.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.