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

Side by Side Diff: Source/bindings/scripts/aggregate_generated_dictionaries.py

Issue 386963003: [WIP][NotForLand] IDL dictionary support (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: sequence and array support Created 6 years, 5 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
« no previous file with comments | « Source/bindings/core/v8/generated.gypi ('k') | Source/bindings/scripts/code_generator_v8.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 """Aggregate generated dictionary impl classes.
6
7 Usage:
8 aggregate_generated_dictionaries.py COMPONENT_DIR INTERFACES_INFO OUTPUT_FILE
9
10 COMPONENT_DIR is the name of a component, i.e., 'core' or 'modules'.
11 INTERFACES_INFO is a pickle file generated by compute_interfaces_info_overall.py .
12 OUTPUT_FILE is the filename of output.
13 """
14
15 import cPickle as pickle
16 import posixpath
17 import sys
18 from utilities import write_file
19
20
21 COPYRIGHT = """// Copyright 2014 The Chromium Authors. All rights reserved.
22 // Use of this source code is governed by a BSD-style license that can be
23 // found in the LICENSE file.
24
25 """
26
27
28 def generate_path(interface_name, interface_info):
29 return posixpath.join(interface_info['relative_dir'],
30 '%s.cpp' % interface_name)
31
32
33 def generate_content(generated_paths):
34 output = [COPYRIGHT,
35 '#define NO_IMPLICIT_ATOMICSTRING\n\n']
36 output.extend('#include "%s"\n' % generated_path
37 for generated_path in sorted(generated_paths))
38 return ''.join(output)
39
40
41 def main(args):
42 # FIXME: we might want to accept multiple output files.
43 if len(args) != 4:
44 raise Exception('Expected 3 arguments.')
45 component_dir = args[1]
46 interfaces_info_file_name = args[2]
47 output_file_name = args[3]
48 with open(interfaces_info_file_name) as interfaces_info_file:
49 interfaces_info = pickle.load(interfaces_info_file)
50
51 generated_paths = [
52 generate_path(interface_name, interface_info)
53 for interface_name, interface_info in interfaces_info.iteritems()
54 if (interface_info['component_dir'] == component_dir and
55 interface_info['is_dictionary'])]
56 contents = generate_content(generated_paths)
57 write_file(contents, output_file_name, only_if_changed=True)
58
59
60 if __name__ == '__main__':
61 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/generated.gypi ('k') | Source/bindings/scripts/code_generator_v8.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698