Skip to content

Add Kotlin Gradle script example to Android README section #167

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

complexspaces
Copy link
Collaborator

This PR adds a documented example of how to use the Android component when your Android app uses Kotlin script files instead of Groovy scripts to handle the Gradle build system. We've now had ~2-3 people ask about this, so I think that justifies giving the information a proper spot instead of linking to a issue comment over and over.

The implementation is based primarily off this older example I posted last year, with a few changes adapted from 1P's current production scripts. I opted to keep it in a collapsed section to avoid making the README any longer to scroll through.

Closes #166.

@djc
Copy link
Member

djc commented Apr 25, 2025

I don't think I have the experience to be able to review this change.

@complexspaces
Copy link
Collaborator Author

That's perfectly ok, thanks for the heads up. I just wanted to at least give the other maintainers a chance to look it over.

Does it sound fine to wait another week or so for Daniel (as the other person who's worked on Android stuff) and after that just proceed with merging this? These are just documentation changes and I'm entirely confident in the Kotlin script itself being correct.

Copy link
Member

@cpu cpu left a comment

Choose a reason for hiding this comment

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

These are just documentation changes and I'm entirely confident in the Kotlin script itself being correct.

Like djc I have to admit my experience here isn't super helpful. This is the only Gradle project I've used and I've written almost zero Kotlin 😆

That said, it seems to match the implementation of the pre-existing Groovy version and since you're confident I think we should merge it without spending any extra time trying to find expert reviews (it is just an example after all).

@@ -142,7 +142,7 @@ repositories {
String findRustlsPlatformVerifierProject() {
def dependencyText = providers.exec {
it.workingDir = new File("../")
commandLine("cargo", "metadata", "--format-version", "1", "--manifest-path", "$PATH_TO_DEPENDENT_CRATE/Cargo.toml")
commandLine("cargo", "metadata", "--format-version", "1", "--filter-platform", "aarch64-linux-android", "--manifest-path", "$PATH_TO_DEPENDENT_CRATE/Cargo.toml")
Copy link
Member

Choose a reason for hiding this comment

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

Should the text above be updated to mention the --filter-platform? I assume for larger projects it's probably something that can't be fixed to just aarch64-linux-android and needs some special consideration (?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add documentation examples for kotlin format
3 participants