| 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 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 Loading... |
| 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 Loading... |
| 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()) |
| OLD | NEW |