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

Bootstrap backend for Android Library project #1963

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

Conversation

xuhcc
Copy link

@xuhcc xuhcc commented Aug 22, 2019

Added new bootstrap backend for packaging python service as Android library.

Resolves #1957

I'm not familiar with python-for-android codebase, so I tried to keep changes to existing modules to a minimum. Some files (e.g. jtar classes) are simply copied from the service_only bootstrap. I'm not sure what's the best approach here. Maybe we can move them to bootstraps/common?

@@ -0,0 +1,113 @@
package {{ args.package }};
Copy link
Member

Choose a reason for hiding this comment

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

Are you sure this file is needed?

Copy link
Author

Choose a reason for hiding this comment

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

This file contains code for setting service properties (like its entry point) and code for unpacking python bundle. I'm not sure that it is needed, but I don't know how to do these things without it.

@AndreMiras
Copy link
Member

Looking good overall. I'd still like to dig more before we can merge. I'm just pretty sad to see we still need quite a lot of copy pasta for adding new bootstrap. We were supposed to mitigate it via #1496 and #991 but we still have a lot to do it seems.

@inclement
Copy link
Member

I'm not clear from the code alone, what exactly is new/different in this bootstrap compared to (say) the service_only one? Would it be possible to make the aar thing a build option instead of a bootstrap?

@xuhcc
Copy link
Author

xuhcc commented Aug 24, 2019

@inclement

The main difference is that in service_only bootstrap services depend on PythonActivity class. You need to start activity to extract python bundle and only after that you can start services.

For library bootstrap I moved the unpackData method to service class itself and added custom AssetExtract class which depend on Context instead of Activity.

I think it is possible to make it a build option for service_only bootstrap, but I'm not sure how to do it correctly.

@inclement
Copy link
Member

Thanks for the clarifications @xuhcc. My current thinking is that this would be preferable to add as functionality to one or more existing bootstraps, and to call it using a new p4a aar command instead of overloading apk (this would be much nicer in general than starting to add if statements based on the bootstrap type). However, I'm saying this from a position of not having really checked the details of how it needs to work.

@zworkb zworkb mentioned this pull request Mar 22, 2020
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.

Building an Android Library
3 participants