Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 22 additions & 9 deletions pythonforandroid/bootstraps/sdl2/build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Copy link
Member

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.

Copy link
Member Author

@tshirtman tshirtman Dec 8, 2018

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.

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(
Expand Down Expand Up @@ -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.")
Copy link
Member

Choose a reason for hiding this comment

The 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.

Copy link
Member Author

Choose a reason for hiding this comment

The 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:]
Expand Down