Index: Source/bindings/scripts/idl_compiler.py |
diff --git a/Source/bindings/scripts/idl_compiler.py b/Source/bindings/scripts/idl_compiler.py |
index 90f304da33a4e589a7615d9d8b404a393a1ba7ae..bb4744a4f29a1f96ef80805c5cd2b3b88ba8abd9 100755 |
--- a/Source/bindings/scripts/idl_compiler.py |
+++ b/Source/bindings/scripts/idl_compiler.py |
@@ -75,31 +75,40 @@ def write_file(new_text, destination_filename, only_if_changed): |
destination_file.write(new_text) |
-def main(): |
- options, idl_filename = parse_options() |
+def compile_idl(idl_filename, output_directory, idl_attributes_file, |
Nils Barth (inactive)
2014/03/03 01:32:48
Initialization makes this a bit ugly.
Let's make t
Nils Barth (inactive)
2014/03/03 06:45:49
This is useful enough that I'm posting it in anoth
terry
2014/03/13 19:58:18
Right - you've added the abstract class.
On 2014/0
|
+ interfaces_info_file=None, only_if_changed=True, reader=None, |
+ code_generator=CodeGeneratorV8): |
basename = os.path.basename(idl_filename) |
interface_name, _ = os.path.splitext(basename) |
- output_directory = options.output_directory |
- only_if_changed = options.write_file_only_if_changed |
+ output_directory = output_directory |
Nils Barth (inactive)
2014/03/03 01:32:48
I don't think this line is necessary ;)
terry
2014/03/13 19:58:18
Not necessary since self.output_directory is set o
|
- interfaces_info_filename = options.interfaces_info_file |
+ interfaces_info_filename = interfaces_info_file |
if interfaces_info_filename: |
with open(interfaces_info_filename) as interfaces_info_file: |
interfaces_info = pickle.load(interfaces_info_file) |
else: |
interfaces_info = None |
- reader = IdlReader(interfaces_info, options.idl_attributes_file, output_directory) |
+ if reader == None: |
+ reader = IdlReader(interfaces_info, idl_attributes_file, output_directory) |
definitions = reader.read_idl_definitions(idl_filename) |
- code_generator = CodeGeneratorV8(interfaces_info, output_directory) |
- header_text, cpp_text = code_generator.generate_code(definitions, interface_name) |
+ cg = code_generator(interfaces_info, output_directory) |
Nils Barth (inactive)
2014/03/03 01:32:48
In Blink we use full words for names, so |code_gen
terry
2014/03/13 19:58:18
ok.
On 2014/03/03 01:32:48, Nils Barth wrote:
|
+ header_text, cpp_text = cg.generate_code(definitions, interface_name) |
header_filename = os.path.join(output_directory, 'V8%s.h' % interface_name) |
cpp_filename = os.path.join(output_directory, 'V8%s.cpp' % interface_name) |
write_file(header_text, header_filename, only_if_changed) |
write_file(cpp_text, cpp_filename, only_if_changed) |
+ return reader |
+ |
+ |
+def main(): |
+ options, idl_filename = parse_options() |
+ compile_idl(idl_filename, options.output_directory, options.idl_attributes_file, |
+ options.interfaces_info_file, options.write_file_only_if_changed) |
+ |
if __name__ == '__main__': |
sys.exit(main()) |