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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 def stack(out_dir): | 45 def stack(out_dir): |
46 return run('adb logcat -d | third_party/android_tools/ndk/ndk-stack ' + \ | 46 return run('adb logcat -d | third_party/android_tools/ndk/ndk-stack ' + \ |
47 '-sym ' + out_dir + '/lib') | 47 '-sym ' + out_dir + '/lib') |
48 | 48 |
49 | 49 |
50 def main(): | 50 def main(): |
51 parser = argparse.ArgumentParser() | 51 parser = argparse.ArgumentParser() |
52 parser.add_argument('command', | 52 parser.add_argument('command', |
53 choices=['gyp', | 53 choices=['gyp', |
| 54 'gn', |
54 'sync', | 55 'sync', |
55 'build', | 56 'build', |
56 'install', | 57 'install', |
57 'proguard', | 58 'proguard', |
58 'test', | 59 'test', |
59 'build-test', | 60 'build-test', |
60 'stack', | 61 'stack', |
61 'debug', | 62 'debug', |
62 'build-debug']) | 63 'build-debug']) |
63 parser.add_argument('-r', '--release', action='store_true', | 64 parser.add_argument('-r', '--release', action='store_true', |
64 help='use release configuration') | 65 help='use release configuration') |
65 | 66 |
66 options, extra_options_list = parser.parse_known_args() | 67 options, extra_options_list = parser.parse_known_args() |
67 print options | 68 print options |
68 print extra_options_list | 69 print extra_options_list |
69 gyp_defines = 'GYP_DEFINES="OS=android enable_websockets=0 '+ \ | 70 gyp_defines = 'GYP_DEFINES="OS=android enable_websockets=0 '+ \ |
70 'disable_file_support=1 disable_ftp_support=1" ' | 71 'disable_file_support=1 disable_ftp_support=1 '+ \ |
| 72 'enable_bidirectional_stream=1"' |
| 73 gn_args = 'target_os="android" enable_websockets=false '+ \ |
| 74 'disable_file_support=true disable_ftp_support=true '+ \ |
| 75 'enable_bidirectional_stream=false' |
71 out_dir = 'out/Debug' | 76 out_dir = 'out/Debug' |
72 release_arg = '' | 77 release_arg = '' |
73 extra_options = ' '.join(extra_options_list) | 78 extra_options = ' '.join(extra_options_list) |
74 if options.release: | 79 if options.release: |
75 out_dir = 'out/Release' | 80 out_dir = 'out/Release' |
76 release_arg = ' --release' | 81 release_arg = ' --release' |
| 82 gn_args += ' is_debug=false ' |
77 | 83 |
78 if (options.command=='gyp'): | 84 if (options.command=='gyp'): |
79 return run (gyp_defines + ' gclient runhooks') | 85 return run (gyp_defines + ' gclient runhooks') |
| 86 if (options.command=='gn'): |
| 87 return run ('gn gen ' + out_dir + ' --args=\'' + gn_args + '\'') |
80 if (options.command=='sync'): | 88 if (options.command=='sync'): |
81 return run ('git pull --rebase && ' + gyp_defines + ' gclient sync') | 89 return run ('git pull --rebase && ' + gyp_defines + ' gclient sync') |
82 if (options.command=='build'): | 90 if (options.command=='build'): |
83 return build(out_dir, extra_options) | 91 return build(out_dir, extra_options) |
84 if (options.command=='install'): | 92 if (options.command=='install'): |
85 return install(release_arg) | 93 return install(release_arg) |
86 if (options.command=='proguard'): | 94 if (options.command=='proguard'): |
87 return run ('ninja -C ' + out_dir + ' cronet_sample_proguard_apk') | 95 return run ('ninja -C ' + out_dir + ' cronet_sample_proguard_apk') |
88 if (options.command=='test'): | 96 if (options.command=='test'): |
89 return install(release_arg) or test(release_arg, extra_options) | 97 return install(release_arg) or test(release_arg, extra_options) |
90 if (options.command=='build-test'): | 98 if (options.command=='build-test'): |
91 return build(out_dir) or install(release_arg) or \ | 99 return build(out_dir) or install(release_arg) or \ |
92 test(release_arg, extra_options) | 100 test(release_arg, extra_options) |
93 if (options.command=='stack'): | 101 if (options.command=='stack'): |
94 return stack(out_dir) | 102 return stack(out_dir) |
95 if (options.command=='debug'): | 103 if (options.command=='debug'): |
96 return install(release_arg) or debug(extra_options) | 104 return install(release_arg) or debug(extra_options) |
97 if (options.command=='build-debug'): | 105 if (options.command=='build-debug'): |
98 return build(out_dir) or install(release_arg) or debug(extra_options) | 106 return build(out_dir) or install(release_arg) or debug(extra_options) |
99 | 107 |
100 parser.print_help() | 108 parser.print_help() |
101 return 1 | 109 return 1 |
102 | 110 |
103 | 111 |
104 if __name__ == '__main__': | 112 if __name__ == '__main__': |
105 sys.exit(main()) | 113 sys.exit(main()) |
OLD | NEW |