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 10 matching lines...) Expand all Loading... | |
21 choices=['gyp', | 21 choices=['gyp', |
22 'sync', | 22 'sync', |
23 'build', | 23 'build', |
24 'install', | 24 'install', |
25 'proguard', | 25 'proguard', |
26 'test', | 26 'test', |
27 'debug']) | 27 'debug']) |
28 parser.add_argument('-r', '--release', action='store_true', | 28 parser.add_argument('-r', '--release', action='store_true', |
29 help='use release configuration') | 29 help='use release configuration') |
30 | 30 |
31 options = parser.parse_args() | 31 options, unknown_options = parser.parse_known_args() |
32 print options | 32 print options |
33 print unknown_options | |
33 gyp_defines = 'GYP_DEFINES="OS=android enable_websockets=0 '+ \ | 34 gyp_defines = 'GYP_DEFINES="OS=android enable_websockets=0 '+ \ |
34 'disable_file_support=1 disable_ftp_support=1 '+ \ | 35 'disable_file_support=1 disable_ftp_support=1 '+ \ |
35 'use_icu_alternatives_on_android=1" ' | 36 'use_icu_alternatives_on_android=1" ' |
36 out_dir = 'out/Debug' | 37 out_dir = 'out/Debug' |
37 release_arg = '' | 38 release_arg = '' |
38 if options.release: | 39 if options.release: |
39 out_dir = 'out/Release' | 40 out_dir = 'out/Release' |
40 release_arg = ' --release' | 41 release_arg = ' --release' |
41 | 42 |
42 if (options.command=='gyp'): | 43 if (options.command=='gyp'): |
43 return run (gyp_defines + ' gclient runhooks') | 44 return run (gyp_defines + ' gclient runhooks') |
44 if (options.command=='sync'): | 45 if (options.command=='sync'): |
45 return run ('git pull --rebase && ' + gyp_defines + ' gclient sync') | 46 return run ('git pull --rebase && ' + gyp_defines + ' gclient sync') |
46 if (options.command=='build'): | 47 if (options.command=='build'): |
47 return run ('ninja -C ' + out_dir + ' cronet_test_instrumentation_apk') | 48 return run ('ninja -C ' + out_dir + ' cronet_test_instrumentation_apk') |
48 if (options.command=='install'): | 49 if (options.command=='install'): |
49 return run ('build/android/adb_install_apk.py ' + release_arg + \ | 50 return run ('build/android/adb_install_apk.py ' + release_arg + \ |
xunjieli
2014/09/25 21:37:34
We probably don't want the release_arg here. Right
xunjieli
2014/09/29 16:03:04
Remove "release_arg"?
mef
2014/09/29 17:17:56
Why? I think it is useful to be able to build/inst
xunjieli
2014/09/29 17:37:42
I see. I misunderstood the intention of this varia
| |
50 ' --apk=CronetTest.apk') | 51 ' --apk=CronetTest.apk') |
51 if (options.command=='proguard'): | 52 if (options.command=='proguard'): |
52 return run ('ninja -C ' + out_dir + ' cronet_sample_proguard_apk') | 53 return run ('ninja -C ' + out_dir + ' cronet_sample_proguard_apk') |
53 if (options.command=='test'): | 54 if (options.command=='test'): |
54 return run ('build/android/test_runner.py instrumentation '+ \ | 55 return run ('build/android/test_runner.py instrumentation '+ \ |
55 release_arg + ' --test-apk=CronetTestInstrumentation') | 56 release_arg + ' --test-apk=CronetTestInstrumentation ' + \ |
57 ' '.join(unknown_options)) | |
58 if (options.command=='debug'): | |
59 return run ('build/android/adb_gdb --start ' + \ | |
60 '--activity=.CronetTestActivity ' + \ | |
xunjieli
2014/09/25 17:54:36
From what I understand, adb_gdb script binds a gdb
| |
61 '--program-name=CronetTest ' + \ | |
62 '--package-name=org.chromium.cronet_test_apk ' + \ | |
63 ' '.join(unknown_options)) | |
56 | 64 |
57 parser.print_help() | 65 parser.print_help() |
58 return 1 | 66 return 1 |
59 | 67 |
60 | 68 |
61 if __name__ == '__main__': | 69 if __name__ == '__main__': |
62 sys.exit(main()) | 70 sys.exit(main()) |
OLD | NEW |