| 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 from webkitpy.common.system.executive import Executive | 33 from webkitpy.common.system.executive import Executive |
| 34 | 34 |
| 35 # Source/ path is needed both to find input IDL files, and to import other | 35 # Source/ path is needed both to find input IDL files, and to import other |
| 36 # Python modules. | 36 # Python modules. |
| 37 module_path = os.path.dirname(__file__) | 37 module_path = os.path.dirname(__file__) |
| 38 source_path = os.path.normpath(os.path.join(module_path, os.pardir, os.pardir, | 38 source_path = os.path.normpath(os.path.join(module_path, os.pardir, os.pardir, |
| 39 os.pardir, os.pardir, 'Source')) | 39 os.pardir, os.pardir, 'Source')) |
| 40 bindings_script_path = os.path.join(source_path, 'bindings', 'scripts') | 40 bindings_script_path = os.path.join(source_path, 'bindings', 'scripts') |
| 41 sys.path.append(bindings_script_path) # for Source/bindings imports | 41 sys.path.append(bindings_script_path) # for Source/bindings imports |
| 42 | 42 |
| 43 from code_generator_v8 import CodeGeneratorUnionType | 43 from code_generator_v8 import CodeGeneratorUnionType, CodeGeneratorCallbackFunct
ion |
| 44 from compute_interfaces_info_individual import InterfaceInfoCollector | 44 from compute_interfaces_info_individual import InterfaceInfoCollector |
| 45 from compute_interfaces_info_overall import compute_interfaces_info_overall, int
erfaces_info | 45 from compute_interfaces_info_overall import compute_interfaces_info_overall, int
erfaces_info |
| 46 from idl_compiler import IdlCompilerDictionaryImpl, IdlCompilerV8 | 46 from idl_compiler import IdlCompilerDictionaryImpl, IdlCompilerV8 |
| 47 from utilities import ComponentInfoProviderCore | 47 from utilities import ComponentInfoProviderCore |
| 48 from utilities import ComponentInfoProviderModules | 48 from utilities import ComponentInfoProviderModules |
| 49 from utilities import write_file | 49 from utilities import write_file |
| 50 | 50 |
| 51 | 51 |
| 52 PASS_MESSAGE = 'All tests PASS!' | 52 PASS_MESSAGE = 'All tests PASS!' |
| 53 FAIL_MESSAGE = """Some tests FAIL! | 53 FAIL_MESSAGE = """Some tests FAIL! |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 return True | 269 return True |
| 270 | 270 |
| 271 def generate_union_type_containers(output_directory, component): | 271 def generate_union_type_containers(output_directory, component): |
| 272 generator = CodeGeneratorUnionType( | 272 generator = CodeGeneratorUnionType( |
| 273 component_info_providers[component], cache_dir=None, | 273 component_info_providers[component], cache_dir=None, |
| 274 output_dir=output_directory, target_component=component) | 274 output_dir=output_directory, target_component=component) |
| 275 outputs = generator.generate_code() | 275 outputs = generator.generate_code() |
| 276 for output_path, output_code in outputs: | 276 for output_path, output_code in outputs: |
| 277 write_file(output_code, output_path, only_if_changed=True) | 277 write_file(output_code, output_path, only_if_changed=True) |
| 278 | 278 |
| 279 def generate_callback_function_impl(output_directory, component): |
| 280 generator = CodeGeneratorCallbackFunction( |
| 281 component_info_providers[component], cache_dir=None, |
| 282 output_dir=output_directory, target_component=component) |
| 283 outputs = generator.generate_code() |
| 284 for output_path, output_code in outputs: |
| 285 write_file(output_code, output_path, only_if_changed=True) |
| 286 |
| 279 try: | 287 try: |
| 280 generate_interface_dependencies() | 288 generate_interface_dependencies() |
| 281 for component in COMPONENT_DIRECTORY: | 289 for component in COMPONENT_DIRECTORY: |
| 282 output_dir = os.path.join(output_directory, component) | 290 output_dir = os.path.join(output_directory, component) |
| 283 if not os.path.exists(output_dir): | 291 if not os.path.exists(output_dir): |
| 284 os.makedirs(output_dir) | 292 os.makedirs(output_dir) |
| 285 | |
| 286 generate_union_type_containers(output_dir, component) | 293 generate_union_type_containers(output_dir, component) |
| 294 generate_callback_function_impl(output_dir, component) |
| 287 | 295 |
| 288 idl_compiler = IdlCompilerV8( | 296 idl_compiler = IdlCompilerV8( |
| 289 output_dir, | 297 output_dir, |
| 290 info_provider=component_info_providers[component], | 298 info_provider=component_info_providers[component], |
| 291 only_if_changed=True) | 299 only_if_changed=True) |
| 292 if component == 'core': | 300 if component == 'core': |
| 293 partial_interface_output_dir = os.path.join(output_directory, | 301 partial_interface_output_dir = os.path.join(output_directory, |
| 294 'modules') | 302 'modules') |
| 303 |
| 295 if not os.path.exists(partial_interface_output_dir): | 304 if not os.path.exists(partial_interface_output_dir): |
| 296 os.makedirs(partial_interface_output_dir) | 305 os.makedirs(partial_interface_output_dir) |
| 297 idl_partial_interface_compiler = IdlCompilerV8( | 306 idl_partial_interface_compiler = IdlCompilerV8( |
| 298 partial_interface_output_dir, | 307 partial_interface_output_dir, |
| 299 info_provider=component_info_providers['modules'], | 308 info_provider=component_info_providers['modules'], |
| 300 only_if_changed=True, | 309 only_if_changed=True, |
| 301 target_component='modules') | 310 target_component='modules') |
| 302 else: | 311 else: |
| 303 idl_partial_interface_compiler = None | 312 idl_partial_interface_compiler = None |
| 304 | 313 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 | 356 |
| 348 | 357 |
| 349 def run_bindings_tests(reset_results, verbose): | 358 def run_bindings_tests(reset_results, verbose): |
| 350 # Generate output into the reference directory if resetting results, or | 359 # Generate output into the reference directory if resetting results, or |
| 351 # a temp directory if not. | 360 # a temp directory if not. |
| 352 if reset_results: | 361 if reset_results: |
| 353 print 'Resetting results' | 362 print 'Resetting results' |
| 354 return bindings_tests(reference_directory, verbose) | 363 return bindings_tests(reference_directory, verbose) |
| 355 with TemporaryDirectory() as temp_dir: | 364 with TemporaryDirectory() as temp_dir: |
| 356 return bindings_tests(temp_dir, verbose) | 365 return bindings_tests(temp_dir, verbose) |
| OLD | NEW |