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

Unified Diff: third_party/WebKit/Source/bindings/scripts/aggregate_generated_bindings.py

Issue 2318933002: [Bindings] Remove aggregation of generated binding code (Closed)
Patch Set: Fix import order Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/bindings/scripts/aggregate_generated_bindings.py
diff --git a/third_party/WebKit/Source/bindings/scripts/aggregate_generated_bindings.py b/third_party/WebKit/Source/bindings/scripts/aggregate_generated_bindings.py
deleted file mode 100755
index 0e4b036352758b086072c3da39346f5b6df9832a..0000000000000000000000000000000000000000
--- a/third_party/WebKit/Source/bindings/scripts/aggregate_generated_bindings.py
+++ /dev/null
@@ -1,188 +0,0 @@
-#!/usr/bin/python
-#
-# Copyright (C) 2009 Google Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following disclaimer
-# in the documentation and/or other materials provided with the
-# distribution.
-# * Neither the name of Google Inc. nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# Copyright (c) 2009 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.
-
-"""Generate aggregate .cpp files that include multiple V8 binding .cpp files.
-
-This can be a single output file, to preserve symbol space; or multiple output
-files, to reduce maximum compilation unit size and allow parallel compilation.
-
-Usage:
-aggregate_generated_bindings.py --component-directory COMPONENT_DIR --input-file IDL_FILES_LIST OUTPUT_FILE1 OUTPUT_FILE2 ...
-
-COMPONENT_DIR is the relative directory of a component, e.g., 'core', 'modules'.
-IDL_FILES_LIST is a text file containing the IDL file paths, so the command
-line doesn't exceed OS length limits.
-OUTPUT_FILE1 etc. are filenames of output files.
-
-Design doc: http://www.chromium.org/developers/design-documents/idl-build
-"""
-
-import errno
-import optparse
-import os
-import re
-import sys
-
-from utilities import (should_generate_impl_file_from_idl,
- get_file_contents,
- idl_filename_to_interface_name,
- read_idl_files_list_from_file)
-
-COPYRIGHT_TEMPLATE = """/*
- * THIS FILE WAS AUTOMATICALLY GENERATED, DO NOT EDIT.
- *
- * This file was generated by the action_derivedsourcesallinone.py script.
- *
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-"""
-
-
-def extract_meta_data(file_paths):
- """Extracts interface name from each IDL file."""
- meta_data_list = []
-
- for file_path in file_paths:
- if not file_path.endswith('.idl'):
- print 'WARNING: non-IDL file passed: "%s"' % file_path
- continue
- if not os.path.exists(file_path):
- print 'WARNING: file not found: "%s"' % file_path
- continue
-
- idl_file_contents = get_file_contents(file_path)
- if not should_generate_impl_file_from_idl(idl_file_contents):
- continue
-
- # Extract interface name from file name
- interface_name = idl_filename_to_interface_name(file_path)
-
- meta_data = {
- 'name': interface_name,
- }
- meta_data_list.append(meta_data)
-
- return meta_data_list
-
-
-def generate_content(component_dir, aggregate_partial_interfaces, files_meta_data_this_partition):
- # Add fixed content.
- output = [COPYRIGHT_TEMPLATE,
- '#define NO_IMPLICIT_ATOMICSTRING\n\n']
-
- # List all includes.
- files_meta_data_this_partition.sort()
- suffix = 'Partial' if aggregate_partial_interfaces else ''
- for meta_data in files_meta_data_this_partition:
- cpp_filename = 'V8%s%s.cpp' % (meta_data['name'], suffix)
-
- output.append('#include "bindings/%s/v8/%s"\n' %
- (component_dir, cpp_filename))
-
- return ''.join(output)
-
-
-def write_content(content, output_file_name):
- parent_path, file_name = os.path.split(output_file_name)
- if not os.path.exists(parent_path):
- print 'Creating directory: %s' % parent_path
- os.makedirs(parent_path)
- with open(output_file_name, 'w') as f:
- f.write(content)
-
-
-def parse_options():
- parser = optparse.OptionParser()
- parser.add_option('--component-directory')
- parser.add_option('--input-file',
- help='A file name which lists up target IDL file names.',
- type='string')
- parser.add_option('--partial',
- help='To parse partial IDLs, add this option.',
- action='store_true',
- dest='partial',
- default=False)
-
- options, output_file_names = parser.parse_args()
- if len(output_file_names) == 0:
- raise Exception('Expected at least one output file name(s).')
- if not options.input_file:
- raise Exception('No input file is specified.')
-
- return options, output_file_names
-
-
-def main():
- options, output_file_names = parse_options()
- component_dir = options.component_directory
- input_file_name = options.input_file
- aggregate_partial_interfaces = options.partial
- idl_file_names = read_idl_files_list_from_file(input_file_name,
- is_gyp_format=True)
-
- files_meta_data = extract_meta_data(idl_file_names)
- total_partitions = len(output_file_names)
- for partition, file_name in enumerate(output_file_names):
- files_meta_data_this_partition = [
- meta_data for meta_data in files_meta_data
- if hash(meta_data['name']) % total_partitions == partition]
- file_contents = generate_content(component_dir,
- aggregate_partial_interfaces,
- files_meta_data_this_partition)
- write_content(file_contents, file_name)
-
-
-if __name__ == '__main__':
- sys.exit(main())

Powered by Google App Engine
This is Rietveld 408576698