| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # | 2 # |
| 3 # Copyright (C) 2013 Google Inc. All rights reserved. | 3 # Copyright (C) 2013 Google Inc. All rights reserved. |
| 4 # | 4 # |
| 5 # Redistribution and use in source and binary forms, with or without | 5 # Redistribution and use in source and binary forms, with or without |
| 6 # modification, are permitted provided that the following conditions are | 6 # modification, are permitted provided that the following conditions are |
| 7 # met: | 7 # met: |
| 8 # | 8 # |
| 9 # * Redistributions of source code must retain the above copyright | 9 # * Redistributions of source code must retain the above copyright |
| 10 # notice, this list of conditions and the following disclaimer. | 10 # notice, this list of conditions and the following disclaimer. |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 code changes (for inherited extended attributes). | 79 code changes (for inherited extended attributes). |
| 80 | 80 |
| 81 Design doc: http://www.chromium.org/developers/design-documents/idl-build | 81 Design doc: http://www.chromium.org/developers/design-documents/idl-build |
| 82 """ | 82 """ |
| 83 | 83 |
| 84 from collections import defaultdict | 84 from collections import defaultdict |
| 85 import cPickle as pickle | 85 import cPickle as pickle |
| 86 import optparse | 86 import optparse |
| 87 import sys | 87 import sys |
| 88 | 88 |
| 89 from utilities import idl_filename_to_component, read_pickle_files, write_pickle
_file, merge_dict_recursively | 89 from utilities import idl_filename_to_component, read_pickle_files, write_pickle
_file, merge_dict_recursively, shorten_union_name |
| 90 | 90 |
| 91 INHERITED_EXTENDED_ATTRIBUTES = set([ | 91 INHERITED_EXTENDED_ATTRIBUTES = set([ |
| 92 'ActiveScriptWrappable', | 92 'ActiveScriptWrappable', |
| 93 'DependentLifetime', | 93 'DependentLifetime', |
| 94 ]) | 94 ]) |
| 95 | 95 |
| 96 # Main variable (filled in and exported) | 96 # Main variable (filled in and exported) |
| 97 interfaces_info = {} | 97 interfaces_info = {} |
| 98 | 98 |
| 99 # Auxiliary variables (not visible to future build steps) | 99 # Auxiliary variables (not visible to future build steps) |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 else: | 280 else: |
| 281 dependencies_other_component_full_paths.append(full_path) | 281 dependencies_other_component_full_paths.append(full_path) |
| 282 | 282 |
| 283 for include_path in partial_interfaces_include_paths: | 283 for include_path in partial_interfaces_include_paths: |
| 284 partial_interface_component = idl_filename_to_component(include_path
) | 284 partial_interface_component = idl_filename_to_component(include_path
) |
| 285 if component == partial_interface_component: | 285 if component == partial_interface_component: |
| 286 dependencies_include_paths.append(include_path) | 286 dependencies_include_paths.append(include_path) |
| 287 else: | 287 else: |
| 288 dependencies_other_component_include_paths.append(include_path) | 288 dependencies_other_component_include_paths.append(include_path) |
| 289 | 289 |
| 290 if interface_info['has_union_types']: | 290 for union_type in interface_info.get('union_types', []): |
| 291 name = shorten_union_name(union_type) |
| 291 dependencies_include_paths.append( | 292 dependencies_include_paths.append( |
| 292 'bindings/%s/v8/UnionTypes%s.h' % (component, component.capitali
ze())) | 293 'bindings/%s/v8/%s.h' % (component, name)) |
| 293 | 294 |
| 294 interface_info.update({ | 295 interface_info.update({ |
| 295 'dependencies_full_paths': dependencies_full_paths, | 296 'dependencies_full_paths': dependencies_full_paths, |
| 296 'dependencies_include_paths': dependencies_include_paths, | 297 'dependencies_include_paths': dependencies_include_paths, |
| 297 'dependencies_other_component_full_paths': | 298 'dependencies_other_component_full_paths': |
| 298 dependencies_other_component_full_paths, | 299 dependencies_other_component_full_paths, |
| 299 'dependencies_other_component_include_paths': | 300 'dependencies_other_component_include_paths': |
| 300 dependencies_other_component_include_paths, | 301 dependencies_other_component_include_paths, |
| 301 }) | 302 }) |
| 302 | 303 |
| 303 # Clean up temporary private information | 304 # Clean up temporary private information |
| 304 for interface_info in interfaces_info.itervalues(): | 305 for interface_info in interfaces_info.itervalues(): |
| 305 del interface_info['extended_attributes'] | 306 del interface_info['extended_attributes'] |
| 306 del interface_info['has_union_types'] | 307 del interface_info['union_types'] |
| 307 del interface_info['is_legacy_treat_as_partial_interface'] | 308 del interface_info['is_legacy_treat_as_partial_interface'] |
| 308 | 309 |
| 309 # Compute global_type_info to interfaces_info so that idl_compiler does | 310 # Compute global_type_info to interfaces_info so that idl_compiler does |
| 310 # not need to always calculate the info in __init__. | 311 # not need to always calculate the info in __init__. |
| 311 compute_global_type_info() | 312 compute_global_type_info() |
| 312 | 313 |
| 313 | 314 |
| 314 ################################################################################ | 315 ################################################################################ |
| 315 | 316 |
| 316 def main(): | 317 def main(): |
| 317 options, args = parse_options() | 318 options, args = parse_options() |
| 318 # args = Input1, Input2, ..., Output | 319 # args = Input1, Input2, ..., Output |
| 319 interfaces_info_filename = args.pop() | 320 interfaces_info_filename = args.pop() |
| 320 info_individuals = read_pickle_files(args) | 321 info_individuals = read_pickle_files(args) |
| 321 | 322 |
| 322 compute_interfaces_info_overall(info_individuals) | 323 compute_interfaces_info_overall(info_individuals) |
| 323 write_pickle_file(interfaces_info_filename, | 324 write_pickle_file(interfaces_info_filename, |
| 324 interfaces_info, | 325 interfaces_info, |
| 325 options.write_file_only_if_changed) | 326 options.write_file_only_if_changed) |
| 326 | 327 |
| 327 | 328 |
| 328 if __name__ == '__main__': | 329 if __name__ == '__main__': |
| 329 sys.exit(main()) | 330 sys.exit(main()) |
| OLD | NEW |