Chromium Code Reviews| Index: build/android/incremental_install/create_install_script.py |
| diff --git a/build/android/gn/create_incremental_install_script.py b/build/android/incremental_install/create_install_script.py |
| similarity index 66% |
| rename from build/android/gn/create_incremental_install_script.py |
| rename to build/android/incremental_install/create_install_script.py |
| index f12f9e5dc3d594156a57ccd127efc52b3e4e4f16..2551a138e3b96f1bdc81a1ee8e17edc4fd2b5d7f 100755 |
| --- a/build/android/gn/create_incremental_install_script.py |
| +++ b/build/android/incremental_install/create_install_script.py |
| @@ -4,23 +4,25 @@ |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| -"""Creates a script to run a "_incremental" .apk.""" |
| +"""Creates a script to run an "_incremental" .apk.""" |
| import argparse |
| import os |
| +import pprint |
| import sys |
| sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir)) |
| sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir, 'gyp')) |
| -from util import build_utils |
| + |
| from pylib import constants |
| +from util import build_utils |
| SCRIPT_TEMPLATE = """\ |
| #!/usr/bin/env python |
| # |
| # This file was generated by: |
| -# //build/android/gyp/create_incremental_install_script.py |
| +# //build/android/incremental_install/create_install_script.py |
| import os |
| import subprocess |
| @@ -47,7 +49,7 @@ if __name__ == '__main__': |
| """ |
| -def main(args): |
| +def _ParseArgs(args): |
| args = build_utils.ExpandFileArgs(args) |
| parser = argparse.ArgumentParser() |
| build_utils.AddDepfileOption(parser) |
| @@ -65,30 +67,50 @@ def main(args): |
| 'Can be specified multiple times.') |
| parser.add_argument('--lib-dir', |
| help='Path to native libraries directory.') |
| + parser.add_argument('--dex-file', |
| + action='append', |
| + default=[], |
| + dest='dex_files', |
| + help='List of dex files to include.', |
| + ) |
|
jbudorick
2015/09/15 18:36:41
nit: pull this up onto the previous line
agrieve
2015/09/15 19:30:05
Done.
|
| + parser.add_argument('--dex-file-list', |
| + help='GYP-list of dex files.', |
| + ) |
| options = parser.parse_args(args) |
| + options.dex_files += build_utils.ParseGypList(options.dex_file_list) |
| + return options |
| + |
| + |
| +def main(args): |
| + options = _ParseArgs(args) |
| def relativize(path): |
| return os.path.relpath(path, os.path.dirname(options.script_output_path)) |
| - incremental_install_path = os.path.join(constants.DIR_SOURCE_ROOT, 'build', |
| - 'android', 'incremental_install.py') |
| - incremental_install_path = relativize(incremental_install_path) |
| + installer_path = os.path.join(constants.DIR_SOURCE_ROOT, 'build', 'android', |
| + 'incremental_install', 'installer.py') |
| + installer_path = relativize(installer_path) |
| - incremental_install_path_args = [ |
| + path_args = [ |
| (None, relativize(options.apk_path)), |
| ] |
| + |
| if options.lib_dir: |
| - incremental_install_path_args.append( |
| - ('--lib-dir', relativize(options.lib_dir))) |
| + path_args.append(('--lib-dir', relativize(options.lib_dir))) |
| + |
| + if options.dex_files: |
| + for dex_file in options.dex_files: |
| + path_args.append(('--dex-file', relativize(dex_file))) |
| + |
| for split_arg in options.splits: |
| - incremental_install_path_args.append(('--split', relativize(split_arg))) |
| + path_args.append(('--split', relativize(split_arg))) |
| with open(options.script_output_path, 'w') as script: |
| script.write(SCRIPT_TEMPLATE.format( |
| - cmd_path=repr(incremental_install_path), |
| + cmd_path=pprint.pformat(installer_path), |
| cmd_args='[]', |
| - cmd_path_args=repr(incremental_install_path_args))) |
| + cmd_path_args=pprint.pformat(path_args))) |
| os.chmod(options.script_output_path, 0750) |