-
-
Notifications
You must be signed in to change notification settings - Fork 30.5k
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
gh-116622: Add Android testbed #117878
gh-116622: Add Android testbed #117878
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given the nature of the recent xz exploit - is there any way that this artefact can be obtained programatically, rather than being embedded as a a binary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it would make sense to have this in a separate repo, so it's only downloaded when testing Android support?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Size isn't a concern, as it's only 59 KB, and it doesn't ever need to be updated. In fact, the version of this file in the Chaquopy demo hasn't been updated in 7 years.
So I think all that's necessary is for a core developer to verify that the file is identical to Android Studio's own copy. You can do that by checking the Android Studio repository here – use the "tgz" link to download just that directory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
peanut gallery comment: If anyone does have a license problem with this being in the repo, the other option is to have this be downloaded at build/test time from the canonical Android Studio repository and verify that its sha256 matches. (it means there'd be a required network connection for this unless someone pre-fetches it themselves, but that usually isn't a problem)
From a CPython perspective I believe the only place we'd be redistributing this beyond the git repo is in our source releases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, based on the discussion below, I'll make it a scripted download rather than including it directly in the repository.
I can confirm that the But, one thing that's not clear to me: what is the license for these files? In the Android Studio repository, I couldn't find any license at all. The Android Studio download & installer made me agree to a “non-assignable, non-sublicensable” license, which limits what the SDK can be used for, and doesn't cover everything that Python's license allows. |
The three files |
Concerns were raised on Discord that the source of the Gradle files wasn't clear enough, so I've updated them from the current version of Gradle (8.7). Here's how to verify them:
|
Thanks. The testing instructions added in Including the jar means we're trusting a third party -- Gradle -- and their build process. I don't have a reason to trust them, and I don't think that CPython should implicitly vouch for them. If there are any license issues found later, it's much easier to remove things if they're in an isolated repo/branch. (And it's also easier for over-cautious redistributors to not include the testbed.) Note that I am a Linux distro packager by training, conditioned to include sources and avoid bundling. I might not be representing the CPython project well. I am definitely unfamiliar with mobile development practices. If you think I'm being unreasonable, please do seek other opinions, e.g. on Discourse. |
Thanks, that all makes sense.
Even simpler than a separate repository would be to add an option to the android.py script to obtain the Gradle wrapper directly from Gradle – essentially automating the steps listed in my previous comment. This would be no different from downloading compilers from a third party, as we do on every platform.
Actually I've got a pretty good idea of what can be pruned. My initial plan was to keep the app as close as possible to Android Studio's new project wizard output, but I guess that does include a lot of noise. Let me see what I can do. |
OK, I've removed the Gradle wrapper, added an android.py subcommand to download it, and removed all the unused boilerplate from the app, which should make the PR a lot more manageable. |
Thank you! This looks good; I haven't tested it. |
I've added a list of the required tools to the README. And I've also switched from |
Android/testbed/app/src/main/res/drawable-xxhdpi/ic_launcher.png
Outdated
Show resolved
Hide resolved
Co-authored-by: Hugo van Kemenade <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thank you!
I was able to start the test suite! (There were some errors, and I didn't wait for it to finish on my non-accelerated VM, but that shouldn't block this PR.)
I have some more suggestions for the guide, to help newbies like me.
Additionally, consider introducing the cross-build therm "host" here:
Additionally
Building for Android requires doing a cross-build where you have a "build"
- Python to help produce an Android build of CPython. This procedure has been
+ Python to help produce an Android build of CPython (the "host" build). This procedure has been
tested on Linux and macOS.
Co-authored-by: Petr Viktorin <[email protected]>
Everything was passing on Android a couple of weeks ago, but unrelated development has introduced a few failures since then. The next priority will be to set up a buildbot so we can find out about such failures more quickly.
Done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thank you!
Add code and config for a minimal Android app, and instructions to build and run it. Improve Android build instructions in general. Add a tool subcommand to download the Gradle wrapper (with its binary blob). Android studio must be downloaded manually (due to the license).
This PR adds a testbed app to run the Python test suite on Android. Instructions for using it are in Android/README.md.
Most of the files in this PR are boilerplate generated by the Android Studio new project wizard. To make it easier to review, I've split it into two commits:
Android app projects require a binary gradle-wrapper.jar, and two gradlew scripts to launch it. The integrity of these files can be verified by creating a new project in Android Studio Hedgehog – all three files in the new project should be identical to the versions in this PR.
Since myself and @freakboy3742 are now on the triage team, I've also added us to the CODEOWNERS file for Android and iOS respectively.