| 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('-d', '--out_dir', action='store', |
| 66 help='name of the build directory') |
| 65 parser.add_argument('-i', '--iphoneos', action='store_true', | 67 parser.add_argument('-i', '--iphoneos', action='store_true', |
| 66 help='build for physical iphone') | 68 help='build for physical iphone') |
| 67 parser.add_argument('-r', '--release', action='store_true', | 69 parser.add_argument('-r', '--release', action='store_true', |
| 68 help='use release configuration') | 70 help='use release configuration') |
| 69 | 71 |
| 70 options, extra_options_list = parser.parse_known_args() | 72 options, extra_options_list = parser.parse_known_args() |
| 71 print options | 73 print options |
| 72 print extra_options_list | 74 print extra_options_list |
| 73 | 75 |
| 74 is_os = (sys.platform == 'darwin') | 76 is_os = (sys.platform == 'darwin') |
| (...skipping 10 matching lines...) Expand all Loading... |
| 85 | 87 |
| 86 gyp_defines = 'GYP_DEFINES="OS=' + target_os + ' enable_websockets=0 '+ \ | 88 gyp_defines = 'GYP_DEFINES="OS=' + target_os + ' enable_websockets=0 '+ \ |
| 87 'disable_file_support=1 disable_ftp_support=1 '+ \ | 89 'disable_file_support=1 disable_ftp_support=1 '+ \ |
| 88 'enable_errorprone=1 use_platform_icu_alternatives=1 ' + \ | 90 'enable_errorprone=1 use_platform_icu_alternatives=1 ' + \ |
| 89 'disable_brotli_filter=1"' | 91 'disable_brotli_filter=1"' |
| 90 gn_args = 'target_os="' + target_os + '" enable_websockets=false '+ \ | 92 gn_args = 'target_os="' + target_os + '" enable_websockets=false '+ \ |
| 91 'disable_file_support=true disable_ftp_support=true '+ \ | 93 'disable_file_support=true disable_ftp_support=true '+ \ |
| 92 'use_errorprone_java_compiler=true use_platform_icu_alternatives=true '+ \ | 94 'use_errorprone_java_compiler=true use_platform_icu_alternatives=true '+ \ |
| 93 'disable_brotli_filter=true' | 95 'disable_brotli_filter=true' |
| 94 | 96 |
| 95 out_dir = 'out/Debug' + out_dir_suffix | |
| 96 release_arg = '' | |
| 97 extra_options = ' '.join(extra_options_list) | 97 extra_options = ' '.join(extra_options_list) |
| 98 if options.release: | 98 if options.release: |
| 99 out_dir = 'out/Release' + out_dir_suffix | 99 out_dir = 'out/Release' + out_dir_suffix |
| 100 release_arg = ' --release' | 100 release_arg = ' --release' |
| 101 gn_args += ' is_debug=false ' | 101 gn_args += ' is_debug=false ' |
| 102 else: |
| 103 out_dir = 'out/Debug' + out_dir_suffix |
| 104 release_arg = '' |
| 105 |
| 106 if options.out_dir: |
| 107 out_dir = options.out_dir |
| 102 | 108 |
| 103 if (options.command=='gyp'): | 109 if (options.command=='gyp'): |
| 104 return run (gyp_defines + ' gclient runhooks') | 110 return run (gyp_defines + ' gclient runhooks') |
| 105 if (options.command=='gn'): | 111 if (options.command=='gn'): |
| 106 return run ('gn gen ' + out_dir + ' --args=\'' + gn_args + '\'') | 112 return run ('gn gen ' + out_dir + ' --args=\'' + gn_args + '\'') |
| 107 if (options.command=='sync'): | 113 if (options.command=='sync'): |
| 108 return run ('git pull --rebase && ' + gyp_defines + ' gclient sync') | 114 return run ('git pull --rebase && ' + gyp_defines + ' gclient sync') |
| 109 if (options.command=='build'): | 115 if (options.command=='build'): |
| 110 return build(out_dir, test_target, extra_options) | 116 return build(out_dir, test_target, extra_options) |
| 111 if (not is_os): | 117 if (not is_os): |
| (...skipping 17 matching lines...) Expand all Loading... |
| 129 return test_ios(out_dir, extra_options) | 135 return test_ios(out_dir, extra_options) |
| 130 if (options.command=='build-test'): | 136 if (options.command=='build-test'): |
| 131 return build(out_dir, test_target) or test_ios(out_dir, extra_options) | 137 return build(out_dir, test_target) or test_ios(out_dir, extra_options) |
| 132 | 138 |
| 133 parser.print_help() | 139 parser.print_help() |
| 134 return 1 | 140 return 1 |
| 135 | 141 |
| 136 | 142 |
| 137 if __name__ == '__main__': | 143 if __name__ == '__main__': |
| 138 sys.exit(main()) | 144 sys.exit(main()) |
| OLD | NEW |