Skip to content
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

Android library #2092

Merged
merged 3 commits into from
Apr 17, 2020
Merged

Android library #2092

merged 3 commits into from
Apr 17, 2020

Conversation

zworkb
Copy link
Contributor

@zworkb zworkb commented Mar 22, 2020

p4a support for service-backend by packaging an .aar library

This PR is built on #1963 submitted by @xuhcc who did great work in this direction, but unfortunately seems to have not the time to continue the work, so most credit goes to @xuhcc.

In the first turn I took his work and made it work from the current p4a develop (including a buildozer integration, see corresponding PR kivy/buildozer#1037)

I am willing to bring this to a form so that it can be merged and am open for discussions and happy for some good advice...

Most promising was inclement's proposal in which he proposed to pimp up the service_only bootstrap and move the build steps into an aar command.

If no other advice is coming I would go that way, since the service_only bootstrap seems to fit best here, but I don't want to break anything.

I have set up a test project where this can be tested.

UPDATE:

I added support for inheritance in bootstraps, so that a bootstrap inheriting from another bootstrap only needs to ad the files that differ from the original into it's bootstrap dir.

So we avoid file duplication.

what has been done so far:

  • ported @xuhcc's PR to recent p4a master
  • added python3.8 support to pythonforandroid/bootstraps/common/build/src/main/java/org/kivy/android/PythonUtil.java
  • openssl recipe switched to version '1.1.1e' because in 1.1.1 there was a print without ()
  • bootstraps dirs are cumulatively copied based on their inheritance, can be arbitrarily deep
  • add symlink param to copy_files, when set the copy target are symlinked
  • support for the aar directive in buildozer
  • create a 'p4a aar' command, so that lots of cluttering conditionals can be moved away from toolchain.apk()
  • began to remove ant support (@inclement allowed me to do so)
  • renamed library bootstrap to service_library, because that describe it better
  • test setup setup_testlib_service.py

@inclement's change requests are implemented now
PR is ready to merge now

@zworkb zworkb force-pushed the android-library branch 2 times, most recently from 09cdd92 to 13287b2 Compare March 29, 2020 21:34
@@ -274,7 +274,7 @@ def compile_dir(dfn, optimize_python=True):
def make_package(args):
# If no launcher is specified, require a main.py/main.pyo:
if (get_bootstrap_name() != "sdl" or args.launcher is None) and \
get_bootstrap_name() != "webview":
get_bootstrap_name() not in ["webview", "service_library"]:
Copy link
Member

Choose a reason for hiding this comment

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

This look like it should be a setting on the bootstrap.

Copy link
Member

@inclement inclement left a comment

Choose a reason for hiding this comment

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

I originally limited the symlinking to the java source because that was the only thing I found useful to link that way, and I wasn't sure if all the android tools would be happy to work on symlinks. If you can vouch that symlinking more stuff works okay, then I don't see an issue.

pythonforandroid/bootstraps/common/build/whitelist.txt Outdated Show resolved Hide resolved
pythonforandroid/build.py Outdated Show resolved Hide resolved
pythonforandroid/recipes/android/__init__.py Outdated Show resolved Hide resolved
pythonforandroid/bootstrap.py Show resolved Hide resolved
pythonforandroid/bootstrap.py Outdated Show resolved Hide resolved
pythonforandroid/bootstraps/common/build/build.py Outdated Show resolved Hide resolved
pythonforandroid/bootstraps/common/build/build.py Outdated Show resolved Hide resolved
pythonforandroid/bootstrap.py Outdated Show resolved Hide resolved
@inclement
Copy link
Member

This looks good to me, just a few minor comments in the review.

@zworkb zworkb force-pushed the android-library branch 6 times, most recently from 8d51362 to 42e05d1 Compare April 5, 2020 12:26
* ported @xuhcc's PR 1063 to recent p4a master

* bootstraps dirs are cumulatively copied based on their inheritance, can be arbitrarily deep

* add symlink param to copy_files, when set the copy target are symlinked

* support for the aar directive in buildozer

* create a 'p4a aar' command, so that lots of cluttering conditionals can be moved away from toolchain.apk()

* began to remove ant support (@inclement allowed me to do so)

* renamed library bootstrap to service_library, because that describe it better

* test setup setup_testlib_service.py

* renamed symlink_java_src to symlink_bootstrap_files

* None is not allowed as bootstrap parameter

* switched tests to use the sdl2 bootstrap
@inclement inclement merged commit 36bc8a4 into kivy:develop Apr 17, 2020
@inclement
Copy link
Member

Thanks for all the rebase effort!

AndreMiras added a commit to AndreMiras/python-for-android that referenced this pull request May 9, 2020
Also removes unused `mActivity` member.
Note we changed the constructor input parameter to accept a `Context`
object which is a parent class of the previous `Activity` one.
Changes were tested on both kivy and service_only bootstraps.
Also removes the `get_common_dir()` as it's no longer used since kivy#2092
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.

4 participants