| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """ | 6 """ |
| 7 cr_cronet.py - cr - like helper tool for cronet developers | 7 cr_cronet.py - cr - like helper tool for cronet developers |
| 8 """ | 8 """ |
| 9 | 9 |
| 10 import argparse | 10 import argparse |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 'gn', | 55 'gn', |
| 56 'sync', | 56 'sync', |
| 57 'build', | 57 'build', |
| 58 'install', | 58 'install', |
| 59 'proguard', | 59 'proguard', |
| 60 'test', | 60 'test', |
| 61 'build-test', | 61 'build-test', |
| 62 'stack', | 62 'stack', |
| 63 'debug', | 63 'debug', |
| 64 'build-debug']) | 64 'build-debug']) |
| 65 parser.add_argument('-g', '--gn', action='store_true', |
| 66 help='use gn output directory suffix') |
| 65 parser.add_argument('-d', '--out_dir', action='store', | 67 parser.add_argument('-d', '--out_dir', action='store', |
| 66 help='name of the build directory') | 68 help='name of the build directory') |
| 67 parser.add_argument('-i', '--iphoneos', action='store_true', | 69 parser.add_argument('-i', '--iphoneos', action='store_true', |
| 68 help='build for physical iphone') | 70 help='build for physical iphone') |
| 69 parser.add_argument('-r', '--release', action='store_true', | 71 parser.add_argument('-r', '--release', action='store_true', |
| 70 help='use release configuration') | 72 help='use release configuration') |
| 71 | 73 |
| 72 options, extra_options_list = parser.parse_known_args() | 74 options, extra_options_list = parser.parse_known_args() |
| 73 print options | 75 print options |
| 74 print extra_options_list | 76 print extra_options_list |
| 75 | 77 |
| 76 is_os = (sys.platform == 'darwin') | 78 is_os = (sys.platform == 'darwin') |
| 77 if is_os: | 79 if is_os: |
| 78 target_os = 'ios' | 80 target_os = 'ios' |
| 79 test_target = 'cronet_test' | 81 test_target = 'cronet_test' |
| 82 gn_args = 'target_cpu = "x64" ' |
| 80 out_dir_suffix = '-iphonesimulator' | 83 out_dir_suffix = '-iphonesimulator' |
| 81 if options.iphoneos: | 84 if options.iphoneos: |
| 85 gn_args = 'target_cpu = "arm64" ' |
| 82 out_dir_suffix = '-iphoneos' | 86 out_dir_suffix = '-iphoneos' |
| 83 else: | 87 else: |
| 84 target_os = 'android' | 88 target_os = 'android' |
| 85 test_target = 'cronet_test_instrumentation_apk' | 89 test_target = 'cronet_test_instrumentation_apk' |
| 90 gn_args = 'use_errorprone_java_compiler=true ' |
| 86 out_dir_suffix = '' | 91 out_dir_suffix = '' |
| 87 | 92 |
| 88 gyp_defines = 'GYP_DEFINES="OS=' + target_os + ' enable_websockets=0 '+ \ | 93 gyp_defines = 'GYP_DEFINES="OS=' + target_os + ' enable_websockets=0 '+ \ |
| 89 'disable_file_support=1 disable_ftp_support=1 '+ \ | 94 'disable_file_support=1 disable_ftp_support=1 '+ \ |
| 90 'enable_errorprone=1 use_platform_icu_alternatives=1 ' + \ | 95 'enable_errorprone=1 use_platform_icu_alternatives=1 ' + \ |
| 91 'disable_brotli_filter=1"' | 96 'disable_brotli_filter=1"' |
| 92 gn_args = 'target_os="' + target_os + '" enable_websockets=false '+ \ | 97 gn_args += 'target_os="' + target_os + '" enable_websockets=false '+ \ |
| 93 'disable_file_support=true disable_ftp_support=true '+ \ | 98 'disable_file_support=true disable_ftp_support=true '+ \ |
| 94 'use_errorprone_java_compiler=true use_platform_icu_alternatives=true '+ \ | 99 'use_platform_icu_alternatives=true '+ \ |
| 95 'disable_brotli_filter=true' | 100 'disable_brotli_filter=true' |
| 96 | 101 |
| 97 extra_options = ' '.join(extra_options_list) | 102 extra_options = ' '.join(extra_options_list) |
| 103 if options.gn: |
| 104 out_dir_suffix += "-gn" |
| 105 |
| 98 if options.release: | 106 if options.release: |
| 99 out_dir = 'out/Release' + out_dir_suffix | 107 out_dir = 'out/Release' + out_dir_suffix |
| 100 release_arg = ' --release' | 108 release_arg = ' --release' |
| 101 gn_args += ' is_debug=false ' | 109 gn_args += ' is_debug=false ' |
| 102 else: | 110 else: |
| 103 out_dir = 'out/Debug' + out_dir_suffix | 111 out_dir = 'out/Debug' + out_dir_suffix |
| 104 release_arg = '' | 112 release_arg = '' |
| 105 | 113 |
| 106 if options.out_dir: | 114 if options.out_dir: |
| 107 out_dir = options.out_dir | 115 out_dir = options.out_dir |
| (...skipping 28 matching lines...) Expand all Loading... |
| 136 return test_ios(out_dir, extra_options) | 144 return test_ios(out_dir, extra_options) |
| 137 if (options.command=='build-test'): | 145 if (options.command=='build-test'): |
| 138 return build(out_dir, test_target) or test_ios(out_dir, extra_options) | 146 return build(out_dir, test_target) or test_ios(out_dir, extra_options) |
| 139 | 147 |
| 140 parser.print_help() | 148 parser.print_help() |
| 141 return 1 | 149 return 1 |
| 142 | 150 |
| 143 | 151 |
| 144 if __name__ == '__main__': | 152 if __name__ == '__main__': |
| 145 sys.exit(main()) | 153 sys.exit(main()) |
| OLD | NEW |