Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: mojom/tools/build_generators.py

Issue 1916133003: Fix the build script to be able to build more than one generator. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2016 The Chromium Authors. All rights reserved. 2 # Copyright 2016 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 """Builds and optionally uploads the mojom generators to Google Cloud Storage. 6 """Builds and optionally uploads the mojom generators to Google Cloud Storage.
7 7
8 This script works the same as build_mojom_tool. 8 This script works the same as build_mojom_tool.
9 """ 9 """
10 10
11 import os 11 import os
12 import sys 12 import sys
13 13
14 import builder 14 import builder
15 15
16 16
17 def main(): 17 def main():
18 parser = builder.get_arg_parser("Build the mojom generators.") 18 all_generators = set(['deps'])
19 parser = builder.get_arg_parser('Build the mojom generators.')
20 parser.add_argument('--generators', dest='generators', type=str,
21 default=all_generators.join(','), action='store',
22 help='Comma-separated list of generators to be built by this build '
23 'script. These should be directories under mojom/generators. By default '
24 'every generator known to the build script will be built.')
19 args = parser.parse_args() 25 args = parser.parse_args()
20 26
21 generators = [ 27 generators = args.generators.split(',')
22 'deps', 28 for generator in generators:
23 ] 29 if generator not in all_generators:
30 print "The only allowed generators are: %s" % all_generators.join(',')
31 return -1
24 32
25 final_result = 0 33 final_result = 0
26 for generator in generators: 34 for generator in generators:
27 generator_builder = builder.get_builder( 35 generator_builder = builder.get_builder(
28 args=args, 36 args=args,
29 target_dir='generators', 37 target_dir='generators',
30 binary_name=generator, 38 binary_name=generator,
31 src_path=os.path.join('mojom', 'generators', generator)) 39 src_path=os.path.join('mojom', 'generators', generator))
32 40
33 if args.upload: 41 if args.upload:
34 result = generator_builder.build_and_upload() 42 result = generator_builder.build_and_upload()
35 result = generator_builder.build() 43 result = generator_builder.build()
36 if result != 0: 44 if result != 0:
37 final_result = result 45 final_result = result
38 if not args.keep_going: 46 if not args.keep_going:
39 return result 47 return result
40 48
41 return final_result 49 return final_result
42 50
43 51
44 if __name__ == '__main__': 52 if __name__ == '__main__':
45 sys.exit(main()) 53 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698