-
Notifications
You must be signed in to change notification settings - Fork 2k
allow dumping and loading the manifest file #1439
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
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -355,20 +355,29 @@ def make_package(args): | |
| key=LooseVersion) | ||
| build_tools_version = build_tools_versions[-1] | ||
|
|
||
| render( | ||
| 'AndroidManifest.tmpl.xml', | ||
| 'src/main/AndroidManifest.xml', | ||
| args=args, | ||
| service=service, | ||
| service_names=service_names, | ||
| android_api=android_api, | ||
| url_scheme=url_scheme) | ||
| manifest_path = join('src', 'main', 'AndroidManifest.xml' | ||
|
|
||
| if args.load_manifest: | ||
| shutil.copy(args.load_manifest, manifest_path) | ||
|
|
||
| else: | ||
| render( | ||
| 'AndroidManifest.tmpl.xml', | ||
| manifest_path, | ||
| args=args, | ||
| service=service, | ||
| service_names=service_names, | ||
| android_api=android_api, | ||
| url_scheme=url_scheme) | ||
|
|
||
| if args.save_manifest: | ||
| shutil.copy(manifest_path, args.save_manifest) | ||
|
|
||
| # Copy the AndroidManifest.xml to the dist root dir so that ant | ||
| # can also use it | ||
| if exists('AndroidManifest.xml'): | ||
| remove('AndroidManifest.xml') | ||
| shutil.copy(join('src', 'main', 'AndroidManifest.xml'), | ||
| shutil.copy(manifest_path), | ||
| 'AndroidManifest.xml') | ||
|
|
||
| render( | ||
|
|
@@ -518,6 +527,10 @@ def parse_args(args=None): | |
| help='Add this Java class as an Activity to the manifest.') | ||
| ap.add_argument('--activity-launch-mode', dest='activity_launch_mode', | ||
| help='Set the launch mode of the main activity in the manifest.') | ||
| ap.add_argument('--save-manifest', dest='save_manifest', default='', | ||
| help="If set to a path, the created manifest will be saved to this path.") | ||
| ap.add_argument('--load-manifest', dest='load_manifest', default='', | ||
| help="If set to a path, the manifest will be loaded from this path.") | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure if the paths will be messed up at this point, since the script is run from a directory that is different to the one the user ran from, so e.g. if they wrote './mymanifest.xml' that path won't make sense any more. I think there is some handling of this issue elsewhere in the p4a arguments. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that's a good point, we should probably document that it should be an absolute path. |
||
|
|
||
| if args is None: | ||
| args = sys.argv[1:] | ||
|
|
||
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 think that save_manifest should happen regardless of whether load_manifest was set. Even if that isn't useful (i.e. saving the one the user provided in the first place), at least it's consistent. Or they could be marked as incompatible arguments instead.
Uh oh!
There was an error while loading. Please reload this page.
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.
You mean make the render even if we overwrite it just after (moving the if/shutil.copy part after the current else branch) ? that seems a bit wasteful, and i'm not sure how it helps with consistency, but i'm fine with it if you prefer.