Chromium Code Reviews| Index: components/cronet/tools/cr_cronet.py |
| diff --git a/components/cronet/tools/cr_cronet.py b/components/cronet/tools/cr_cronet.py |
| index 87b39326187c4d43a711d1f9b7e34f78326ed841..7f0dbaef6ec6665a48d23548a820f43ef3567b91 100755 |
| --- a/components/cronet/tools/cr_cronet.py |
| +++ b/components/cronet/tools/cr_cronet.py |
| @@ -11,6 +11,14 @@ import argparse |
| import os |
| import sys |
| +target_os = 'android' |
| +test_target = 'cronet_test_instrumentation_apk' |
| +out_dir_suffix = '' |
| + |
| +if (sys.platform == 'darwin'): |
| + target_os = 'ios' |
| + test_target = 'cronet_test' |
|
kapishnikov
2016/04/08 23:54:18
It is better if the name stays the same (see the c
mef
2016/04/09 00:52:29
Yes, although its execution is different anyway.
|
| + out_dir_suffix = '-iphonesimulator' |
|
kapishnikov
2016/04/08 23:54:18
Should we add the ability to build for an iOS phis
mef
2016/04/09 00:52:29
Done.
|
| def run(command, extra_options=''): |
| command = command + ' ' + extra_options |
| @@ -19,7 +27,7 @@ def run(command, extra_options=''): |
| def build(out_dir, extra_options=''): |
| - return run('ninja -C ' + out_dir + ' cronet_test_instrumentation_apk', |
| + return run('ninja -C ' + out_dir + ' ' + test_target, |
| extra_options) |
| @@ -36,6 +44,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 ' + \ |
| @@ -70,15 +80,15 @@ def main(): |
| options, extra_options_list = parser.parse_known_args() |
| print options |
| print extra_options_list |
| - gyp_defines = 'GYP_DEFINES="OS=android enable_websockets=0 '+ \ |
| + 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: |
| @@ -98,8 +108,10 @@ def main(): |
| return install(release_arg) |
| if (options.command=='proguard'): |
| return run ('ninja -C ' + out_dir + ' cronet_sample_proguard_apk') |
| - if (options.command=='test'): |
| + if (options.command=='test' and target_os == 'android'): |
| return install(release_arg) or test(release_arg, extra_options) |
| + if (options.command=='test' and target_os == 'ios'): |
| + return test_ios(out_dir, extra_options) |
| if (options.command=='build-test'): |
|
kapishnikov
2016/04/08 23:54:18
Should we add 'build-test' for iOS?
mef
2016/04/09 00:52:29
Done.
|
| return build(out_dir) or install(release_arg) or \ |
| test(release_arg, extra_options) |