Chromium Code Reviews| Index: build/android/gyp/create_test_runner_script.py |
| diff --git a/build/android/gyp/create_test_runner_script.py b/build/android/gyp/create_test_runner_script.py |
| index 511882f69b22f48c2fb535d659f305d5edb1de91..2a42b19057659e4ccaf65976f0f2f985b3102d5e 100755 |
| --- a/build/android/gyp/create_test_runner_script.py |
| +++ b/build/android/gyp/create_test_runner_script.py |
| @@ -9,6 +9,7 @@ |
| import argparse |
| import os |
| +import re |
| import sys |
| from util import build_utils |
| @@ -42,6 +43,21 @@ if __name__ == '__main__': |
| sys.exit(main()) |
| """ |
| + |
| +def _GetTargetFromIncrementalApk(incremental_apk): |
|
agrieve
2016/12/15 16:22:30
We have a convention that makes the apk_name refle
estevenson
2016/12/15 18:19:06
Done.
|
| + apk = re.match(r'^.*/(.*)_incremental.apk$', incremental_apk).group(1) |
| + apk_target = '_'.join(re.findall(r'([A-Z][^A-Z]*)', apk)) |
| + return apk_target.lower() + '_apk' |
| + |
| + |
| +def _GenerateAdditionalApksErrorString(incremental_apks): |
| + err_string = ('Apks that are listed as additional_apks for ' |
| + 'another target cannot be incremental. Please add never_incremental to the ' |
|
agrieve
2016/12/15 16:22:30
nit: indent 4 spaces
estevenson
2016/12/15 18:19:06
Done.
|
| + 'following apks: %s') |
| + return err_string % ', '.join( |
| + _GetTargetFromIncrementalApk(a) for a in incremental_apks) |
| + |
| + |
| def main(args): |
| parser = argparse.ArgumentParser() |
| parser.add_argument('--script-output-path', |
| @@ -57,6 +73,8 @@ def main(args): |
| group.add_argument('--additional-apk', action='append', |
| dest='additional_apks', default=[]) |
| group.add_argument('--additional-apk-list') |
| + group.add_argument('--additional-apk-incremental', action='append', |
| + dest='additional_apks_incremental', default=[]) |
| group.add_argument('--apk-under-test') |
| group.add_argument('--apk-under-test-incremental-install-script') |
| group.add_argument('--executable-dist-dir') |
| @@ -86,6 +104,11 @@ def main(args): |
| test_runner_path_args.extend( |
| ('--additional-apk', RelativizePathToScript(a)) |
| for a in args.additional_apks) |
| + if args.additional_apks_incremental: |
| + bad_additional_apks = [a for a in args.additional_apks_incremental |
| + if a != 'None'] |
| + if bad_additional_apks: |
| + raise Exception(_GenerateAdditionalApksErrorString(bad_additional_apks)) |
| if args.apk_under_test: |
| test_runner_path_args.append( |
| ('--apk-under-test', RelativizePathToScript(args.apk_under_test))) |