| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2015 The Chromium Authors. All rights reserved. | 2 # Copyright 2015 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 # This script accepts the output of the mojom parser and uses that | 6 # This script accepts the output of the mojom parser and uses that |
| 7 # data to invoke the code generators. | 7 # data to invoke the code generators. |
| 8 | 8 |
| 9 import argparse | 9 import argparse |
| 10 import imp | 10 import imp |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 parser.add_argument('filenames', nargs='*', | 25 parser.add_argument('filenames', nargs='*', |
| 26 help='Filter on the set of .mojom files for which code ' | 26 help='Filter on the set of .mojom files for which code ' |
| 27 'will be generated.') | 27 'will be generated.') |
| 28 parser.add_argument('-f', '--file-graph', dest='file_graph', | 28 parser.add_argument('-f', '--file-graph', dest='file_graph', |
| 29 help='Location of the parser output. "-" for stdin. ' | 29 help='Location of the parser output. "-" for stdin. ' |
| 30 '(default "-")', default='-') | 30 '(default "-")', default='-') |
| 31 parser.add_argument("-o", "--output-dir", dest="output_dir", default=".", | 31 parser.add_argument("-o", "--output-dir", dest="output_dir", default=".", |
| 32 help="output directory for generated files") | 32 help="output directory for generated files") |
| 33 parser.add_argument("-g", "--generators", dest="generators_string", | 33 parser.add_argument("-g", "--generators", dest="generators_string", |
| 34 metavar="GENERATORS", | 34 metavar="GENERATORS", |
| 35 default="c++,dart,go,javascript,java,python", | 35 default="c++,dart,javascript,java,python", |
| 36 help="comma-separated list of generators") | 36 help="comma-separated list of generators") |
| 37 parser.add_argument("-s", "--src-root-path", dest="src_root_path", | 37 parser.add_argument("-s", "--src-root-path", dest="src_root_path", |
| 38 default=".", | 38 default=".", |
| 39 help="relative path to the root of the source tree.") | 39 help="relative path to the root of the source tree.") |
| 40 parser.add_argument("--no-gen-imports", action="store_true", | 40 parser.add_argument("--no-gen-imports", action="store_true", |
| 41 help="Generate code only for the files that are " | 41 help="Generate code only for the files that are " |
| 42 "specified on the command line. By default, code " | 42 "specified on the command line. By default, code " |
| 43 "is generated for all specified files and their " | 43 "is generated for all specified files and their " |
| 44 "transitive imports.") | 44 "transitive imports.") |
| 45 parser.add_argument("--generate-type-info", dest="generate_type_info", | 45 parser.add_argument("--generate-type-info", dest="generate_type_info", |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 filtered_args = [arg for arg in remaining_args | 176 filtered_args = [arg for arg in remaining_args |
| 177 if arg.startswith(prefix)] | 177 if arg.startswith(prefix)] |
| 178 if args.generate_type_info: | 178 if args.generate_type_info: |
| 179 filtered_args.append("--generate_type_info") | 179 filtered_args.append("--generate_type_info") |
| 180 | 180 |
| 181 generator.GenerateFiles(filtered_args) | 181 generator.GenerateFiles(filtered_args) |
| 182 | 182 |
| 183 | 183 |
| 184 if __name__ == "__main__": | 184 if __name__ == "__main__": |
| 185 sys.exit(main()) | 185 sys.exit(main()) |
| OLD | NEW |