29"""Compile an .idl file to Blink C++ bindings (.h and .cpp files) for Dart:HTML.
31Design doc: http://www.chromium.org/developers/design-documents/idl-compiler
35from optparse
import OptionParser
39from idl_reader
import IdlReader
40from utilities
import write_file
48 parser = OptionParser()
50 '--idl-attributes-file',
51 help=
"location of bindings/IDLExtendedAttributes.txt")
52 parser.add_option(
'--output-directory')
53 parser.add_option(
'--interfaces-info-file')
54 parser.add_option(
'--write-file-only-if-changed', type=
'int')
56 parser.disable_interspersed_args()
58 options, args = parser.parse_args()
59 if options.output_directory
is None:
60 parser.error(
'Must specify output directory using --output-directory.')
61 options.write_file_only_if_changed = bool(
62 options.write_file_only_if_changed)
65 'Must specify exactly 1 input file as argument, but %d given.' %
67 idl_filename = os.path.realpath(args[0])
68 return options, idl_filename
72 basename = os.path.basename(idl_filename)
73 interface_name, _ = os.path.splitext(basename)
78 """Abstract Base Class for IDL compilers.
82 (returning a list of output code), and
83 *
compile_file() must be implemented (handling output filenames).
85 __metaclass__ = abc.ABCMeta
91 interfaces_info_filename='',
92 only_if_changed=False):
97 (avoids auxiliary file in run-bindings-tests)
98 interfaces_info_file: filename of pickled interfaces_info
101 if interfaces_info_filename:
102 with open(interfaces_info_filename)
as interfaces_info_file:
103 interfaces_info = pickle.load(interfaces_info_file)
108 self.
reader = IdlReader(interfaces_info, output_directory,
True)
112 definitions = self.
reader.read_idl_definitions(idl_filename)
def compile_and_write(self, idl_filename, output_filenames)
def __init__(self, output_directory, code_generator=None, interfaces_info=None, interfaces_info_filename='', only_if_changed=False)
def generate_global_and_write(self, output_filenames)
def compile_file(self, idl_filename)
def idl_filename_to_interface_name(idl_filename)