| Index: Source/bindings/scripts/idl_compiler.py
|
| diff --git a/Source/bindings/scripts/idl_compiler.py b/Source/bindings/scripts/idl_compiler.py
|
| index c74aae7a002777349c65c6c18c68f1ae8c266ba8..a123760c7b9204eaf38e075b5cd3f378af496f88 100755
|
| --- a/Source/bindings/scripts/idl_compiler.py
|
| +++ b/Source/bindings/scripts/idl_compiler.py
|
| @@ -38,15 +38,17 @@ import os
|
| import cPickle as pickle
|
| import sys
|
|
|
| -from code_generator_v8 import CodeGeneratorV8
|
| +from code_generator_v8 import CodeGeneratorDictionaryImpl, CodeGeneratorV8
|
| from idl_reader import IdlReader
|
| -from utilities import write_file
|
| +from utilities import read_idl_files_list_from_file, write_file
|
|
|
|
|
| def parse_options():
|
| parser = OptionParser()
|
| parser.add_option('--cache-directory',
|
| help='cache directory, defaults to output directory')
|
| + parser.add_option('--generate-dictionary-impl',
|
| + action="store_true", default=False)
|
| parser.add_option('--output-directory')
|
| parser.add_option('--interfaces-info-file')
|
| parser.add_option('--write-file-only-if-changed', type='int')
|
| @@ -124,14 +126,49 @@ class IdlCompilerV8(IdlCompiler):
|
| self.compile_and_write(idl_filename)
|
|
|
|
|
| -def main():
|
| - options, idl_filename = parse_options()
|
| +class IdlCompilerDictionaryImpl(IdlCompiler):
|
| + def __init__(self, *args, **kwargs):
|
| + use_relative_output_path = kwargs.get('use_relative_output_path', True)
|
| + kwargs.pop('use_relative_output_path', None)
|
| + IdlCompiler.__init__(self, *args, **kwargs)
|
| + self.code_generator = CodeGeneratorDictionaryImpl(
|
| + self.interfaces_info, self.cache_directory, self.output_directory,
|
| + use_relative_output_path=use_relative_output_path)
|
| +
|
| + def compile_file(self, idl_filename):
|
| + self.compile_and_write(idl_filename)
|
| +
|
| +
|
| +def generate_bindings(options, input_filename):
|
| idl_compiler = IdlCompilerV8(
|
| options.output_directory,
|
| cache_directory=options.cache_directory,
|
| interfaces_info_filename=options.interfaces_info_file,
|
| only_if_changed=options.write_file_only_if_changed)
|
| - idl_compiler.compile_file(idl_filename)
|
| + idl_compiler.compile_file(input_filename)
|
| +
|
| +
|
| +def generate_dictionary_impl(options, input_filename):
|
| + idl_compiler = IdlCompilerDictionaryImpl(
|
| + options.output_directory,
|
| + cache_directory=options.cache_directory,
|
| + interfaces_info_filename=options.interfaces_info_file,
|
| + only_if_changed=options.write_file_only_if_changed)
|
| +
|
| + idl_filenames = read_idl_files_list_from_file(input_filename)
|
| + for idl_filename in idl_filenames:
|
| + idl_compiler.compile_file(idl_filename)
|
| +
|
| +
|
| +def main():
|
| + options, input_filename = parse_options()
|
| + if options.generate_dictionary_impl:
|
| + # |input_filename| should be a file which contains list of IDL
|
| + # dictionary paths.
|
| + generate_dictionary_impl(options, input_filename)
|
| + else:
|
| + # |input_filename| should be path of an IDL file.
|
| + generate_bindings(options, input_filename)
|
|
|
|
|
| if __name__ == '__main__':
|
|
|