| 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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 default=[], | 281 default=[], |
| 282 help="add a directory to be searched for import files. The depth from " | 282 help="add a directory to be searched for import files. The depth from " |
| 283 "source root can be specified for each import by appending it after " | 283 "source root can be specified for each import by appending it after " |
| 284 "a colon") | 284 "a colon") |
| 285 generate_parser.add_argument("--typemap", action="append", metavar="TYPEMAP", | 285 generate_parser.add_argument("--typemap", action="append", metavar="TYPEMAP", |
| 286 default=[], dest="typemaps", | 286 default=[], dest="typemaps", |
| 287 help="apply TYPEMAP to generated output") | 287 help="apply TYPEMAP to generated output") |
| 288 generate_parser.add_argument("--variant", dest="variant", default=None, | 288 generate_parser.add_argument("--variant", dest="variant", default=None, |
| 289 help="output a named variant of the bindings") | 289 help="output a named variant of the bindings") |
| 290 generate_parser.add_argument( | 290 generate_parser.add_argument( |
| 291 "--bytecode_path", type=str, required=True, help=( | 291 "--bytecode_path", required=True, help=( |
| 292 "the path from which to load template bytecode; to generate template " | 292 "the path from which to load template bytecode; to generate template " |
| 293 "bytecode, run %s precompile BYTECODE_PATH" % os.path.basename( | 293 "bytecode, run %s precompile BYTECODE_PATH" % os.path.basename( |
| 294 sys.argv[0]))) | 294 sys.argv[0]))) |
| 295 generate_parser.add_argument("--for_blink", action="store_true", | 295 generate_parser.add_argument("--for_blink", action="store_true", |
| 296 help="Use WTF types as generated types for mojo " | 296 help="Use WTF types as generated types for mojo " |
| 297 "string/array/map.") | 297 "string/array/map.") |
| 298 generate_parser.add_argument( | 298 generate_parser.add_argument( |
| 299 "--use_once_callback", action="store_true", | 299 "--use_once_callback", action="store_true", |
| 300 help="Use base::OnceCallback instead of base::RepeatingCallback.") | 300 help="Use base::OnceCallback instead of base::RepeatingCallback.") |
| 301 generate_parser.add_argument( | 301 generate_parser.add_argument( |
| 302 "--use_new_js_bindings", action="store_true", | 302 "--use_new_js_bindings", action="store_true", |
| 303 help="Use the new module loading approach and the core API exposed by " | 303 help="Use the new module loading approach and the core API exposed by " |
| 304 "Web IDL. This option only affects the JavaScript bindings.") | 304 "Web IDL. This option only affects the JavaScript bindings.") |
| 305 generate_parser.add_argument( | 305 generate_parser.add_argument( |
| 306 "--export_attribute", type=str, default="", | 306 "--export_attribute", default="", |
| 307 help="Optional attribute to specify on class declaration to export it " | 307 help="Optional attribute to specify on class declaration to export it " |
| 308 "for the component build.") | 308 "for the component build.") |
| 309 generate_parser.add_argument( | 309 generate_parser.add_argument( |
| 310 "--export_header", type=str, default="", | 310 "--export_header", default="", |
| 311 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 " |
| 312 "component build.") | 312 "component build.") |
| 313 generate_parser.add_argument( | 313 generate_parser.add_argument( |
| 314 "--generate_non_variant_code", action="store_true", | 314 "--generate_non_variant_code", action="store_true", |
| 315 help="Generate code that is shared by different variants.") | 315 help="Generate code that is shared by different variants.") |
| 316 generate_parser.add_argument( | 316 generate_parser.add_argument( |
| 317 "--depfile", type=str, | 317 "--depfile", |
| 318 help="A file into which the list of input files will be written.") | 318 help="A file into which the list of input files will be written.") |
| 319 generate_parser.add_argument( | 319 generate_parser.add_argument( |
| 320 "--depfile_target", type=str, | 320 "--depfile_target", |
| 321 help="The target name to use in the depfile.") | 321 help="The target name to use in the depfile.") |
| 322 generate_parser.set_defaults(func=_Generate) | 322 generate_parser.set_defaults(func=_Generate) |
| 323 | 323 |
| 324 precompile_parser = subparsers.add_parser("precompile", | 324 precompile_parser = subparsers.add_parser("precompile", |
| 325 description="Precompile templates for the mojom bindings generator.") | 325 description="Precompile templates for the mojom bindings generator.") |
| 326 precompile_parser.add_argument( | 326 precompile_parser.add_argument( |
| 327 "-o", "--output_dir", dest="output_dir", default=".", | 327 "-o", "--output_dir", dest="output_dir", default=".", |
| 328 help="output directory for precompiled templates") | 328 help="output directory for precompiled templates") |
| 329 precompile_parser.set_defaults(func=_Precompile) | 329 precompile_parser.set_defaults(func=_Precompile) |
| 330 | 330 |
| 331 args, remaining_args = parser.parse_known_args() | 331 args, remaining_args = parser.parse_known_args() |
| 332 return args.func(args, remaining_args) | 332 return args.func(args, remaining_args) |
| 333 | 333 |
| 334 | 334 |
| 335 if __name__ == "__main__": | 335 if __name__ == "__main__": |
| 336 sys.exit(main()) | 336 sys.exit(main()) |
| OLD | NEW |