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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
59 'inherited_extended_attributes': inherited extended attributes | 59 'inherited_extended_attributes': inherited extended attributes |
60 (all controlling memory management) | 60 (all controlling memory management) |
61 | 61 |
62 * public: | 62 * public: |
63 'is_callback_interface': bool, callback interface or not | 63 'is_callback_interface': bool, callback interface or not |
64 'implemented_as': value of [ImplementedAs=...] on interface (C++ class name) | 64 'implemented_as': value of [ImplementedAs=...] on interface (C++ class name) |
65 | 65 |
66 * paths: | 66 * paths: |
67 'full_path': path to the IDL file, so can lookup an IDL by interface name | 67 'full_path': path to the IDL file, so can lookup an IDL by interface name |
68 'include_path': path for use in C++ #include directives | 68 'include_path': path for use in C++ #include directives |
69 'dependencies_full_paths': paths to dependencies (for merging into main) | 69 'implemented_interfaces_full_paths': |
tasak
2014/10/17 07:38:17
Need to fix this comment.
| |
70 'dependencies_include_paths': paths for use in C++ #include directives | 70 paths to dependencies caused by implemented (for merging into main) |
71 'implemented_interfaces_include_paths': | |
tasak
2014/10/17 07:38:17
Ditto.
| |
72 paths for use in C++ #include directives for implemented | |
73 'partial_interfaces_full_paths': | |
74 paths to dependencies caused by partial (for merging into main) | |
haraken
2014/10/16 04:24:07
partial => partial interfaces
tasak
2014/10/17 07:38:17
Done.
| |
75 'partial_interfaces_include_paths': | |
76 paths for use in C++ #include directives for partial interface | |
haraken
2014/10/16 04:24:07
partial interface => partial interfaces
tasak
2014/10/17 07:38:17
Done.
| |
71 | 77 |
72 Note that all of these are stable information, unlikely to change without | 78 Note that all of these are stable information, unlikely to change without |
73 moving or deleting files (hence requiring a full rebuild anyway) or significant | 79 moving or deleting files (hence requiring a full rebuild anyway) or significant |
74 code changes (for inherited extended attributes). | 80 code changes (for inherited extended attributes). |
75 | 81 |
76 Design doc: http://www.chromium.org/developers/design-documents/idl-build | 82 Design doc: http://www.chromium.org/developers/design-documents/idl-build |
77 """ | 83 """ |
78 | 84 |
79 from collections import defaultdict | 85 from collections import defaultdict |
80 import cPickle as pickle | 86 import cPickle as pickle |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
261 # Implemented interfaces don't need includes, as this is handled in | 267 # Implemented interfaces don't need includes, as this is handled in |
262 # the Blink implementation (they are implemented on |impl| itself, | 268 # the Blink implementation (they are implemented on |impl| itself, |
263 # hence header is included in implementing class). | 269 # hence header is included in implementing class). |
264 # However, they are needed for legacy implemented interfaces that | 270 # However, they are needed for legacy implemented interfaces that |
265 # are being treated as partial interfaces, until we remove these. | 271 # are being treated as partial interfaces, until we remove these. |
266 # http://crbug.com/360435 | 272 # http://crbug.com/360435 |
267 implemented_interfaces_include_paths = [] | 273 implemented_interfaces_include_paths = [] |
268 for implemented_interface_info in implemented_interfaces_info: | 274 for implemented_interface_info in implemented_interfaces_info: |
269 if (implemented_interface_info['is_legacy_treat_as_partial_interface '] and | 275 if (implemented_interface_info['is_legacy_treat_as_partial_interface '] and |
270 implemented_interface_info['include_path']): | 276 implemented_interface_info['include_path']): |
271 implemented_interfaces_include_paths.append(implemented_interfac e_info['include_path']) | 277 implemented_interfaces_include_paths.append( |
278 implemented_interface_info['include_path']) | |
279 | |
280 dependencies_full_paths = implemented_interfaces_full_paths | |
281 dependencies_include_paths = implemented_interfaces_include_paths | |
282 partial_interface_dependencies_full_paths = [] | |
283 partial_interface_dependencies_include_paths = [] | |
284 | |
285 component = idl_filename_to_component(interface_info['full_path']) | |
286 for full_path in partial_interfaces_full_paths: | |
287 partial_interface_component = idl_filename_to_component(full_path) | |
288 if component == partial_interface_component: | |
289 dependencies_full_paths.append(full_path) | |
290 else: | |
291 partial_interface_dependencies_full_paths.append(full_path) | |
haraken
2014/10/16 04:24:07
This naming is a bit confusing because some partia
tasak
2014/10/17 07:38:17
Done.
| |
292 | |
293 for include_path in partial_interfaces_include_paths: | |
294 partial_interface_component = idl_filename_to_component(include_path ) | |
295 if component == partial_interface_component: | |
296 dependencies_include_paths.append(include_path) | |
297 else: | |
298 partial_interface_dependencies_include_paths.append(include_path ) | |
haraken
2014/10/16 04:24:07
Ditto.
- include_paths
- other_component_include_
tasak
2014/10/17 07:38:17
Done.
| |
272 | 299 |
273 interface_info.update({ | 300 interface_info.update({ |
274 'dependencies_full_paths': (partial_interfaces_full_paths + | 301 'dependencies_full_paths': dependencies_full_paths, |
275 implemented_interfaces_full_paths), | 302 'dependencies_include_paths': dependencies_include_paths, |
276 'dependencies_include_paths': (partial_interfaces_include_paths + | 303 'partial_interface_dependencies_full_paths': |
277 implemented_interfaces_include_paths) , | 304 partial_interface_dependencies_full_paths, |
305 'partial_interface_dependencies_include_paths': | |
306 partial_interface_dependencies_include_paths, | |
278 }) | 307 }) |
279 | 308 |
280 # Clean up temporary private information | 309 # Clean up temporary private information |
281 for interface_info in interfaces_info.itervalues(): | 310 for interface_info in interfaces_info.itervalues(): |
282 del interface_info['extended_attributes'] | 311 del interface_info['extended_attributes'] |
283 del interface_info['is_legacy_treat_as_partial_interface'] | 312 del interface_info['is_legacy_treat_as_partial_interface'] |
284 del interface_info['parent'] | 313 del interface_info['parent'] |
285 | 314 |
286 # Compute global_type_info to interfaces_info so that idl_compiler does | 315 # Compute global_type_info to interfaces_info so that idl_compiler does |
287 # not need to always calculate the info in __init__. | 316 # not need to always calculate the info in __init__. |
288 compute_global_type_info() | 317 compute_global_type_info() |
289 | 318 |
290 | 319 |
291 ################################################################################ | 320 ################################################################################ |
292 | 321 |
293 def main(): | 322 def main(): |
294 options, args = parse_options() | 323 options, args = parse_options() |
295 # args = Input1, Input2, ..., Output | 324 # args = Input1, Input2, ..., Output |
296 interfaces_info_filename = args.pop() | 325 interfaces_info_filename = args.pop() |
297 info_individuals = read_pickle_files(args) | 326 info_individuals = read_pickle_files(args) |
298 | 327 |
299 compute_interfaces_info_overall(info_individuals) | 328 compute_interfaces_info_overall(info_individuals) |
300 write_pickle_file(interfaces_info_filename, | 329 write_pickle_file(interfaces_info_filename, |
301 interfaces_info, | 330 interfaces_info, |
302 options.write_file_only_if_changed) | 331 options.write_file_only_if_changed) |
303 | 332 |
304 | 333 |
305 if __name__ == '__main__': | 334 if __name__ == '__main__': |
306 sys.exit(main()) | 335 sys.exit(main()) |
OLD | NEW |