Chromium Code Reviews| Index: Source/bindings/scripts/idl_compiler.py |
| diff --git a/Source/bindings/scripts/idl_compiler.py b/Source/bindings/scripts/idl_compiler.py |
| index 6728aff45c10cadb38a7d536c0c5c8e7dd531e08..5943c78b27282729423fb9c3cbacd98d5ed8b29f 100755 |
| --- a/Source/bindings/scripts/idl_compiler.py |
| +++ b/Source/bindings/scripts/idl_compiler.py |
| @@ -48,6 +48,7 @@ def parse_options(): |
| parser.add_option('--cache-directory', |
| help='cache directory, defaults to output directory') |
| parser.add_option('--output-directory') |
| + parser.add_option('--impl-output-directory') |
| parser.add_option('--interfaces-info-file') |
| parser.add_option('--write-file-only-if-changed', type='int') |
| # ensure output comes last, so command line easy to parse via regexes |
| @@ -79,7 +80,8 @@ class IdlCompiler(object): |
| """ |
| __metaclass__ = abc.ABCMeta |
| - def __init__(self, output_directory, cache_directory='', |
| + def __init__(self, output_directory, impl_output_directory=None, |
|
Nils Barth (inactive)
2014/07/18 21:52:34
None => ''
(blank string better default)
|
| + cache_directory='', |
| code_generator=None, interfaces_info=None, |
| interfaces_info_filename='', only_if_changed=False): |
| """ |
| @@ -95,19 +97,20 @@ class IdlCompiler(object): |
| if interfaces_info_filename: |
| with open(interfaces_info_filename) as interfaces_info_file: |
| interfaces_info = pickle.load(interfaces_info_file) |
| + self.impl_output_directory = impl_output_directory |
| self.interfaces_info = interfaces_info |
| self.only_if_changed = only_if_changed |
| self.output_directory = output_directory |
| self.reader = IdlReader(interfaces_info, cache_directory) |
| - def compile_and_write(self, idl_filename, output_filenames): |
| + def compile_and_write(self, idl_filename): |
| interface_name = idl_filename_to_interface_name(idl_filename) |
| definitions = self.reader.read_idl_definitions(idl_filename) |
| - output_code_list = self.code_generator.generate_code( |
| + generation_results = self.code_generator.generate_code( |
| definitions, interface_name) |
| - for output_code, output_filename in zip(output_code_list, |
| - output_filenames): |
| - write_file(output_code, output_filename, self.only_if_changed) |
| + for result in generation_results: |
| + write_file(result.output_code, result.output_path, |
| + self.only_if_changed) |
| @abc.abstractmethod |
| def compile_file(self, idl_filename): |
| @@ -118,21 +121,19 @@ class IdlCompilerV8(IdlCompiler): |
| def __init__(self, *args, **kwargs): |
| IdlCompiler.__init__(self, *args, **kwargs) |
| self.code_generator = CodeGeneratorV8(self.interfaces_info, |
| - self.cache_directory) |
| + self.cache_directory, |
| + self.output_directory, |
| + self.impl_output_directory) |
| def compile_file(self, idl_filename): |
| - interface_name = idl_filename_to_interface_name(idl_filename) |
| - header_filename = os.path.join(self.output_directory, |
| - 'V8%s.h' % interface_name) |
| - cpp_filename = os.path.join(self.output_directory, |
| - 'V8%s.cpp' % interface_name) |
| - self.compile_and_write(idl_filename, (header_filename, cpp_filename)) |
| + self.compile_and_write(idl_filename) |
| def main(): |
| options, idl_filename = parse_options() |
| idl_compiler = IdlCompilerV8( |
| 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) |