OLD | NEW |
| (Empty) |
1 #!/usr/bin/env python | |
2 # | |
3 # Copyright 2010 Google Inc. All Rights Reserved. | |
4 | |
5 # This file is used by the buildbot. | |
6 | |
7 import optparse | |
8 import os.path | |
9 import utils | |
10 | |
11 ALL_TARGETS = [ | |
12 'content_shell', | |
13 'chrome', | |
14 'blink_tests', | |
15 'pkg_packages', | |
16 ] | |
17 | |
18 def main(): | |
19 parser = optparse.OptionParser() | |
20 parser.add_option('--target', dest='target', | |
21 default='all', | |
22 action='store', type='string', | |
23 help='Target (%s)' % ', '.join(ALL_TARGETS)) | |
24 parser.add_option('--mode', dest='mode', | |
25 action='store', type='string', | |
26 help='Build mode (Debug or Release)') | |
27 parser.add_option('--clobber', dest='clobber', | |
28 action='store_true', | |
29 help='Clobber the output directory') | |
30 parser.add_option('-j', '--jobs', dest='jobs', | |
31 action='store', | |
32 help='Number of jobs') | |
33 (options, args) = parser.parse_args() | |
34 mode = options.mode | |
35 if options.jobs: | |
36 jobs = options.jobs | |
37 else: | |
38 jobs = utils.guessCpus() | |
39 if not (mode in ['Debug', 'Release']): | |
40 raise Exception('Invalid build mode') | |
41 | |
42 if options.target == 'all': | |
43 targets = ALL_TARGETS | |
44 else: | |
45 targets = [options.target] | |
46 | |
47 if options.clobber: | |
48 utils.runCommand(['rm', '-rf', 'out']) | |
49 | |
50 utils.runCommand(['ninja', | |
51 '-j%s' % jobs, | |
52 '-C', | |
53 os.path.join('out', mode)] | |
54 + targets) | |
55 | |
56 if __name__ == '__main__': | |
57 main() | |
OLD | NEW |