Skip to content

[local_auth] Convert to Kotlin gradle for the plugin build files#11169

Open
stuartmorgan-g wants to merge 8 commits intoflutter:mainfrom
stuartmorgan-g:kotlin-gradle-for-plugin-initial-local-auth
Open

[local_auth] Convert to Kotlin gradle for the plugin build files#11169
stuartmorgan-g wants to merge 8 commits intoflutter:mainfrom
stuartmorgan-g:kotlin-gradle-for-plugin-initial-local-auth

Conversation

@stuartmorgan-g
Copy link
Collaborator

@stuartmorgan-g stuartmorgan-g commented Mar 3, 2026

Following up from #11127, this is the initial example of converting a plugin build, rather than an example app build, to Kotlin gradle.

This conversion was done manually, but closely referencing the current plugin template files. It differs mostly in not having the parts that are specific to the use of Kotlin source files, since local_auth is still Java-only. Later (when we start adopting Kotlin Pigeon generation everywhere, for instance) some of the diffs relative to the template files will go away.

Unlike #11127 this did not require tool changes, as it turns out that the previous changes were enough to handle these files, but I did add more tests. As with #11127 I did not attempt to comprehensively duplicate all Groovy tests, since we should be able to relatively quickly convert everything in the repo, and then pull out the Groovy support and update all the tests to Kotlin.

Note that this does not convert the plugin's example app to Kotlin gradle, only the plugin itself. The example app for plugins are non-trivial enough (due to native tests) that they should be converted separately. This has the bonus effect of validating that the plugin migration didn't require any changes in the client app.

Part of flutter/flutter#176065

Pre-Review Checklist

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. 2

checkAllWarnings = true
warningsAsErrors = true
disable 'AndroidGradlePluginVersion', 'InvalidPackage', 'GradleDependency', 'NewerVersionAvailable'
disable.addAll(setOf("AndroidGradlePluginVersion", "InvalidPackage", "GradleDependency", "NewerVersionAvailable"))
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

A note here in case future us wonders why it's written this way: the examples I found in official docs did something like:

disable += "AndroidGradlePluginVersion" + "InvalidPackage" + "GradleDependency" + "NewerVersionAvailable"

When I tried that it was clearly doing string concatenation rather than list addition (I got an error about AndroidGradlePluginVersionInvalidPackageGradleDependencyNewerVersionAvailable being an unknown lint to ignore). I'm assuming that's a Gradle version issue or something? This version works, and seemed reasonable.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

https://developer.android.com/studio/write/lint#gradle was the documentation I found, for posterity.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request converts the local_auth_android plugin's Gradle build files from Groovy to Kotlin DSL, which is a good step towards modernizing the build process. The changes involve renaming build.gradle and settings.gradle to use the .kts extension and updating their syntax accordingly. Additionally, the gradle-check command's tests have been updated to accommodate and validate these new Kotlin Gradle files, including the addition of a new test helper and relevant test cases. The conversion of the plugin's build files appears to be well-executed. I have one suggestion to improve the new test helper code.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant