| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2013 The Chromium Authors. All rights reserved. | 2 # Copyright 2013 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 """The frontend for the Mojo bindings system.""" | 6 """The frontend for the Mojo bindings system.""" |
| 7 | 7 |
| 8 | 8 |
| 9 import argparse | 9 import argparse |
| 10 import imp | 10 import imp |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 # Normalize to unix-style path here to keep the generators simpler. | 160 # Normalize to unix-style path here to keep the generators simpler. |
| 161 module.path = module.path.replace('\\', '/') | 161 module.path = module.path.replace('\\', '/') |
| 162 | 162 |
| 163 if self._should_generate(rel_filename.path): | 163 if self._should_generate(rel_filename.path): |
| 164 for language, generator_module in generator_modules.iteritems(): | 164 for language, generator_module in generator_modules.iteritems(): |
| 165 generator = generator_module.Generator( | 165 generator = generator_module.Generator( |
| 166 module, args.output_dir, typemap=self._typemap.get(language, {}), | 166 module, args.output_dir, typemap=self._typemap.get(language, {}), |
| 167 variant=args.variant, bytecode_path=args.bytecode_path, | 167 variant=args.variant, bytecode_path=args.bytecode_path, |
| 168 for_blink=args.for_blink, | 168 for_blink=args.for_blink, |
| 169 use_once_callback=args.use_once_callback, | 169 use_once_callback=args.use_once_callback, |
| 170 use_new_js_bindings=args.use_new_js_bindings, | |
| 171 export_attribute=args.export_attribute, | 170 export_attribute=args.export_attribute, |
| 172 export_header=args.export_header, | 171 export_header=args.export_header, |
| 173 generate_non_variant_code=args.generate_non_variant_code) | 172 generate_non_variant_code=args.generate_non_variant_code) |
| 174 filtered_args = [] | 173 filtered_args = [] |
| 175 if hasattr(generator_module, 'GENERATOR_PREFIX'): | 174 if hasattr(generator_module, 'GENERATOR_PREFIX'): |
| 176 prefix = '--' + generator_module.GENERATOR_PREFIX + '_' | 175 prefix = '--' + generator_module.GENERATOR_PREFIX + '_' |
| 177 filtered_args = [arg for arg in remaining_args | 176 filtered_args = [arg for arg in remaining_args |
| 178 if arg.startswith(prefix)] | 177 if arg.startswith(prefix)] |
| 179 generator.GenerateFiles(filtered_args) | 178 generator.GenerateFiles(filtered_args) |
| 180 | 179 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 "the path from which to load template bytecode; to generate template " | 291 "the path from which to load template bytecode; to generate template " |
| 293 "bytecode, run %s precompile BYTECODE_PATH" % os.path.basename( | 292 "bytecode, run %s precompile BYTECODE_PATH" % os.path.basename( |
| 294 sys.argv[0]))) | 293 sys.argv[0]))) |
| 295 generate_parser.add_argument("--for_blink", action="store_true", | 294 generate_parser.add_argument("--for_blink", action="store_true", |
| 296 help="Use WTF types as generated types for mojo " | 295 help="Use WTF types as generated types for mojo " |
| 297 "string/array/map.") | 296 "string/array/map.") |
| 298 generate_parser.add_argument( | 297 generate_parser.add_argument( |
| 299 "--use_once_callback", action="store_true", | 298 "--use_once_callback", action="store_true", |
| 300 help="Use base::OnceCallback instead of base::RepeatingCallback.") | 299 help="Use base::OnceCallback instead of base::RepeatingCallback.") |
| 301 generate_parser.add_argument( | 300 generate_parser.add_argument( |
| 302 "--use_new_js_bindings", action="store_true", | |
| 303 help="Use the new module loading approach and the core API exposed by " | |
| 304 "Web IDL. This option only affects the JavaScript bindings.") | |
| 305 generate_parser.add_argument( | |
| 306 "--export_attribute", type=str, default="", | 301 "--export_attribute", type=str, default="", |
| 307 help="Optional attribute to specify on class declaration to export it " | 302 help="Optional attribute to specify on class declaration to export it " |
| 308 "for the component build.") | 303 "for the component build.") |
| 309 generate_parser.add_argument( | 304 generate_parser.add_argument( |
| 310 "--export_header", type=str, default="", | 305 "--export_header", type=str, default="", |
| 311 help="Optional header to include in the generated headers to support the " | 306 help="Optional header to include in the generated headers to support the " |
| 312 "component build.") | 307 "component build.") |
| 313 generate_parser.add_argument( | 308 generate_parser.add_argument( |
| 314 "--generate_non_variant_code", action="store_true", | 309 "--generate_non_variant_code", action="store_true", |
| 315 help="Generate code that is shared by different variants.") | 310 help="Generate code that is shared by different variants.") |
| (...skipping 11 matching lines...) Expand all Loading... |
| 327 "-o", "--output_dir", dest="output_dir", default=".", | 322 "-o", "--output_dir", dest="output_dir", default=".", |
| 328 help="output directory for precompiled templates") | 323 help="output directory for precompiled templates") |
| 329 precompile_parser.set_defaults(func=_Precompile) | 324 precompile_parser.set_defaults(func=_Precompile) |
| 330 | 325 |
| 331 args, remaining_args = parser.parse_known_args() | 326 args, remaining_args = parser.parse_known_args() |
| 332 return args.func(args, remaining_args) | 327 return args.func(args, remaining_args) |
| 333 | 328 |
| 334 | 329 |
| 335 if __name__ == "__main__": | 330 if __name__ == "__main__": |
| 336 sys.exit(main()) | 331 sys.exit(main()) |
| OLD | NEW |