OLD | NEW |
1 # Copyright (C) 2011 Google Inc. All rights reserved. | 1 # Copyright (C) 2011 Google Inc. All rights reserved. |
2 # | 2 # |
3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
4 # modification, are permitted provided that the following conditions | 4 # modification, are permitted provided that the following conditions |
5 # are met: | 5 # are met: |
6 # 1. Redistributions of source code must retain the above copyright | 6 # 1. Redistributions of source code must retain the above copyright |
7 # notice, this list of conditions and the following disclaimer. | 7 # notice, this list of conditions and the following disclaimer. |
8 # 2. Redistributions in binary form must reproduce the above copyright | 8 # 2. Redistributions in binary form must reproduce the above copyright |
9 # notice, this list of conditions and the following disclaimer in the | 9 # notice, this list of conditions and the following disclaimer in the |
10 # documentation and/or other materials provided with the distribution. | 10 # documentation and/or other materials provided with the distribution. |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 from webkitpy.common.system.executive import Executive | 34 from webkitpy.common.system.executive import Executive |
35 | 35 |
36 # Source/ path is needed both to find input IDL files, and to import other | 36 # Source/ path is needed both to find input IDL files, and to import other |
37 # Python modules. | 37 # Python modules. |
38 module_path = os.path.dirname(__file__) | 38 module_path = os.path.dirname(__file__) |
39 source_path = os.path.normpath(os.path.join(module_path, os.pardir, os.pardir, | 39 source_path = os.path.normpath(os.path.join(module_path, os.pardir, os.pardir, |
40 os.pardir, os.pardir, 'Source')) | 40 os.pardir, os.pardir, 'Source')) |
41 sys.path.append(source_path) # for Source/bindings imports | 41 sys.path.append(source_path) # for Source/bindings imports |
42 | 42 |
43 from bindings.scripts.code_generator_v8 import CodeGeneratorUnionTypeContainers | 43 from bindings.scripts.code_generator_v8 import CodeGeneratorUnionType |
44 import bindings.scripts.compute_interfaces_info_individual | 44 import bindings.scripts.compute_interfaces_info_individual |
45 from bindings.scripts.compute_interfaces_info_individual import InterfaceInfoCol
lector | 45 from bindings.scripts.compute_interfaces_info_individual import InterfaceInfoCol
lector |
46 import bindings.scripts.compute_interfaces_info_overall | 46 import bindings.scripts.compute_interfaces_info_overall |
47 from bindings.scripts.compute_interfaces_info_overall import compute_interfaces_
info_overall, interfaces_info | 47 from bindings.scripts.compute_interfaces_info_overall import compute_interfaces_
info_overall, interfaces_info |
48 from bindings.scripts.idl_compiler import IdlCompilerDictionaryImpl, IdlCompiler
V8 | 48 from bindings.scripts.idl_compiler import IdlCompilerDictionaryImpl, IdlCompiler
V8 |
49 from bindings.scripts.idl_reader import IdlReader | 49 from bindings.scripts.idl_reader import IdlReader |
50 from bindings.scripts.utilities import idl_filename_to_component, write_file | 50 from bindings.scripts.utilities import idl_filename_to_component, write_file |
51 | 51 |
52 | 52 |
53 PASS_MESSAGE = 'All tests PASS!' | 53 PASS_MESSAGE = 'All tests PASS!' |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 info_collector.collect_info(idl_path) | 126 info_collector.collect_info(idl_path) |
127 info = info_collector.get_info_as_dict() | 127 info = info_collector.get_info_as_dict() |
128 # TestDictionary.{h,cpp} are placed under | 128 # TestDictionary.{h,cpp} are placed under |
129 # Source/bindings/tests/idls/core. However, IdlCompiler generates | 129 # Source/bindings/tests/idls/core. However, IdlCompiler generates |
130 # TestDictionary.{h,cpp} by using relative_dir. | 130 # TestDictionary.{h,cpp} by using relative_dir. |
131 # So the files will be generated under | 131 # So the files will be generated under |
132 # output_dir/core/bindings/tests/idls/core. | 132 # output_dir/core/bindings/tests/idls/core. |
133 # To avoid this issue, we need to clear relative_dir here. | 133 # To avoid this issue, we need to clear relative_dir here. |
134 for value in info['interfaces_info'].itervalues(): | 134 for value in info['interfaces_info'].itervalues(): |
135 value['relative_dir'] = '' | 135 value['relative_dir'] = '' |
| 136 # Merge component-wide information. |
| 137 component_info = info_collector.get_component_info_as_dict() |
| 138 info.update(component_info) |
136 return info | 139 return info |
137 | 140 |
138 # We compute interfaces info for *all* IDL files, not just test IDL | 141 # We compute interfaces info for *all* IDL files, not just test IDL |
139 # files, as code generator output depends on inheritance (both ancestor | 142 # files, as code generator output depends on inheritance (both ancestor |
140 # chain and inherited extended attributes), and some real interfaces | 143 # chain and inherited extended attributes), and some real interfaces |
141 # are special-cased, such as Node. | 144 # are special-cased, such as Node. |
142 # | 145 # |
143 # For example, when testing the behavior of interfaces that inherit | 146 # For example, when testing the behavior of interfaces that inherit |
144 # from Node, we also need to know that these inherit from EventTarget, | 147 # from Node, we also need to know that these inherit from EventTarget, |
145 # since this is also special-cased and Node inherits from EventTarget, | 148 # since this is also special-cased and Node inherits from EventTarget, |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 if relpath not in generated_files: | 254 if relpath not in generated_files: |
252 excess_files.append(relpath) | 255 excess_files.append(relpath) |
253 if excess_files: | 256 if excess_files: |
254 print ('Excess reference files! ' | 257 print ('Excess reference files! ' |
255 '(probably cruft from renaming or deleting):\n' + | 258 '(probably cruft from renaming or deleting):\n' + |
256 '\n'.join(excess_files)) | 259 '\n'.join(excess_files)) |
257 return False | 260 return False |
258 return True | 261 return True |
259 | 262 |
260 def generate_union_type_containers(output_directory, component): | 263 def generate_union_type_containers(output_directory, component): |
261 generator = CodeGeneratorUnionTypeContainers( | 264 generator = CodeGeneratorUnionType( |
262 interfaces_info, cache_dir=None, output_dir=output_directory, | 265 interfaces_info, cache_dir=None, output_dir=output_directory, |
263 target_component=component) | 266 target_component=component) |
264 outputs = generator.generate_code(union_types[component]) | 267 outputs = generator.generate_code(union_types[component]) |
265 for output_path, output_code in outputs: | 268 for output_path, output_code in outputs: |
266 write_file(output_code, output_path, only_if_changed=True) | 269 write_file(output_code, output_path, only_if_changed=True) |
267 | 270 |
268 try: | 271 try: |
269 generate_interface_dependencies(output_directory) | 272 generate_interface_dependencies(output_directory) |
270 for component in COMPONENT_DIRECTORY: | 273 for component in COMPONENT_DIRECTORY: |
271 output_dir = os.path.join(output_directory, component) | 274 output_dir = os.path.join(output_directory, component) |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 | 338 |
336 | 339 |
337 def run_bindings_tests(reset_results, verbose): | 340 def run_bindings_tests(reset_results, verbose): |
338 # Generate output into the reference directory if resetting results, or | 341 # Generate output into the reference directory if resetting results, or |
339 # a temp directory if not. | 342 # a temp directory if not. |
340 if reset_results: | 343 if reset_results: |
341 print 'Resetting results' | 344 print 'Resetting results' |
342 return bindings_tests(reference_directory, verbose) | 345 return bindings_tests(reference_directory, verbose) |
343 with TemporaryDirectory() as temp_dir: | 346 with TemporaryDirectory() as temp_dir: |
344 return bindings_tests(temp_dir, verbose) | 347 return bindings_tests(temp_dir, verbose) |
OLD | NEW |