Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: third_party/WebKit/Source/bindings/scripts/compute_interfaces_info_individual.py

Issue 2372463002: [Bindings] Pass files to compute_interfaces_info_individual.py in one way (Closed)
Patch Set: . Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 idl_compiler import idl_filename_to_interface_name 50 from idl_compiler import idl_filename_to_interface_name
51 from idl_definitions import Visitor 51 from idl_definitions import Visitor
52 from idl_reader import IdlReader 52 from idl_reader import IdlReader
53 from utilities import get_file_contents, read_file_to_list, idl_filename_to_inte rface_name, idl_filename_to_component, write_pickle_file, get_interface_extended _attributes_from_idl, is_callback_interface_from_idl, merge_dict_recursively, sh orten_union_name 53 from utilities import idl_filename_to_component
54 from utilities import idl_filename_to_interface_name
55 from utilities import merge_dict_recursively
56 from utilities import read_idl_files_list_from_file
57 from utilities import shorten_union_name
58 from utilities import write_pickle_file
59
54 60
55 module_path = os.path.dirname(__file__) 61 module_path = os.path.dirname(__file__)
56 source_path = os.path.normpath(os.path.join(module_path, os.pardir, os.pardir)) 62 source_path = os.path.normpath(os.path.join(module_path, os.pardir, os.pardir))
57 gen_path = os.path.join('gen', 'blink') 63 gen_path = os.path.join('gen', 'blink')
58 64
59 65
60 class IdlBadFilenameError(Exception): 66 class IdlBadFilenameError(Exception):
61 """Raised if an IDL filename disagrees with the interface name in the file." "" 67 """Raised if an IDL filename disagrees with the interface name in the file." ""
62 pass 68 pass
63 69
64 70
65 def parse_options(): 71 def parse_options():
66 usage = 'Usage: %prog [options] [generated1.idl]...' 72 usage = 'Usage: %prog [options]'
67 parser = optparse.OptionParser(usage=usage) 73 parser = optparse.OptionParser(usage=usage)
68 parser.add_option('--cache-directory', help='cache directory') 74 parser.add_option('--cache-directory', help='cache directory')
69 parser.add_option('--idl-files-list', help='file listing IDL files') 75 parser.add_option('--idl-files-list', help='file listing IDL files')
70 parser.add_option('--interfaces-info-file', help='interface info pickle file ') 76 parser.add_option('--interfaces-info-file', help='interface info pickle file ')
71 parser.add_option('--component-info-file', help='component wide info pickle file') 77 parser.add_option('--component-info-file', help='component wide info pickle file')
72 parser.add_option('--write-file-only-if-changed', type='int', help='if true, do not write an output file if it would be identical to the existing one, which avoids unnecessary rebuilds in ninja') 78 parser.add_option('--write-file-only-if-changed', type='int', help='if true, do not write an output file if it would be identical to the existing one, which avoids unnecessary rebuilds in ninja')
73 79
74 options, args = parser.parse_args() 80 options, args = parser.parse_args()
75 if options.interfaces_info_file is None: 81 if options.interfaces_info_file is None:
76 parser.error('Must specify an output file using --interfaces-info-file.' ) 82 parser.error('Must specify an output file using --interfaces-info-file.' )
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 'enumerations': dict((enum.name, enum.values) 340 'enumerations': dict((enum.name, enum.values)
335 for enum in self.enumerations), 341 for enum in self.enumerations),
336 'typedefs': self.typedefs, 342 'typedefs': self.typedefs,
337 'union_types': self.union_types, 343 'union_types': self.union_types,
338 } 344 }
339 345
340 346
341 ################################################################################ 347 ################################################################################
342 348
343 def main(): 349 def main():
344 options, args = parse_options() 350 options, _ = parse_options()
345 351
346 # Static IDL files are passed in a file (generated at GYP time), due to OS 352 # IDL files are passed in a file, due to OS command line length limits
347 # command line length limits 353 idl_files = read_idl_files_list_from_file(options.idl_files_list, is_gyp_for mat=False)
348 idl_files = read_file_to_list(options.idl_files_list)
349 # Generated IDL files are passed at the command line, since these are in the
350 # build directory, which is determined at build time, not GYP time, so these
351 # cannot be included in the file listing static files
352 idl_files.extend(args)
353 354
354 # Compute information for individual files 355 # Compute information for individual files
355 # Information is stored in global variables interfaces_info and 356 # Information is stored in global variables interfaces_info and
356 # partial_interface_files. 357 # partial_interface_files.
357 info_collector = InterfaceInfoCollector(options.cache_directory) 358 info_collector = InterfaceInfoCollector(options.cache_directory)
358 for idl_filename in idl_files: 359 for idl_filename in idl_files:
359 info_collector.collect_info(idl_filename) 360 info_collector.collect_info(idl_filename)
360 361
361 write_pickle_file(options.interfaces_info_file, 362 write_pickle_file(options.interfaces_info_file,
362 info_collector.get_info_as_dict(), 363 info_collector.get_info_as_dict(),
363 options.write_file_only_if_changed) 364 options.write_file_only_if_changed)
364 write_pickle_file(options.component_info_file, 365 write_pickle_file(options.component_info_file,
365 info_collector.get_component_info_as_dict(), 366 info_collector.get_component_info_as_dict(),
366 options.write_file_only_if_changed) 367 options.write_file_only_if_changed)
367 368
368 if __name__ == '__main__': 369 if __name__ == '__main__':
369 sys.exit(main()) 370 sys.exit(main())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698