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 29 matching lines...) Expand all Loading... |
40 | 40 |
41 Design doc: http://www.chromium.org/developers/design-documents/idl-build | 41 Design doc: http://www.chromium.org/developers/design-documents/idl-build |
42 """ | 42 """ |
43 | 43 |
44 from collections import defaultdict | 44 from collections import defaultdict |
45 import optparse | 45 import optparse |
46 import os | 46 import os |
47 import posixpath | 47 import posixpath |
48 import sys | 48 import sys |
49 | 49 |
50 from utilities import get_file_contents, read_file_to_list, idl_filename_to_inte
rface_name, write_pickle_file, get_interface_extended_attributes_from_idl, is_ca
llback_interface_from_idl, get_partial_interface_name_from_idl, get_implements_f
rom_idl, get_parent_interface, get_put_forward_interfaces_from_idl | 50 from utilities import get_file_contents, read_file_to_list, idl_filename_to_inte
rface_name, write_pickle_file, get_interface_extended_attributes_from_idl, is_ca
llback_interface_from_idl, is_dictionary_from_idl, get_partial_interface_name_fr
om_idl, get_implements_from_idl, get_parent_interface, get_put_forward_interface
s_from_idl |
51 | 51 |
52 module_path = os.path.dirname(__file__) | 52 module_path = os.path.dirname(__file__) |
53 source_path = os.path.normpath(os.path.join(module_path, os.pardir, os.pardir)) | 53 source_path = os.path.normpath(os.path.join(module_path, os.pardir, os.pardir)) |
54 | 54 |
55 # Global variables (filled in and exported) | 55 # Global variables (filled in and exported) |
56 interfaces_info = {} | 56 interfaces_info = {} |
57 partial_interface_files = defaultdict(lambda: { | 57 partial_interface_files = defaultdict(lambda: { |
58 'full_paths': [], | 58 'full_paths': [], |
59 'include_paths': [], | 59 'include_paths': [], |
60 }) | 60 }) |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 left_interfaces, right_interfaces = get_implements_from_idl(idl_file_content
s, interface_name) | 133 left_interfaces, right_interfaces = get_implements_from_idl(idl_file_content
s, interface_name) |
134 | 134 |
135 interfaces_info[interface_name] = { | 135 interfaces_info[interface_name] = { |
136 'component_dir': component_dir, | 136 'component_dir': component_dir, |
137 'extended_attributes': extended_attributes, | 137 'extended_attributes': extended_attributes, |
138 'full_path': full_path, | 138 'full_path': full_path, |
139 'implemented_as': implemented_as, | 139 'implemented_as': implemented_as, |
140 'implemented_by_interfaces': left_interfaces, # private, merged to next | 140 'implemented_by_interfaces': left_interfaces, # private, merged to next |
141 'implements_interfaces': right_interfaces, | 141 'implements_interfaces': right_interfaces, |
142 'include_path': this_include_path, | 142 'include_path': this_include_path, |
| 143 'is_callback_interface': is_callback_interface_from_idl(idl_file_content
s), |
| 144 'is_dictionary': is_dictionary_from_idl(idl_file_contents), |
143 # FIXME: temporary private field, while removing old treatement of | 145 # FIXME: temporary private field, while removing old treatement of |
144 # 'implements': http://crbug.com/360435 | 146 # 'implements': http://crbug.com/360435 |
145 'is_legacy_treat_as_partial_interface': 'LegacyTreatAsPartialInterface'
in extended_attributes, | 147 'is_legacy_treat_as_partial_interface': 'LegacyTreatAsPartialInterface'
in extended_attributes, |
146 'is_callback_interface': is_callback_interface_from_idl(idl_file_content
s), | |
147 'parent': get_parent_interface(idl_file_contents), | 148 'parent': get_parent_interface(idl_file_contents), |
148 # Interfaces that are referenced (used as types) and that we introspect | 149 # Interfaces that are referenced (used as types) and that we introspect |
149 # during code generation (beyond interface-level data ([ImplementedAs], | 150 # during code generation (beyond interface-level data ([ImplementedAs], |
150 # is_callback_interface, ancestors, and inherited extended attributes): | 151 # is_callback_interface, ancestors, and inherited extended attributes): |
151 # deep dependencies. | 152 # deep dependencies. |
152 # These cause rebuilds of referrers, due to the dependency, so these | 153 # These cause rebuilds of referrers, due to the dependency, so these |
153 # should be minimized; currently only targets of [PutForwards]. | 154 # should be minimized; currently only targets of [PutForwards]. |
154 'referenced_interfaces': get_put_forward_interfaces_from_idl(idl_file_co
ntents), | 155 'referenced_interfaces': get_put_forward_interfaces_from_idl(idl_file_co
ntents), |
155 } | 156 } |
156 | 157 |
(...skipping 26 matching lines...) Expand all Loading... |
183 for idl_filename in idl_files: | 184 for idl_filename in idl_files: |
184 compute_info_individual(idl_filename, options.component_dir) | 185 compute_info_individual(idl_filename, options.component_dir) |
185 | 186 |
186 write_pickle_file(options.interfaces_info_file, | 187 write_pickle_file(options.interfaces_info_file, |
187 info_individual(), | 188 info_individual(), |
188 options.write_file_only_if_changed) | 189 options.write_file_only_if_changed) |
189 | 190 |
190 | 191 |
191 if __name__ == '__main__': | 192 if __name__ == '__main__': |
192 sys.exit(main()) | 193 sys.exit(main()) |
OLD | NEW |