Skip to content

chore: migrate Gradle build files from Groovy DSL to Kotlin DSL - #1208

Open
Elforama wants to merge 2 commits into
masterfrom
chore/migrate-gradle-kotlin-dsl
Open

chore: migrate Gradle build files from Groovy DSL to Kotlin DSL#1208
Elforama wants to merge 2 commits into
masterfrom
chore/migrate-gradle-kotlin-dsl

Conversation

@Elforama

@Elforama Elforama commented Mar 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Migrates all 3 Gradle build files from Groovy DSL (.gradle) to Kotlin DSL (.gradle.kts), following the official Android migration guide.

Changes

gradle/libs.versions.toml

  • Added roborazzi plugin entry to [plugins] section (was previously only available as a classpath library dependency)

settings.gradlesettings.gradle.kts

  • Added pluginManagement block with repositories (absorbs what was in root buildscript { repositories {} })
  • Added dependencyResolutionManagement block with FAIL_ON_PROJECT_REPOS mode (centralizes repositories that were scattered across root allprojects {} and app/build.gradle)
  • Converted include and rootProject.name to Kotlin syntax

build.gradlebuild.gradle.kts (root)

  • Replaced buildscript { classpath ... } block with plugins { alias(libs.plugins.xxx) apply false } using version catalog aliases
  • Converted allprojects {} block: apply plugin:apply(plugin = ...), ktlint {}configure<KtlintExtension> {}
  • Removed allprojects { repositories {} } (moved to settings.gradle.kts)
  • Converted ext {} properties to ext { set("key", "value") } syntax
  • Converted subprojects {} block: detekt {}configure<DetektExtension> {}, spotless {}configure<SpotlessExtension> {}
  • Converted clean task to tasks.register<Delete>("clean") with non-deprecated layout.buildDirectory

app/build.gradleapp/build.gradle.kts

  • Plugins: Converted all plugin declarations to version catalog aliases; moved apply plugin: 'com.google.gms.google-services' from bottom of file into plugins {} block
  • loadExtraProperties function: Rewritten in Kotlin with Properties/FileInputStream imports, stringPropertyNames() iteration (avoids Kotlin val keyword conflict), and a file-exists guard for the gitignored treetracker.keys.properties
  • Android block: Added = assignment operators to all property setters, .toInteger().toInt()
  • Build types: debug/release use getByName(), custom types (prerelease, beta, dev) use create(). Reordered so debug is configured before types that reference it via initWith(getByName("debug")). Boolean property renames: minifyEnabledisMinifyEnabled, debuggableisDebuggable, coreLibraryDesugaringEnabledisCoreLibraryDesugaringEnabled
  • signingConfig: signingConfigs.debugsigningConfigs.getByName("debug")
  • packagingOptions: Replaced deprecated API with packaging { resources { excludes += setOf(...) } }
  • testOptions: includeAndroidResourcesisIncludeAndroidResources, .toLowerCase().lowercase()
  • Roborazzi task config: defval, tasks.withType(Test)tasks.withType<Test>(), .matches("regex").matches(Regex("regex")), $buildDirlayout.buildDirectory.get().asFile
  • Dependencies: Added parentheses to all declaration calls
  • Removed standalone repositories {} block (now handled by settings)
  • Fixed missing inner quotes on API_GATEWAY buildConfigField in defaultConfig

Test plan

  • ./gradlew projects — settings parse correctly
  • ./gradlew assembleDebug — debug build succeeds
  • ./gradlew testDebugUnitTest — unit tests pass
  • Verify assembleRelease, assembleBeta, assemblePrerelease, assembleDev build types
  • Verify ktlintCheck, detekt, spotlessCheck code quality plugins still work
  • Verify Android Studio sync works correctly

@github-actions

Copy link
Copy Markdown

👋 Hi @Elforama, thanks for the contribution!

Before this PR can be reviewed and merged, please add:

  • a 🎥 screen recording / video demonstrating the change — a video is required even when there are no UI changes, to show that the parts of the app affected by this change still work
  • a 🖼️ screenshot of the UI change (or mark the PR as non-ui if there is no UI change)

Just drag-and-drop the file(s) into the PR description and GitHub will upload them. This check re-runs automatically when you edit the description.

If this change has no user-visible effect, tick the "no user-visible / UI effect" box in the description (or ask a maintainer to add the non-ui label) to skip the screenshot requirement. A video is still required even with no UI changes, to show that the affected parts of the app still work.

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

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants