Chromium Code Reviews| Index: build/android/gyp/configure_multidex.py |
| diff --git a/build/android/gyp/configure_multidex.py b/build/android/gyp/configure_multidex.py |
| new file mode 100755 |
| index 0000000000000000000000000000000000000000..134d6a46568aa9c2de6ab7f54deea813ef1a1739 |
| --- /dev/null |
| +++ b/build/android/gyp/configure_multidex.py |
| @@ -0,0 +1,83 @@ |
| +#!/usr/bin/env python |
| +# Copyright 2015 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| + |
| +import argparse |
| +import json |
| +import sys |
| + |
| +from util import build_utils |
| + |
| + |
| +def ParseArgs(): |
| + parser = argparse.ArgumentParser() |
| + parser.add_argument('--configuration-name', required=True, |
| + help='The build CONFIGURATION_NAME.') |
| + parser.add_argument('--enabled-configurations', default=[], |
| + help='The configuration(s) for which multidex should be ' |
| + 'enabled. If not specified and --enable-multidex is ' |
| + 'passed, multidex will be enabled for all ' |
| + 'configurations.') |
| + parser.add_argument('--enable-multidex', action='store_true', default=False, |
| + help='Whether or not multidex should be enabled.') |
| + parser.add_argument('--multidex-configuration-path', required=True, |
| + help='The path to which the multidex configuration JSON ' |
| + 'should be saved.') |
| + parser.add_argument('--tested-apk-multidex-configuration-path', |
| + help='The path to a preexisting ') |
|
Yaron
2015/11/11 02:06:38
truncated
jbudorick
2015/11/12 20:33:40
This parameter wasn't necessary after implementing
|
| + parser.add_argument('--multidex-disabled-libs', required=True, |
| + help='The libraries to link if multidex is disabled.') |
| + parser.add_argument('--multidex-enabled-libs', |
| + help='The libraries to link if multidex is enabled.') |
| + |
| + args = parser.parse_args() |
| + |
| + if args.enabled_configurations: |
| + args.enabled_configurations = build_utils.ParseGypList( |
| + args.enabled_configurations) |
| + |
| + if args.multidex_disabled_libs: |
| + args.multidex_disabled_libs = build_utils.ParseGypList( |
| + args.multidex_disabled_libs) |
| + |
| + if args.multidex_enabled_libs: |
| + args.multidex_enabled_libs = build_utils.ParseGypList( |
| + args.multidex_enabled_libs) |
| + |
| + return args |
| + |
| + |
| +def main(): |
| + args = ParseArgs() |
| + |
| + multidex_enabled = ( |
| + args.enable_multidex |
| + and (not args.enabled_configurations |
| + or args.configuration_name in args.enabled_configurations)) |
| + |
| + if args.tested_apk_multidex_configuration_path: |
| + with open(args.tested_apk_multidex_configuration_path) as f: |
| + tested_apk_config = json.loads(f.read()) |
| + libs = tested_apk_config['libs'] |
| + elif multidex_enabled: |
| + assert args.multidex_enabled_libs |
| + libs = args.multidex_enabled_libs |
| + else: |
| + libs = args.multidex_disabled_libs |
| + |
| + config = { |
| + 'enabled': multidex_enabled, |
| + 'libs': libs, |
| + } |
| + |
| + with open(args.multidex_configuration_path, 'w') as f: |
| + f.write(json.dumps(config)) |
| + |
| + return 0 |
| + |
| + |
| +if __name__ == '__main__': |
| + sys.exit(main()) |
| + |