| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (C) 2013 Google Inc. All rights reserved. | 2 # Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 # | 3 # |
| 4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without |
| 5 # modification, are permitted provided that the following conditions are | 5 # modification, are permitted provided that the following conditions are |
| 6 # met: | 6 # met: |
| 7 # | 7 # |
| 8 # * Redistributions of source code must retain the above copyright | 8 # * Redistributions of source code must retain the above copyright |
| 9 # notice, this list of conditions and the following disclaimer. | 9 # notice, this list of conditions and the following disclaimer. |
| 10 # * Redistributions in binary form must reproduce the above | 10 # * Redistributions in binary form must reproduce the above |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 | 29 |
| 30 """Compile an .idl file to Blink V8 bindings (.h and .cpp files). | 30 """Compile an .idl file to Blink V8 bindings (.h and .cpp files). |
| 31 | 31 |
| 32 We are porting the IDL compiler from Perl to Python. The plan is as follows. | 32 UNSTABLE: Not currently used in build. |
| 33 We will temporarily have two build flows (see ../derived_sources.gyp): | 33 This is a rewrite of the Perl IDL compiler in Python, but is not complete. |
| 34 [1] Perl: deprecated_generate_bindings.pl, which calls: | 34 Once it is complete, we will switch all IDL files over to Python at once. |
| 35 deprecated_idl_parser.pm => deprecated_code_generator_v8.pm | 35 Until then, please work on the Perl IDL compiler. |
| 36 [2] Python: idl_compiler.py, which calls: | 36 For details, see bug http://crbug.com/239771 |
| 37 IDL lexer => IDL parser => Python object builder => | 37 """ |
| 38 interface dependency resolver => IDL semantic validator => | |
| 39 C++ code generator | |
| 40 | 38 |
| 41 We will move IDL files from the Perl build flow [1] to the Python build flow [2] | |
| 42 incrementally. See http://crbug.com/239771 | |
| 43 """ | |
| 44 import optparse | 39 import optparse |
| 45 import os | 40 import os |
| 46 import pickle | 41 import pickle |
| 47 import posixpath | 42 import posixpath |
| 48 import shlex | 43 import shlex |
| 49 import sys | 44 import sys |
| 50 | 45 |
| 51 import code_generator_v8 | 46 import code_generator_v8 |
| 52 import idl_reader | 47 import idl_reader |
| 53 | 48 |
| 54 module_path, _ = os.path.split(__file__) | 49 module_path, _ = os.path.split(__file__) |
| 55 source_path = os.path.normpath(os.path.join(module_path, os.pardir, os.pardir)) | 50 source_path = os.path.normpath(os.path.join(module_path, os.pardir, os.pardir, o
s.pardir)) |
| 51 |
| 56 | 52 |
| 57 def parse_options(): | 53 def parse_options(): |
| 58 parser = optparse.OptionParser() | 54 parser = optparse.OptionParser() |
| 59 parser.add_option('--additional-idl-files') | 55 parser.add_option('--additional-idl-files') |
| 60 # FIXME: The --dump-json-and-pickle option is only for debugging and will | 56 # FIXME: The --dump-json-and-pickle option is only for debugging and will |
| 61 # be removed once we complete migrating all IDL files from the Perl flow to | 57 # be removed once we complete migrating all IDL files from the Perl flow to |
| 62 # the Python flow. | 58 # the Python flow. |
| 63 parser.add_option('--dump-json-and-pickle', action='store_true', default=Fal
se) | 59 parser.add_option('--dump-json-and-pickle', action='store_true', default=Fal
se) |
| 64 parser.add_option('--idl-attributes-file') | 60 parser.add_option('--idl-attributes-file') |
| 65 parser.add_option('--include', dest='idl_directories', action='append') | 61 parser.add_option('--include', dest='idl_directories', action='append') |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 code_generator.write_dummy_header_and_cpp() | 120 code_generator.write_dummy_header_and_cpp() |
| 125 return | 121 return |
| 126 if options.dump_json_and_pickle: | 122 if options.dump_json_and_pickle: |
| 127 write_json_and_pickle(definitions, interface_name, output_directory) | 123 write_json_and_pickle(definitions, interface_name, output_directory) |
| 128 return | 124 return |
| 129 code_generator.write_header_and_cpp() | 125 code_generator.write_header_and_cpp() |
| 130 | 126 |
| 131 | 127 |
| 132 if __name__ == '__main__': | 128 if __name__ == '__main__': |
| 133 sys.exit(main()) | 129 sys.exit(main()) |
| OLD | NEW |