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

Unified Diff: mojo/public/tools/bindings/run_code_generators.py

Issue 1566203002: Only generate code for files that are specified, not their imports. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/public/tools/bindings/mojom_bindings_generator_v2.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« no previous file with comments | « mojo/public/tools/bindings/mojom_bindings_generator_v2.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698