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
4 # found in the LICENSE file.
7 cr_cronet.py - cr - like helper tool for cronet developers
16 return os
.system(command
)
19 parser
= argparse
.ArgumentParser()
20 parser
.add_argument('command',
28 parser
.add_argument('-r', '--release', action
='store_true',
29 help='use release configuration')
31 options
, unknown_options
= parser
.parse_known_args()
34 gyp_defines
= 'GYP_DEFINES="OS=android enable_websockets=0 '+ \
35 'disable_file_support=1 disable_ftp_support=1 '+ \
36 'use_icu_alternatives_on_android=1" '
40 out_dir
= 'out/Release'
41 release_arg
= ' --release'
43 if (options
.command
=='gyp'):
44 return run (gyp_defines
+ ' gclient runhooks')
45 if (options
.command
=='sync'):
46 return run ('git pull --rebase && ' + gyp_defines
+ ' gclient sync')
47 if (options
.command
=='build'):
48 return run ('ninja -C ' + out_dir
+ ' cronet_test_instrumentation_apk')
49 if (options
.command
=='install'):
50 return run ('build/android/adb_install_apk.py ' + release_arg
+ \
51 ' --apk=CronetTest.apk')
52 if (options
.command
=='proguard'):
53 return run ('ninja -C ' + out_dir
+ ' cronet_sample_proguard_apk')
54 if (options
.command
=='test'):
55 return run ('build/android/test_runner.py instrumentation '+ \
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 ' + \
61 '--program-name=CronetTest ' + \
62 '--package-name=org.chromium.cronet_test_apk ' + \
63 ' '.join(unknown_options
))
69 if __name__
== '__main__':