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

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

Issue 2759563004: Mojo JS bindings: change module loading solution. (Closed)
Patch Set: Make sure mojo_bindings.js is packaged in build result for running layout tests. Created 3 years, 8 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 unified diff | Download patch
OLDNEW
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
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,
170 export_attribute=args.export_attribute, 171 export_attribute=args.export_attribute,
171 export_header=args.export_header, 172 export_header=args.export_header,
172 generate_non_variant_code=args.generate_non_variant_code) 173 generate_non_variant_code=args.generate_non_variant_code)
173 filtered_args = [] 174 filtered_args = []
174 if hasattr(generator_module, 'GENERATOR_PREFIX'): 175 if hasattr(generator_module, 'GENERATOR_PREFIX'):
175 prefix = '--' + generator_module.GENERATOR_PREFIX + '_' 176 prefix = '--' + generator_module.GENERATOR_PREFIX + '_'
176 filtered_args = [arg for arg in remaining_args 177 filtered_args = [arg for arg in remaining_args
177 if arg.startswith(prefix)] 178 if arg.startswith(prefix)]
178 generator.GenerateFiles(filtered_args) 179 generator.GenerateFiles(filtered_args)
179 180
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 "the path from which to load template bytecode; to generate template " 292 "the path from which to load template bytecode; to generate template "
292 "bytecode, run %s precompile BYTECODE_PATH" % os.path.basename( 293 "bytecode, run %s precompile BYTECODE_PATH" % os.path.basename(
293 sys.argv[0]))) 294 sys.argv[0])))
294 generate_parser.add_argument("--for_blink", action="store_true", 295 generate_parser.add_argument("--for_blink", action="store_true",
295 help="Use WTF types as generated types for mojo " 296 help="Use WTF types as generated types for mojo "
296 "string/array/map.") 297 "string/array/map.")
297 generate_parser.add_argument( 298 generate_parser.add_argument(
298 "--use_once_callback", action="store_true", 299 "--use_once_callback", action="store_true",
299 help="Use base::OnceCallback instead of base::RepeatingCallback.") 300 help="Use base::OnceCallback instead of base::RepeatingCallback.")
300 generate_parser.add_argument( 301 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(
301 "--export_attribute", type=str, default="", 306 "--export_attribute", type=str, default="",
302 help="Optional attribute to specify on class declaration to export it " 307 help="Optional attribute to specify on class declaration to export it "
303 "for the component build.") 308 "for the component build.")
304 generate_parser.add_argument( 309 generate_parser.add_argument(
305 "--export_header", type=str, default="", 310 "--export_header", type=str, default="",
306 help="Optional header to include in the generated headers to support the " 311 help="Optional header to include in the generated headers to support the "
307 "component build.") 312 "component build.")
308 generate_parser.add_argument( 313 generate_parser.add_argument(
309 "--generate_non_variant_code", action="store_true", 314 "--generate_non_variant_code", action="store_true",
310 help="Generate code that is shared by different variants.") 315 help="Generate code that is shared by different variants.")
(...skipping 11 matching lines...) Expand all
322 "-o", "--output_dir", dest="output_dir", default=".", 327 "-o", "--output_dir", dest="output_dir", default=".",
323 help="output directory for precompiled templates") 328 help="output directory for precompiled templates")
324 precompile_parser.set_defaults(func=_Precompile) 329 precompile_parser.set_defaults(func=_Precompile)
325 330
326 args, remaining_args = parser.parse_known_args() 331 args, remaining_args = parser.parse_known_args()
327 return args.func(args, remaining_args) 332 return args.func(args, remaining_args)
328 333
329 334
330 if __name__ == "__main__": 335 if __name__ == "__main__":
331 sys.exit(main()) 336 sys.exit(main())
OLDNEW
« no previous file with comments | « mojo/public/tools/bindings/mojom.gni ('k') | mojo/public/tools/bindings/pylib/mojom/generate/generator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698