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

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

Issue 2367303002: [Bindings] Remove a redundant option write-file-if-only-changed in bindings (Closed)
Patch Set: Rebase 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 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Generate initPartialInterfacesInModules(), which registers partial interfaces in modules to core interfaces.""" 6 """Generate initPartialInterfacesInModules(), which registers partial interfaces in modules to core interfaces."""
7 7
8 import cPickle as pickle 8 import cPickle as pickle
9 from optparse import OptionParser 9 from optparse import OptionParser
10 import os 10 import os
(...skipping 24 matching lines...) Expand all
35 35
36 } // namespace blink 36 } // namespace blink
37 """ 37 """
38 38
39 39
40 def parse_options(): 40 def parse_options():
41 usage = 'Usage: %prog [options]' 41 usage = 'Usage: %prog [options]'
42 parser = OptionParser(usage=usage) 42 parser = OptionParser(usage=usage)
43 parser.add_option('--idl-files-list', help="a text file containing the IDL f ile paths, so the command line doesn't exceed OS length limits.") 43 parser.add_option('--idl-files-list', help="a text file containing the IDL f ile paths, so the command line doesn't exceed OS length limits.")
44 parser.add_option('--gyp-format-list', default=False, action='store_true', h elp="if specified, idl-files-list is newline separated. When unspecified, it's f ormatted as a Posix command line.") 44 parser.add_option('--gyp-format-list', default=False, action='store_true', h elp="if specified, idl-files-list is newline separated. When unspecified, it's f ormatted as a Posix command line.")
45 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')
46 parser.add_option('--output') 45 parser.add_option('--output')
47 46
48 options, args = parser.parse_args() 47 options, args = parser.parse_args()
49 if options.output is None: 48 if options.output is None:
50 parser.error('Must specify output file using --output.') 49 parser.error('Must specify output file using --output.')
51 if options.idl_files_list is None: 50 if options.idl_files_list is None:
52 parser.error('Must specify a list of IDL files using --idl-files-list.') 51 parser.error('Must specify a list of IDL files using --idl-files-list.')
53 if options.write_file_only_if_changed is None:
54 parser.error('Must specify whether file is only written if changed using --write-file-only-if-changed.')
55 options.write_file_only_if_changed = bool(options.write_file_only_if_changed )
56 return options 52 return options
57 53
58 54
59 def extract_meta_data(file_paths): 55 def extract_meta_data(file_paths):
60 """Extracts interface name from each IDL file.""" 56 """Extracts interface name from each IDL file."""
61 meta_data_list = [] 57 meta_data_list = []
62 58
63 for file_path in file_paths: 59 for file_path in file_paths:
64 if not file_path.endswith('.idl'): 60 if not file_path.endswith('.idl'):
65 print 'WARNING: non-IDL file passed: "%s"' % file_path 61 print 'WARNING: non-IDL file passed: "%s"' % file_path
(...skipping 30 matching lines...) Expand all
96 includes = ['#include "bindings/modules/v8/%s.h"' % interface_name 92 includes = ['#include "bindings/modules/v8/%s.h"' % interface_name
97 for interface_name in interface_names] 93 for interface_name in interface_names]
98 initialize_calls = [' %s::initialize();' % interface_name 94 initialize_calls = [' %s::initialize();' % interface_name
99 for interface_name in interface_names] 95 for interface_name in interface_names]
100 96
101 content = _INIT_PARTIAL_INTERFACE % ( 97 content = _INIT_PARTIAL_INTERFACE % (
102 _COPYRIGHT, 98 _COPYRIGHT,
103 '\n'.join(includes), 99 '\n'.join(includes),
104 '\n'.join(initialize_calls)) 100 '\n'.join(initialize_calls))
105 101
106 write_file(content, options.output, 102 write_file(content, options.output)
107 only_if_changed=options.write_file_only_if_changed)
108 103
109 104
110 if __name__ == '__main__': 105 if __name__ == '__main__':
111 sys.exit(main()) 106 sys.exit(main())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698