| 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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 '\n'.join(excess_files)) | 267 '\n'.join(excess_files)) |
| 268 return False | 268 return False |
| 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) |
| 278 | 278 |
| 279 def generate_callback_function_impl(output_directory, component): | 279 def generate_callback_function_impl(output_directory, component): |
| 280 generator = CodeGeneratorCallbackFunction( | 280 generator = CodeGeneratorCallbackFunction( |
| 281 component_info_providers[component], cache_dir=None, | 281 component_info_providers[component], cache_dir=None, |
| 282 output_dir=output_directory, target_component=component) | 282 output_dir=output_directory, target_component=component) |
| 283 outputs = generator.generate_code() | 283 outputs = generator.generate_code() |
| 284 for output_path, output_code in outputs: | 284 for output_path, output_code in outputs: |
| 285 write_file(output_code, output_path, only_if_changed=True) | 285 write_file(output_code, output_path) |
| 286 | 286 |
| 287 try: | 287 try: |
| 288 generate_interface_dependencies() | 288 generate_interface_dependencies() |
| 289 for component in COMPONENT_DIRECTORY: | 289 for component in COMPONENT_DIRECTORY: |
| 290 output_dir = os.path.join(output_directory, component) | 290 output_dir = os.path.join(output_directory, component) |
| 291 if not os.path.exists(output_dir): | 291 if not os.path.exists(output_dir): |
| 292 os.makedirs(output_dir) | 292 os.makedirs(output_dir) |
| 293 | 293 |
| 294 generate_union_type_containers(output_dir, component) | 294 generate_union_type_containers(output_dir, component) |
| 295 generate_callback_function_impl(output_dir, component) | 295 generate_callback_function_impl(output_dir, component) |
| 296 | 296 |
| 297 idl_compiler = IdlCompilerV8( | 297 idl_compiler = IdlCompilerV8( |
| 298 output_dir, | 298 output_dir, |
| 299 info_provider=component_info_providers[component], | 299 info_provider=component_info_providers[component], |
| 300 only_if_changed=True, | |
| 301 target_component=component) | 300 target_component=component) |
| 302 if component == 'core': | 301 if component == 'core': |
| 303 partial_interface_output_dir = os.path.join(output_directory, | 302 partial_interface_output_dir = os.path.join(output_directory, |
| 304 'modules') | 303 'modules') |
| 305 if not os.path.exists(partial_interface_output_dir): | 304 if not os.path.exists(partial_interface_output_dir): |
| 306 os.makedirs(partial_interface_output_dir) | 305 os.makedirs(partial_interface_output_dir) |
| 307 idl_partial_interface_compiler = IdlCompilerV8( | 306 idl_partial_interface_compiler = IdlCompilerV8( |
| 308 partial_interface_output_dir, | 307 partial_interface_output_dir, |
| 309 info_provider=component_info_providers['modules'], | 308 info_provider=component_info_providers['modules'], |
| 310 only_if_changed=True, | |
| 311 target_component='modules') | 309 target_component='modules') |
| 312 else: | 310 else: |
| 313 idl_partial_interface_compiler = None | 311 idl_partial_interface_compiler = None |
| 314 | 312 |
| 315 dictionary_impl_compiler = IdlCompilerDictionaryImpl( | 313 dictionary_impl_compiler = IdlCompilerDictionaryImpl( |
| 316 output_dir, info_provider=component_info_providers[component], | 314 output_dir, info_provider=component_info_providers[component], |
| 317 only_if_changed=True, target_component=component) | 315 target_component=component) |
| 318 | 316 |
| 319 idl_filenames = [] | 317 idl_filenames = [] |
| 320 input_directory = os.path.join(test_input_directory, component) | 318 input_directory = os.path.join(test_input_directory, component) |
| 321 for filename in os.listdir(input_directory): | 319 for filename in os.listdir(input_directory): |
| 322 if (filename.endswith('.idl') and | 320 if (filename.endswith('.idl') and |
| 323 # Dependencies aren't built | 321 # Dependencies aren't built |
| 324 # (they are used by the dependent) | 322 # (they are used by the dependent) |
| 325 filename not in DEPENDENCY_IDL_FILES): | 323 filename not in DEPENDENCY_IDL_FILES): |
| 326 idl_filenames.append( | 324 idl_filenames.append( |
| 327 os.path.realpath( | 325 os.path.realpath( |
| (...skipping 29 matching lines...) Expand all Loading... |
| 357 | 355 |
| 358 | 356 |
| 359 def run_bindings_tests(reset_results, verbose): | 357 def run_bindings_tests(reset_results, verbose): |
| 360 # Generate output into the reference directory if resetting results, or | 358 # Generate output into the reference directory if resetting results, or |
| 361 # a temp directory if not. | 359 # a temp directory if not. |
| 362 if reset_results: | 360 if reset_results: |
| 363 print 'Resetting results' | 361 print 'Resetting results' |
| 364 return bindings_tests(reference_directory, verbose) | 362 return bindings_tests(reference_directory, verbose) |
| 365 with TemporaryDirectory() as temp_dir: | 363 with TemporaryDirectory() as temp_dir: |
| 366 return bindings_tests(temp_dir, verbose) | 364 return bindings_tests(temp_dir, verbose) |
| OLD | NEW |