Introduces pythonforandroid/prerequisites.py (Experimental). This allows a more granular check and install process for dependencies on both CI jobs and users installation.#2591
Conversation
AndreMiras
left a comment
There was a problem hiding this comment.
That works for me if we prefer it that way.
One thing I liked about installing it manually was that in a way it documented how to reproduce it from the command line in macOS.
Say that I didn't have a macOS laptop, but I was testing things on a VM 😏
https://github.com/AndreMiras/VagrantBoxes/tree/master/osx-sierra
Then this can be useful because you can up your VM and run the same script
Considering that improving the setup process and docs should be a priority, I got your point and I agree. I will try to investigate an approach that works for both the Currently, during the CI run we're installing the JDK via Just thinking out loud: I imagine that a "prerequisites lookup and install script" that inspects the user / CI runner environment and asks to perform the prerequisites installations may avoid installing an un-needed JDK version for both the users and CI runners? |
|
Oh right I see thanks for sharing more context. |
54c7a30 to
0847b9c
Compare
…ows a more granular check and install process for dependencies on both CI jobs and users installation.
0847b9c to
0de9354
Compare
efd6260 to
72e9720
Compare
|
@AndreMiras I may have found a valid solution, which will allow what we just talked about. Let me know your thoughts. 😄 |
AndreMiras
left a comment
There was a problem hiding this comment.
Thanks for giving it a though and providing an implementation.
Looks good to me, that's probably enough for a start.
In future post merge iteration we may want to:
- set the JDK version from a single place
- cover the change via tests
- document the feature for user interested to use it
Yeah, absolutely. I've scheduled a major docs review for Instead, tests will inevitably land in the next related PR, as (now that I can have a clearer idea of which are the needs) I will switch to a TDD approach for the next prerequisites. |
✂️ (partially) from #2586
Instead of installing the JDK frombrew, we can useactions/setup-java@v3which correctly handles theJAVA_HOMEasmacos-latestenvironment comes with multiple versions of the JDK pre-installed.On our self-hosted runner, the download viaactions/setup-java@v3seems to be correctly handled (see runs on #2586)During a discussion with @AndreMiras (See below), I decided to propose a different approach for the prerequisites check and related installations, which will allow more granular control over prerequisites, which may lead to potential (unnoticed) issues.
This PR:
Introduces
pythonforandroid/prerequisites.py(Experimental as it doesn't support all thepython-for-androidprerequisites)Allows handling prerequisites in the same way on
Github Actionand on the developer machine.PYTHONFORANDROID_PREREQUISITES_INSTALL_INTERACTIVE=0disables the interactivity (which is enabled by default) of the prerequisiteinstallsection.Even if
check_and_install_default_prerequisites()is called when the toolchain is invoked, ATM we should keep aInstall prerequisites via pythonforandroid/prerequisites.py (Experimental)step, asinstall_android_ndk_sdkneeds a valid Java installation. This will be changed in future.This will allow, when completed, to simplify the onboarding process of a new
python-for-android/buildozeruser, aspython-for-androidis expected to run all the checks and (eventually) the needed installations. Lowering the "first-customer" entry barriers will mean fewer support tickets and increasing theKivyecosystem fan base 😄 ."Check, even multiple times before installing anything" approach. As an example,
JDKPrerequisiteis checking the availability of a validJDKover multiple places, installing a new one should be a last resort, and an installation should be done only if the user consents.As a working example, #2586 has been updated to use this approach.
ubuntu-latest, doesn't have any rule (yet) so just ignores it.macos-latesthave a valid JDK pre-installed, but is not the default one.JDKPrerequisitenotices it and setsJAVA_HOMEto the valid JDK path.apple-silicon-m1doesn't have a valid JDK installed.JDKPrerequisitenotices it and downloads+installsOpenJDK17U-jdk_aarch64_mac_hotspot_17.0.2_8, allowing the CI run to complete.