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

Side by Side Diff: mojo/public/tools/bindings/run_code_generators.py

Issue 1418453017: Fix some minor bugs related to imports in the new mojom bindings generator. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Fix tests. Created 5 years, 1 month 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 | « mojo/public/tools/bindings/pylib/mojom/generate/mojom_translator_unittest.py ('k') | 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 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 version 2 of the mojom parser and uses that 6 # This script accepts the output of version 2 of the mojom parser and uses that
7 # data to invoke the code generators. 7 # data to invoke the code generators.
8 # 8 #
9 # This script is not related mojom_bindings_generator.py (which is part of v1 9 # This script is not related mojom_bindings_generator.py (which is part of v1
10 # of the mojom parser pipeline). 10 # of the mojom parser pipeline).
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 122
123 The path provided for the various modules is the absolute path to the mojom 123 The path provided for the various modules is the absolute path to the mojom
124 file which the module represents. But the generators expect the path to be 124 file which the module represents. But the generators expect the path to be
125 relative to the root of the source tree. 125 relative to the root of the source tree.
126 126
127 Args: 127 Args:
128 module: {module.Module} whose path is to be updated. 128 module: {module.Module} whose path is to be updated.
129 abs_root: {str} absolute path to the root of the source tree. 129 abs_root: {str} absolute path to the root of the source tree.
130 """ 130 """
131 module.path = os.path.relpath(module.path, src_root_path) 131 module.path = os.path.relpath(module.path, src_root_path)
132 if not hasattr(module, 'imports'):
133 return
132 for import_dict in module.imports: 134 for import_dict in module.imports:
133 FixModulePath(import_dict['module'], src_root_path) 135 FixModulePath(import_dict['module'], src_root_path)
134 136
135 137
136 def main(): 138 def main():
137 args, remaining_args = _ParseCLIArgs() 139 args, remaining_args = _ParseCLIArgs()
138 140
139 if args.file_graph == '-': 141 if args.file_graph == '-':
140 fp = sys.stdin 142 fp = sys.stdin
141 else: 143 else:
(...skipping 14 matching lines...) Expand all
156 if hasattr(generator_module, 'GENERATOR_PREFIX'): 158 if hasattr(generator_module, 'GENERATOR_PREFIX'):
157 prefix = '--' + generator_module.GENERATOR_PREFIX + '_' 159 prefix = '--' + generator_module.GENERATOR_PREFIX + '_'
158 filtered_args = [arg for arg in remaining_args 160 filtered_args = [arg for arg in remaining_args
159 if arg.startswith(prefix)] 161 if arg.startswith(prefix)]
160 162
161 generator.GenerateFiles(filtered_args) 163 generator.GenerateFiles(filtered_args)
162 164
163 165
164 if __name__ == "__main__": 166 if __name__ == "__main__":
165 sys.exit(main()) 167 sys.exit(main())
OLDNEW
« no previous file with comments | « mojo/public/tools/bindings/pylib/mojom/generate/mojom_translator_unittest.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698