chore: migrate Gradle build files from Groovy DSL to Kotlin DSL - #1208
Open
Elforama wants to merge 2 commits into
Open
chore: migrate Gradle build files from Groovy DSL to Kotlin DSL#1208Elforama wants to merge 2 commits into
Elforama wants to merge 2 commits into
Conversation
|
👋 Hi @Elforama, thanks for the contribution! Before this PR can be reviewed and merged, please add:
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 |
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.
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.tomlroborazziplugin entry to[plugins]section (was previously only available as a classpath library dependency)settings.gradle→settings.gradle.ktspluginManagementblock with repositories (absorbs what was in rootbuildscript { repositories {} })dependencyResolutionManagementblock withFAIL_ON_PROJECT_REPOSmode (centralizes repositories that were scattered across rootallprojects {}andapp/build.gradle)includeandrootProject.nameto Kotlin syntaxbuild.gradle→build.gradle.kts(root)buildscript { classpath ... }block withplugins { alias(libs.plugins.xxx) apply false }using version catalog aliasesallprojects {}block:apply plugin:→apply(plugin = ...),ktlint {}→configure<KtlintExtension> {}allprojects { repositories {} }(moved tosettings.gradle.kts)ext {}properties toext { set("key", "value") }syntaxsubprojects {}block:detekt {}→configure<DetektExtension> {},spotless {}→configure<SpotlessExtension> {}tasks.register<Delete>("clean")with non-deprecatedlayout.buildDirectoryapp/build.gradle→app/build.gradle.ktsapply plugin: 'com.google.gms.google-services'from bottom of file intoplugins {}blockloadExtraPropertiesfunction: Rewritten in Kotlin withProperties/FileInputStreamimports,stringPropertyNames()iteration (avoids Kotlinvalkeyword conflict), and a file-exists guard for the gitignoredtreetracker.keys.properties=assignment operators to all property setters,.toInteger()→.toInt()debug/releaseusegetByName(), custom types (prerelease,beta,dev) usecreate(). Reordered sodebugis configured before types that reference it viainitWith(getByName("debug")). Boolean property renames:minifyEnabled→isMinifyEnabled,debuggable→isDebuggable,coreLibraryDesugaringEnabled→isCoreLibraryDesugaringEnabledsigningConfig:signingConfigs.debug→signingConfigs.getByName("debug")packagingOptions: Replaced deprecated API withpackaging { resources { excludes += setOf(...) } }testOptions:includeAndroidResources→isIncludeAndroidResources,.toLowerCase()→.lowercase()def→val,tasks.withType(Test)→tasks.withType<Test>(),.matches("regex")→.matches(Regex("regex")),$buildDir→layout.buildDirectory.get().asFilerepositories {}block (now handled by settings)API_GATEWAYbuildConfigField in defaultConfigTest plan
./gradlew projects— settings parse correctly./gradlew assembleDebug— debug build succeeds./gradlew testDebugUnitTest— unit tests passassembleRelease,assembleBeta,assemblePrerelease,assembleDevbuild typesktlintCheck,detekt,spotlessCheckcode quality plugins still work