Skip to content

Upgraded ShopSync from Groovy to Kotlin DSL in Gradle and changed some translations#173

Merged
aadishsamir123 merged 6 commits into
mainfrom
phone+wear/chore/kotlin-dsl
Dec 25, 2025
Merged

Upgraded ShopSync from Groovy to Kotlin DSL in Gradle and changed some translations#173
aadishsamir123 merged 6 commits into
mainfrom
phone+wear/chore/kotlin-dsl

Conversation

@aadishsamir123

@aadishsamir123 aadishsamir123 commented Dec 25, 2025

Copy link
Copy Markdown
Member

This pull request migrates the Android build configuration from Groovy-based Gradle files to Kotlin DSL (.kts) equivalents. The migration modernizes the build setup, improves type safety, and aligns with current best practices for Android and Flutter projects. Additionally, the version codes and names for both phone and wear product flavors have been incremented.

Build System Migration:

  • Replaced android/app/build.gradle with android/app/build.gradle.kts, converting all configuration to Kotlin DSL and updating phone and wear version codes/names. [1] [2]
  • Replaced android/build.gradle with android/build.gradle.kts, converting project structure and clean task definitions to Kotlin DSL. [1] [2]
  • Replaced android/settings.gradle with android/settings.gradle.kts, migrating plugin management and plugin declarations to Kotlin DSL. [1] [2]

Localization:

  • Removed the empty lib/l10n/app_zh.arb file.

Summary by CodeRabbit

  • Chores
    • Migrated Android build/configuration to a new Kotlin-based build system for improved consistency.
    • Consolidated app build settings, flavor/version handling, and release signing behavior.
    • Reworked project-level settings and build directories for more predictable project builds.
    • CI workflows: removed Gradle cache option from Java setup/build jobs.

✏️ Tip: You can customize this high-level summary in your review settings.

@aadishsamir123 aadishsamir123 added app:phone Related to ShopSync Phone/Web app app:wearos Related to ShopSync WearOS app labels Dec 25, 2025
@coderabbitai

coderabbitai Bot commented Dec 25, 2025

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Replaced Groovy Gradle scripts with Kotlin DSL across the Android project: removed *.gradle files and added corresponding *.gradle.kts files. App module, root build, and settings were migrated; CI workflows had Gradle cache lines removed.

Changes

Cohort / File(s) Summary
App module Gradle
android/app/build.gradle, android/app/build.gradle.kts
Removed Groovy build.gradle; added Kotlin DSL build.gradle.kts with plugin declarations (Android app, Google Services, Kotlin, Flutter), keystore/key.properties loading, signingConfigs, android block (namespace, compileSdk, ndkVersion, Java/Kotlin compatibility), defaultConfig (applicationId, minSdk 29, targetSdk 35, manifestPlaceholder), productFlavors phone/wear, buildTypes, and flutter { source = rootProject.projectDir }.
Root build script
android/build.gradle, android/build.gradle.kts
Removed Groovy root build script; added Kotlin DSL build.gradle.kts restoring repositories (google, mavenCentral), root build directory (../build), per-subproject buildDirectory layout, evaluationDependsOn(":app"), and registered clean task (Delete) to remove root build dir.
Settings / pluginManagement
android/settings.gradle, android/settings.gradle.kts
Deleted Groovy settings.gradle; added Kotlin DSL settings.gradle.kts with pluginManagement resolving Flutter SDK via local.properties, includeBuild for Flutter tools, repositories, plugins block (dev.flutter.flutter-plugin-loader 1.0.0, com.android.application 8.6.0 apply false, com.google.gms.google-services 4.3.15 apply false, org.jetbrains.kotlin.android 2.1.21 apply false), and include(":app").
CI workflows (Gradle cache removal)
.github/workflows/CD-Prod-Play-Phone.yml, .github/workflows/CD-Prod-Play-WearOS.yml, .github/workflows/CI.yml
Removed cache: gradle settings from Java setup steps in multiple workflows; no other workflow control-flow changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • Added WearOS Support #140 — Also migrates Android build/settings to Kotlin DSL and adjusts CI for separate Phone/WearOS builds.

Pre-merge checks

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main changes: Gradle build system migration from Groovy to Kotlin DSL and localization updates. It is specific and clearly conveys the primary objectives.
Description check ✅ Passed The description comprehensively covers the migration with specific file replacements, organized sections, and references. However, the template is minimal and does not specify mandatory sections beyond general guidelines.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a553cbb and 770c0b4.

📒 Files selected for processing (3)
  • .github/workflows/CD-Prod-Play-Phone.yml
  • .github/workflows/CD-Prod-Play-WearOS.yml
  • .github/workflows/CI.yml
💤 Files with no reviewable changes (3)
  • .github/workflows/CD-Prod-Play-WearOS.yml
  • .github/workflows/CD-Prod-Play-Phone.yml
  • .github/workflows/CI.yml
⏰ 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). (7)
  • GitHub Check: Build WearOS Flavor
  • GitHub Check: Build Web (WASM)
  • GitHub Check: Build Phone Flavor
  • GitHub Check: Tests & Coverage
  • GitHub Check: Build Web (WASM)
  • GitHub Check: Build Phone (Debug)
  • GitHub Check: Build WearOS (Debug)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Comment on lines +34 to +40
signingConfigs {
register("release") {
keyAlias = keystoreProperties["keyAlias"] as String
keyPassword = keystoreProperties["keyPassword"] as String
storeFile = keystoreProperties["storeFile"]?.let { file(it.toString()) }
storePassword = keystoreProperties["storePassword"] as String
}

This comment was marked as outdated.

@coderabbitai coderabbitai Bot added enhancement New feature or request semver-minor Minor Updates labels Dec 25, 2025

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (3)
android/build.gradle.kts (1)

9-14: Consider merging duplicate subprojects blocks.

Two separate subprojects blocks can be consolidated into a single block for improved readability.

🔎 Proposed consolidation
 rootProject.layout.buildDirectory.set(file("../build"))
 subprojects {
     project.layout.buildDirectory.set(file("${rootProject.layout.buildDirectory.get()}/${project.name}"))
-}
-subprojects {
     project.evaluationDependsOn(":app")
 }
android/app/build.gradle.kts (1)

1-2: Unused import: FileInputStream.

FileInputStream is imported but can be replaced with Kotlin's inputStream() extension for cleaner code.

🔎 Proposed fix
 import java.util.Properties
-import java.io.FileInputStream

Then update line 17:

 if (keystorePropertiesFile.exists()) {
-    keystoreProperties.load(FileInputStream(keystorePropertiesFile))
+    keystorePropertiesFile.inputStream().use { keystoreProperties.load(it) }
 }
android/settings.gradle.kts (1)

2-8: Missing existence check for local.properties.

Unlike the keystore loading in build.gradle.kts, this code doesn't check if local.properties exists before reading. While Flutter typically generates this file, a fresh clone without running flutter pub get will fail with an unclear error.

Consider adding a more descriptive error or existence check:

🔎 Proposed improvement
     val flutterSdkPath: String = run {
         val properties = java.util.Properties()
-        file("local.properties").inputStream().use { properties.load(it) }
+        val localPropertiesFile = file("local.properties")
+        require(localPropertiesFile.exists()) { 
+            "local.properties not found. Run 'flutter pub get' to generate it." 
+        }
+        localPropertiesFile.inputStream().use { properties.load(it) }
         val flutterSdkPath = properties.getProperty("flutter.sdk")
         requireNotNull(flutterSdkPath) { "flutter.sdk not set in local.properties" }
         flutterSdkPath
     }
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 264e275 and b75fc5f.

📒 Files selected for processing (7)
  • android/app/build.gradle
  • android/app/build.gradle.kts
  • android/build.gradle
  • android/build.gradle.kts
  • android/settings.gradle
  • android/settings.gradle.kts
  • lib/l10n/app_zh.arb
💤 Files with no reviewable changes (4)
  • lib/l10n/app_zh.arb
  • android/app/build.gradle
  • android/settings.gradle
  • android/build.gradle
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: aadishsamir123
Repo: ASDev-Official/shopsync PR: 147
File: android/app/build.gradle:51-58
Timestamp: 2025-12-05T14:08:58.025Z
Learning: For android/app/build.gradle in the shopsync repository: Use version code format `XXYYYYYYY` where XX=platform (30=phone, 40=wear), YYYYYYY=versionCode. Phone uses base 300000000, wear uses base 400000000.
📚 Learning: 2025-12-15T14:57:06.393Z
Learnt from: CR
Repo: ASDev-Official/shopsync PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-15T14:57:06.393Z
Learning: Applies to android/app/build.gradle : Define build flavors with dimension 'platform' for phone (flavor phone) and wear (flavor wear) in Gradle configuration

Applied to files:

  • android/app/build.gradle.kts
📚 Learning: 2025-12-05T14:08:58.025Z
Learnt from: aadishsamir123
Repo: ASDev-Official/shopsync PR: 147
File: android/app/build.gradle:51-58
Timestamp: 2025-12-05T14:08:58.025Z
Learning: For android/app/build.gradle in the shopsync repository: Use version code format `XXYYYYYYY` where XX=platform (30=phone, 40=wear), YYYYYYY=versionCode. Phone uses base 300000000, wear uses base 400000000.

Applied to files:

  • android/app/build.gradle.kts
🔇 Additional comments (5)
android/build.gradle.kts (1)

1-18: LGTM — clean migration to Kotlin DSL.

The root build configuration correctly migrates repository declarations, build directory setup, and the clean task to Kotlin DSL syntax.

android/app/build.gradle.kts (2)

54-69: Version code scheme correctly follows project convention.

The version codes use the established format XXYYYYYYY where phone uses base 300000000 and wear uses base 400000000. Based on learnings, this is the expected pattern.


58-65: manifestPlaceholders.clear() removes credentialManagerEnabled set in defaultConfig.

Calling manifestPlaceholders.clear() in each product flavor (lines 58 and 65) will remove the credentialManagerEnabled = true placeholder defined in defaultConfig (line 49). If Credential Manager is needed for both flavors, this may break Google Sign-In functionality.

Is removing the credential manager placeholder intentional for these flavors? If not:

🔎 Proposed fix to preserve the placeholder
         create("phone") {
             val phoneBaseVersionCode = 300000000
             val phoneVersionCode = 7
             dimension = "platform"
-            manifestPlaceholders.clear()
             versionName = "5.0.2-phone"
             versionCode = phoneBaseVersionCode + phoneVersionCode
         }
         create("wear") {
             val wearBaseVersionCode = 400000000
             val wearVersionCode = 5
-            manifestPlaceholders.clear()
             dimension = "platform"
             versionName = "1.2.3-wear"
             versionCode = wearBaseVersionCode + wearVersionCode
         }
android/settings.gradle.kts (2)

19-28: Plugin declarations and module inclusion look correct.

The plugins block properly declares the required plugins with apply false for those applied at the app level, and the :app module is correctly included.


25-25: Kotlin version 2.1.21 is a valid official release (published May 13, 2025) and not a typo. No action required. If desired, Kotlin 2.3.0 is now available as the latest stable version (released December 16, 2025).

Comment thread android/app/build.gradle.kts
Comment thread android/settings.gradle.kts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
android/app/build.gradle.kts (1)

34-43: Unsafe casts still present—past reviews remain valid.

The signing configuration checks if key.properties exists but still uses unsafe casts (as String) on property values. If the file exists but lacks required keys, this will throw a ClassCastException or NullPointerException during Gradle configuration.

The past review suggestions to use null-safe access (as? String or getProperty()) and conditionally register the signing config only when all required values are present remain applicable.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b75fc5f and a553cbb.

📒 Files selected for processing (1)
  • android/app/build.gradle.kts
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: aadishsamir123
Repo: ASDev-Official/shopsync PR: 147
File: android/app/build.gradle:51-58
Timestamp: 2025-12-05T14:08:58.025Z
Learning: For android/app/build.gradle in the shopsync repository: Use version code format `XXYYYYYYY` where XX=platform (30=phone, 40=wear), YYYYYYY=versionCode. Phone uses base 300000000, wear uses base 400000000.
📚 Learning: 2025-12-15T14:57:06.412Z
Learnt from: CR
Repo: ASDev-Official/shopsync PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-15T14:57:06.412Z
Learning: Applies to android/app/build.gradle : Define build flavors with dimension 'platform' for phone (flavor phone) and wear (flavor wear) in Gradle configuration

Applied to files:

  • android/app/build.gradle.kts
📚 Learning: 2025-12-05T14:08:58.025Z
Learnt from: aadishsamir123
Repo: ASDev-Official/shopsync PR: 147
File: android/app/build.gradle:51-58
Timestamp: 2025-12-05T14:08:58.025Z
Learning: For android/app/build.gradle in the shopsync repository: Use version code format `XXYYYYYYY` where XX=platform (30=phone, 40=wear), YYYYYYY=versionCode. Phone uses base 300000000, wear uses base 400000000.

Applied to files:

  • android/app/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). (7)
  • GitHub Check: Build WearOS Flavor
  • GitHub Check: Tests & Coverage
  • GitHub Check: Build Phone Flavor
  • GitHub Check: Build Web (WASM)
  • GitHub Check: Build WearOS (Debug)
  • GitHub Check: Build Web (WASM)
  • GitHub Check: Build Phone (Debug)

Comment thread android/app/build.gradle.kts
@aadishsamir123 aadishsamir123 merged commit 74e855b into main Dec 25, 2025
19 of 26 checks passed
@aadishsamir123 aadishsamir123 deleted the phone+wear/chore/kotlin-dsl branch December 25, 2025 01:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app:phone Related to ShopSync Phone/Web app app:wearos Related to ShopSync WearOS app enhancement New feature or request semver-minor Minor Updates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant