| Index: Source/bindings/scripts/idl_compiler.py
|
| diff --git a/Source/bindings/scripts/idl_compiler.py b/Source/bindings/scripts/idl_compiler.py
|
| index 33d933ba4a1423e0ce8b3d326fa7dab2434340fa..6eb3ac785dad103cbfc515c8660d91a93fac6213 100755
|
| --- a/Source/bindings/scripts/idl_compiler.py
|
| +++ b/Source/bindings/scripts/idl_compiler.py
|
| @@ -38,7 +38,7 @@ import os
|
| import cPickle as pickle
|
| import sys
|
|
|
| -from code_generator_v8 import CodeGeneratorDictionaryImpl, CodeGeneratorV8
|
| +from code_generator_v8 import CodeGeneratorDictionaryImpl, CodeGeneratorV8, CodeGeneratorUnionType
|
| from idl_reader import IdlReader
|
| from utilities import read_idl_files_list_from_file, write_file, idl_filename_to_component
|
|
|
| @@ -47,10 +47,12 @@ def parse_options():
|
| parser = OptionParser()
|
| parser.add_option('--cache-directory',
|
| help='cache directory, defaults to output directory')
|
| - parser.add_option('--generate-dictionary-impl',
|
| + parser.add_option('--generate-impl',
|
| action="store_true", default=False)
|
| parser.add_option('--output-directory')
|
| + parser.add_option('--impl-output-directory')
|
| parser.add_option('--interfaces-info-file')
|
| + parser.add_option('--component-info-file')
|
| parser.add_option('--write-file-only-if-changed', type='int')
|
| # FIXME: We should always explicitly specify --target-component and
|
| # remove the default behavior.
|
| @@ -156,7 +158,7 @@ def generate_bindings(options, input_filename):
|
|
|
| def generate_dictionary_impl(options, input_filename):
|
| idl_compiler = IdlCompilerDictionaryImpl(
|
| - options.output_directory,
|
| + options.impl_output_directory,
|
| cache_directory=options.cache_directory,
|
| interfaces_info_filename=options.interfaces_info_file,
|
| only_if_changed=options.write_file_only_if_changed)
|
| @@ -166,12 +168,31 @@ def generate_dictionary_impl(options, input_filename):
|
| idl_compiler.compile_file(idl_filename)
|
|
|
|
|
| +def generate_union_type_containers(options):
|
| + if not (options.interfaces_info_file and options.component_info_file):
|
| + raise Exception('Interfaces info is required to generate '
|
| + 'union types containers')
|
| + with open(options.interfaces_info_file) as interfaces_info_file:
|
| + interfaces_info = pickle.load(interfaces_info_file)
|
| + with open(options.component_info_file) as component_info_file:
|
| + component_info = pickle.load(component_info_file)
|
| + generator = CodeGeneratorUnionType(
|
| + interfaces_info,
|
| + options.cache_directory,
|
| + options.output_directory,
|
| + options.target_component)
|
| + output_code_list = generator.generate_code(component_info['union_types'])
|
| + for output_path, output_code in output_code_list:
|
| + write_file(output_code, output_path, options.write_file_only_if_changed)
|
| +
|
| +
|
| def main():
|
| options, input_filename = parse_options()
|
| - if options.generate_dictionary_impl:
|
| + if options.generate_impl:
|
| # |input_filename| should be a file which contains a list of IDL
|
| # dictionary paths.
|
| generate_dictionary_impl(options, input_filename)
|
| + generate_union_type_containers(options)
|
| else:
|
| # |input_filename| should be a path of an IDL file.
|
| generate_bindings(options, input_filename)
|
|
|