| Index: components/cronet/tools/cr_cronet.py
|
| diff --git a/components/cronet/tools/cr_cronet.py b/components/cronet/tools/cr_cronet.py
|
| index c0baba4552851f4ad3174b9f36e141c957352f48..906657d35be4db734c6ac6abf64ae569275c7b92 100755
|
| --- a/components/cronet/tools/cr_cronet.py
|
| +++ b/components/cronet/tools/cr_cronet.py
|
| @@ -11,15 +11,14 @@ import argparse
|
| import os
|
| import sys
|
|
|
| -
|
| def run(command, extra_options=''):
|
| command = command + ' ' + extra_options
|
| print command
|
| return os.system(command)
|
|
|
|
|
| -def build(out_dir, extra_options=''):
|
| - return run('ninja -C ' + out_dir + ' cronet_test_instrumentation_apk',
|
| +def build(out_dir, test_target, extra_options=''):
|
| + return run('ninja -C ' + out_dir + ' ' + test_target,
|
| extra_options)
|
|
|
|
|
| @@ -36,6 +35,8 @@ def test(release_arg, extra_options):
|
| ' --fast-local-dev',
|
| extra_options)
|
|
|
| +def test_ios(out_dir, extra_options):
|
| + return run(out_dir + '/iossim ' + out_dir + '/cronet_test.app', extra_options)
|
|
|
| def debug(extra_options):
|
| return run('build/android/adb_gdb --start ' + \
|
| @@ -63,25 +64,41 @@ def main():
|
| 'stack',
|
| 'debug',
|
| 'build-debug'])
|
| + parser.add_argument('-i', '--iphoneos', action='store_true',
|
| + help='build for physical iphone')
|
| parser.add_argument('-r', '--release', action='store_true',
|
| help='use release configuration')
|
|
|
| options, extra_options_list = parser.parse_known_args()
|
| print options
|
| print extra_options_list
|
| - gyp_defines = 'GYP_DEFINES="OS=android enable_websockets=0 '+ \
|
| +
|
| + is_os = (sys.platform == 'darwin')
|
| + if is_os:
|
| + target_os = 'ios'
|
| + test_target = 'cronet_test'
|
| + out_dir_suffix = '-iphonesimulator'
|
| + if options.iphoneos:
|
| + out_dir_suffix = '-iphoneos'
|
| + else:
|
| + target_os = 'android'
|
| + test_target = 'cronet_test_instrumentation_apk'
|
| + out_dir_suffix = ''
|
| +
|
| + gyp_defines = 'GYP_DEFINES="OS=' + target_os + ' enable_websockets=0 '+ \
|
| 'disable_file_support=1 disable_ftp_support=1 '+ \
|
| 'enable_errorprone=1 use_platform_icu_alternatives=1 ' + \
|
| - 'disable_brotli_filter=1"'
|
| - gn_args = 'target_os="android" enable_websockets=false '+ \
|
| + 'disable_brotli_filter=1 use_openssl=1"'
|
| + gn_args = 'target_os="' + target_os + '" enable_websockets=false '+ \
|
| 'disable_file_support=true disable_ftp_support=true '+ \
|
| 'use_errorprone_java_compiler=true use_platform_icu_alternatives=true '+ \
|
| 'disable_brotli_filter=true'
|
| - out_dir = 'out/Debug'
|
| +
|
| + out_dir = 'out/Debug' + out_dir_suffix
|
| release_arg = ''
|
| extra_options = ' '.join(extra_options_list)
|
| if options.release:
|
| - out_dir = 'out/Release'
|
| + out_dir = 'out/Release' + out_dir_suffix
|
| release_arg = ' --release'
|
| gn_args += ' is_debug=false '
|
|
|
| @@ -92,22 +109,28 @@ def main():
|
| if (options.command=='sync'):
|
| return run ('git pull --rebase && ' + gyp_defines + ' gclient sync')
|
| if (options.command=='build'):
|
| - return build(out_dir, extra_options)
|
| - if (options.command=='install'):
|
| - return install(release_arg)
|
| - if (options.command=='proguard'):
|
| - return run ('ninja -C ' + out_dir + ' cronet_sample_proguard_apk')
|
| - if (options.command=='test'):
|
| - return install(release_arg) or test(release_arg, extra_options)
|
| - if (options.command=='build-test'):
|
| - return build(out_dir) or install(release_arg) or \
|
| - test(release_arg, extra_options)
|
| - if (options.command=='stack'):
|
| - return stack(out_dir)
|
| - if (options.command=='debug'):
|
| - return install(release_arg) or debug(extra_options)
|
| - if (options.command=='build-debug'):
|
| - return build(out_dir) or install(release_arg) or debug(extra_options)
|
| + return build(out_dir, test_target, extra_options)
|
| + if (not is_os):
|
| + if (options.command=='install'):
|
| + return install(release_arg)
|
| + if (options.command=='proguard'):
|
| + return run ('ninja -C ' + out_dir + ' cronet_sample_proguard_apk')
|
| + if (options.command=='test'):
|
| + return install(release_arg) or test(release_arg, extra_options)
|
| + if (options.command=='build-test'):
|
| + return build(out_dir, test_target) or install(release_arg) or \
|
| + test(release_arg, extra_options)
|
| + if (options.command=='stack'):
|
| + return stack(out_dir)
|
| + if (options.command=='debug'):
|
| + return install(release_arg) or debug(extra_options)
|
| + if (options.command=='build-debug'):
|
| + return build(out_dir) or install(release_arg) or debug(extra_options)
|
| + else:
|
| + if (options.command=='test'):
|
| + return test_ios(out_dir, extra_options)
|
| + if (options.command=='build-test'):
|
| + return build(out_dir, test_target) or test_ios(out_dir, extra_options)
|
|
|
| parser.print_help()
|
| return 1
|
|
|