Chromium Code Reviews| Index: mojo/public/tools/bindings/run_code_generators.py |
| diff --git a/mojo/public/tools/bindings/run_code_generators.py b/mojo/public/tools/bindings/run_code_generators.py |
| index a6d30946a1dd44a94729a9157dad5945e5e9a622..07227ef8f3e79a75a6c457fa8c9d3e5cf5be1718 100755 |
| --- a/mojo/public/tools/bindings/run_code_generators.py |
| +++ b/mojo/public/tools/bindings/run_code_generators.py |
| @@ -22,6 +22,9 @@ def _ParseCLIArgs(): |
| """ |
| parser = argparse.ArgumentParser( |
| description='Generate bindings from mojom parser output.') |
| + parser.add_argument('filenames', nargs='*', |
| + help='Mojom files to be generated. If empty, every file' |
|
rudominer
2016/01/07 22:25:49
"Mojom files to be generated" is not a precise des
|
| + 'in the provided graph will be generated.') |
| parser.add_argument('-f', '--file-graph', dest='file_graph', |
| help='Location of the parser output. "-" for stdin. ' |
| '(default "-")', default='-') |
| @@ -152,8 +155,16 @@ def main(): |
| modules = mojom_translator.TranslateFileGraph(mojom_file_graph) |
| generator_modules = LoadGenerators(args.generators_string) |
| + filenames = set(os.path.basename(filename) for filename in args.filenames) |
| for _, module in modules.iteritems(): |
| + # If filenames are specified on the command line, only generate code for |
| + # the specified mojom files. |
| + # TODO(azani): This is not as robust as we would like since files with the |
| + # same name but different paths or files resolved through links might not |
| + # be correctly identified by module.name. |
| + if filenames and module.name not in filenames: |
| + continue |
| FixModulePath(module, os.path.abspath(args.depth)) |
| for generator_module in generator_modules: |
| generator = generator_module.Generator(module, args.output_dir) |