| 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 if this_include_path: | 154 if this_include_path: |
| 155 paths_dict['include_paths'].append(this_include_path) | 155 paths_dict['include_paths'].append(this_include_path) |
| 156 | 156 |
| 157 | 157 |
| 158 def compute_individual_info(idl_filename): | 158 def compute_individual_info(idl_filename): |
| 159 full_path = os.path.realpath(idl_filename) | 159 full_path = os.path.realpath(idl_filename) |
| 160 idl_file_contents = get_file_contents(full_path) | 160 idl_file_contents = get_file_contents(full_path) |
| 161 | 161 |
| 162 extended_attributes = get_interface_extended_attributes_from_idl(idl_file_co
ntents) | 162 extended_attributes = get_interface_extended_attributes_from_idl(idl_file_co
ntents) |
| 163 implemented_as = extended_attributes.get('ImplementedAs') | 163 implemented_as = extended_attributes.get('ImplementedAs') |
| 164 runtime_enabled = extended_attributes.get('RuntimeEnabled') |
| 164 # FIXME: remove [NoHeader] once switch to Python | 165 # FIXME: remove [NoHeader] once switch to Python |
| 165 this_include_path = (include_path(idl_filename, implemented_as) | 166 this_include_path = (include_path(idl_filename, implemented_as) |
| 166 if 'NoHeader' not in extended_attributes else None) | 167 if 'NoHeader' not in extended_attributes else None) |
| 167 | 168 |
| 168 # Handle partial interfaces | 169 # Handle partial interfaces |
| 169 partial_interface_name = get_partial_interface_name_from_idl(idl_file_conten
ts) | 170 partial_interface_name = get_partial_interface_name_from_idl(idl_file_conten
ts) |
| 170 if partial_interface_name: | 171 if partial_interface_name: |
| 171 add_paths_to_partials_dict(partial_interface_name, full_path, this_inclu
de_path) | 172 add_paths_to_partials_dict(partial_interface_name, full_path, this_inclu
de_path) |
| 172 return | 173 return |
| 173 | 174 |
| 174 # If not a partial interface, the basename is the interface name | 175 # If not a partial interface, the basename is the interface name |
| 175 interface_name, _ = os.path.splitext(os.path.basename(idl_filename)) | 176 interface_name, _ = os.path.splitext(os.path.basename(idl_filename)) |
| 176 | 177 |
| 177 interfaces_info[interface_name] = { | 178 interfaces_info[interface_name] = { |
| 178 'full_path': full_path, | 179 'full_path': full_path, |
| 179 'implemented_as': implemented_as, | 180 'implemented_as': implemented_as, |
| 180 'implements_interfaces': get_implemented_interfaces_from_idl(idl_file_co
ntents, interface_name), | 181 'implements_interfaces': get_implemented_interfaces_from_idl(idl_file_co
ntents, interface_name), |
| 181 'include_path': this_include_path, | 182 'include_path': this_include_path, |
| 182 'is_callback_interface': is_callback_interface_from_idl(idl_file_content
s), | 183 'is_callback_interface': is_callback_interface_from_idl(idl_file_content
s), |
| 183 # Interfaces that are referenced (used as types) and that we introspect | 184 # Interfaces that are referenced (used as types) and that we introspect |
| 184 # during code generation (beyond interface-level data ([ImplementedAs], | 185 # during code generation (beyond interface-level data ([ImplementedAs], |
| 185 # is_callback_interface, ancestors, and inherited extended attributes): | 186 # is_callback_interface, ancestors, and inherited extended attributes): |
| 186 # deep dependencies. | 187 # deep dependencies. |
| 187 # These cause rebuilds of referrers, due to the dependency, so these | 188 # These cause rebuilds of referrers, due to the dependency, so these |
| 188 # should be minimized; currently only targets of [PutForwards]. | 189 # should be minimized; currently only targets of [PutForwards]. |
| 189 'referenced_interfaces': get_put_forward_interfaces_from_idl(idl_file_co
ntents), | 190 'referenced_interfaces': get_put_forward_interfaces_from_idl(idl_file_co
ntents), |
| 191 'runtime_enabled': runtime_enabled, |
| 190 } | 192 } |
| 191 | 193 |
| 192 # Record inheritance information | 194 # Record inheritance information |
| 193 inherited_extended_attributes_by_interface[interface_name] = dict( | 195 inherited_extended_attributes_by_interface[interface_name] = dict( |
| 194 (key, value) | 196 (key, value) |
| 195 for key, value in extended_attributes.iteritems() | 197 for key, value in extended_attributes.iteritems() |
| 196 if key in INHERITED_EXTENDED_ATTRIBUTES) | 198 if key in INHERITED_EXTENDED_ATTRIBUTES) |
| 197 parent = get_parent_interface(idl_file_contents) | 199 parent = get_parent_interface(idl_file_contents) |
| 198 if parent: | 200 if parent: |
| 199 parent_interfaces[interface_name] = parent | 201 parent_interfaces[interface_name] = parent |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 idl_files.extend(args) | 285 idl_files.extend(args) |
| 284 | 286 |
| 285 compute_interfaces_info(idl_files) | 287 compute_interfaces_info(idl_files) |
| 286 write_pickle_file(options.interfaces_info_file, | 288 write_pickle_file(options.interfaces_info_file, |
| 287 interfaces_info, | 289 interfaces_info, |
| 288 options.write_file_only_if_changed) | 290 options.write_file_only_if_changed) |
| 289 | 291 |
| 290 | 292 |
| 291 if __name__ == '__main__': | 293 if __name__ == '__main__': |
| 292 sys.exit(main()) | 294 sys.exit(main()) |
| OLD | NEW |