| 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 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 | 34 |
| 35 def debug(extra_options): | 35 def debug(extra_options): |
| 36 return run ('build/android/adb_gdb --start ' + \ | 36 return run ('build/android/adb_gdb --start ' + \ |
| 37 '--activity=.CronetTestActivity ' + \ | 37 '--activity=.CronetTestActivity ' + \ |
| 38 '--program-name=CronetTest ' + \ | 38 '--program-name=CronetTest ' + \ |
| 39 '--package-name=org.chromium.cronet_test_apk ' + \ | 39 '--package-name=org.chromium.cronet_test_apk ' + \ |
| 40 ' '.join(extra_options)) | 40 ' '.join(extra_options)) |
| 41 | 41 |
| 42 | 42 |
| 43 def stack(out_dir): |
| 44 return run ('adb logcat -d | third_party/android_tools/ndk/ndk-stack ' + \ |
| 45 '-sym ' + out_dir + '/lib') |
| 46 |
| 47 |
| 43 def main(): | 48 def main(): |
| 44 parser = argparse.ArgumentParser() | 49 parser = argparse.ArgumentParser() |
| 45 parser.add_argument('command', | 50 parser.add_argument('command', |
| 46 choices=['gyp', | 51 choices=['gyp', |
| 47 'sync', | 52 'sync', |
| 48 'build', | 53 'build', |
| 49 'install', | 54 'install', |
| 50 'proguard', | 55 'proguard', |
| 51 'test', | 56 'test', |
| 52 'build-test', | 57 'build-test', |
| 58 'stack', |
| 53 'debug', | 59 'debug', |
| 54 'build-debug']) | 60 'build-debug']) |
| 55 parser.add_argument('-r', '--release', action='store_true', | 61 parser.add_argument('-r', '--release', action='store_true', |
| 56 help='use release configuration') | 62 help='use release configuration') |
| 57 | 63 |
| 58 options, extra_options_list = parser.parse_known_args() | 64 options, extra_options_list = parser.parse_known_args() |
| 59 print options | 65 print options |
| 60 print extra_options_list | 66 print extra_options_list |
| 61 gyp_defines = 'GYP_DEFINES="OS=android enable_websockets=0 '+ \ | 67 gyp_defines = 'GYP_DEFINES="OS=android enable_websockets=0 '+ \ |
| 62 'disable_file_support=1 disable_ftp_support=1 '+ \ | 68 'disable_file_support=1 disable_ftp_support=1 '+ \ |
| (...skipping 13 matching lines...) Expand all Loading... |
| 76 return build(out_dir) | 82 return build(out_dir) |
| 77 if (options.command=='install'): | 83 if (options.command=='install'): |
| 78 return install(release_arg) | 84 return install(release_arg) |
| 79 if (options.command=='proguard'): | 85 if (options.command=='proguard'): |
| 80 return run ('ninja -C ' + out_dir + ' cronet_sample_proguard_apk') | 86 return run ('ninja -C ' + out_dir + ' cronet_sample_proguard_apk') |
| 81 if (options.command=='test'): | 87 if (options.command=='test'): |
| 82 return install(release_arg) or test(release_arg, extra_options) | 88 return install(release_arg) or test(release_arg, extra_options) |
| 83 if (options.command=='build-test'): | 89 if (options.command=='build-test'): |
| 84 return build(out_dir) or install(release_arg) or \ | 90 return build(out_dir) or install(release_arg) or \ |
| 85 test(release_arg, extra_options) | 91 test(release_arg, extra_options) |
| 92 if (options.command=='stack'): |
| 93 return stack(out_dir) |
| 86 if (options.command=='debug'): | 94 if (options.command=='debug'): |
| 87 return install(release_arg) or debug(extra_options) | 95 return install(release_arg) or debug(extra_options) |
| 88 if (options.command=='build-debug'): | 96 if (options.command=='build-debug'): |
| 89 return build(out_dir) or install(release_arg) or debug(extra_options) | 97 return build(out_dir) or install(release_arg) or debug(extra_options) |
| 90 | 98 |
| 91 parser.print_help() | 99 parser.print_help() |
| 92 return 1 | 100 return 1 |
| 93 | 101 |
| 94 | 102 |
| 95 if __name__ == '__main__': | 103 if __name__ == '__main__': |
| 96 sys.exit(main()) | 104 sys.exit(main()) |
| OLD | NEW |