Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 parser = builder.get_arg_parser('Build the mojom generators.') |
| 19 parser.add_argument('--generators', dest='generators', type=str, default=None, | |
| 20 action='store', help='') | |
|
rudominer
2016/04/25 23:16:05
I think a help string with an example would be use
azani
2016/04/26 00:03:27
Woops, I forgot the help string. Right now, there
| |
| 19 args = parser.parse_args() | 21 args = parser.parse_args() |
| 20 | 22 |
| 21 generators = [ | 23 generators = [ |
| 22 'deps', | 24 'deps', |
|
rudominer
2016/04/25 23:16:05
The default should be to build all of the generato
azani
2016/04/26 00:03:27
It is.
| |
| 23 ] | 25 ] |
| 24 | 26 |
| 27 if args.generators: | |
| 28 generators = args.generators.split(',') | |
| 29 | |
| 25 final_result = 0 | 30 final_result = 0 |
| 26 for generator in generators: | 31 for generator in generators: |
| 27 generator_builder = builder.get_builder( | 32 generator_builder = builder.get_builder( |
| 28 args=args, | 33 args=args, |
| 29 target_dir='generators', | 34 target_dir='generators', |
| 30 binary_name=generator, | 35 binary_name=generator, |
| 31 src_path=os.path.join('mojom', 'generators', generator)) | 36 src_path=os.path.join('mojom', 'generators', generator)) |
| 32 | 37 |
| 33 if args.upload: | 38 if args.upload: |
| 34 result = generator_builder.build_and_upload() | 39 result = generator_builder.build_and_upload() |
| 35 result = generator_builder.build() | 40 result = generator_builder.build() |
| 36 if result != 0: | 41 if result != 0: |
| 37 final_result = result | 42 final_result = result |
| 38 if not args.keep_going: | 43 if not args.keep_going: |
| 39 return result | 44 return result |
| 40 | 45 |
| 41 return final_result | 46 return final_result |
| 42 | 47 |
| 43 | 48 |
| 44 if __name__ == '__main__': | 49 if __name__ == '__main__': |
| 45 sys.exit(main()) | 50 sys.exit(main()) |
| OLD | NEW |