| Index: Source/bindings/scripts/aggregate_generated_dictionaries.py
|
| diff --git a/Source/bindings/scripts/aggregate_generated_dictionaries.py b/Source/bindings/scripts/aggregate_generated_dictionaries.py
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..c736b4bb3dd25d54570a7eef2aa5458f5f258d04
|
| --- /dev/null
|
| +++ b/Source/bindings/scripts/aggregate_generated_dictionaries.py
|
| @@ -0,0 +1,61 @@
|
| +# Copyright 2014 The Chromium Authors. All rights reserved.
|
| +# Use of this source code is governed by a BSD-style license that can be
|
| +# found in the LICENSE file.
|
| +
|
| +"""Aggregate generated dictionary impl classes.
|
| +
|
| +Usage:
|
| +aggregate_generated_dictionaries.py COMPONENT_DIR INTERFACES_INFO OUTPUT_FILE
|
| +
|
| +COMPONENT_DIR is the name of a component, i.e., 'core' or 'modules'.
|
| +INTERFACES_INFO is a pickle file generated by compute_interfaces_info_overall.py.
|
| +OUTPUT_FILE is the filename of output.
|
| +"""
|
| +
|
| +import cPickle as pickle
|
| +import posixpath
|
| +import sys
|
| +from utilities import write_file
|
| +
|
| +
|
| +COPYRIGHT = """// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +"""
|
| +
|
| +
|
| +def generate_path(interface_name, interface_info):
|
| + return posixpath.join(interface_info['relative_dir'],
|
| + '%s.cpp' % interface_name)
|
| +
|
| +
|
| +def generate_content(generated_paths):
|
| + output = [COPYRIGHT,
|
| + '#define NO_IMPLICIT_ATOMICSTRING\n\n']
|
| + output.extend('#include "%s"\n' % generated_path
|
| + for generated_path in sorted(generated_paths))
|
| + return ''.join(output)
|
| +
|
| +
|
| +def main(args):
|
| + # FIXME: we might want to accept multiple output files.
|
| + if len(args) != 4:
|
| + raise Exception('Expected 3 arguments.')
|
| + component_dir = args[1]
|
| + interfaces_info_file_name = args[2]
|
| + output_file_name = args[3]
|
| + with open(interfaces_info_file_name) as interfaces_info_file:
|
| + interfaces_info = pickle.load(interfaces_info_file)
|
| +
|
| + generated_paths = [
|
| + generate_path(interface_name, interface_info)
|
| + for interface_name, interface_info in interfaces_info.iteritems()
|
| + if (interface_info['component_dir'] == component_dir and
|
| + interface_info['is_dictionary'])]
|
| + contents = generate_content(generated_paths)
|
| + write_file(contents, output_file_name, only_if_changed=True)
|
| +
|
| +
|
| +if __name__ == '__main__':
|
| + sys.exit(main(sys.argv))
|
|
|