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

Unified Diff: bindings/scripts/aggregate_generated_bindings.py

Issue 1660113002: Updated to Chrome 45 (2454) moved from SVN to git. Base URL: https://github.com/dart-lang/webcore.git@roll_45
Patch Set: Created 4 years, 11 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
« no previous file with comments | « bindings/dart/scripts/test/main.py ('k') | bindings/scripts/blink_idl_lexer.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bindings/scripts/aggregate_generated_bindings.py
diff --git a/bindings/scripts/aggregate_generated_bindings.py b/bindings/scripts/aggregate_generated_bindings.py
index 050c93a1d86037ddebebded7e80ea20716b1b436..05e9ffd8906bc00bf77c210423e86547f850586f 100755
--- a/bindings/scripts/aggregate_generated_bindings.py
+++ b/bindings/scripts/aggregate_generated_bindings.py
@@ -53,7 +53,7 @@ import os
import re
import sys
-from utilities import idl_filename_to_interface_name, read_idl_files_list_from_file
+from utilities import should_generate_impl_file_from_idl, get_file_contents, idl_filename_to_component, idl_filename_to_interface_name, read_idl_files_list_from_file
# A regexp for finding Conditional attributes in interface definitions.
CONDITIONAL_PATTERN = re.compile(
@@ -100,10 +100,8 @@ COPYRIGHT_TEMPLATE = """/*
"""
-def extract_conditional(idl_file_path):
+def extract_conditional(idl_contents):
"""Find [Conditional] interface extended attribute."""
- with open(idl_file_path) as idl_file:
- idl_contents = idl_file.read()
match = CONDITIONAL_PATTERN.search(idl_contents)
if not match:
@@ -123,11 +121,15 @@ def extract_meta_data(file_paths):
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 = {
- 'conditional': extract_conditional(file_path),
+ 'conditional': extract_conditional(idl_file_contents),
'name': interface_name,
}
meta_data_list.append(meta_data)
@@ -135,7 +137,7 @@ def extract_meta_data(file_paths):
return meta_data_list
-def generate_content(component_dir, files_meta_data_this_partition, prefix):
+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']
@@ -152,8 +154,13 @@ def generate_content(component_dir, files_meta_data_this_partition, prefix):
output.append('\n#if ENABLE(%s)\n' % conditional)
prev_conditional = conditional
- output.append('#include "bindings/%s/%s/%s%s.cpp"\n' %
- (component_dir, prefix.lower(), prefix, meta_data['name']))
+ if aggregate_partial_interfaces:
+ cpp_filename = 'V8%sPartial.cpp' % meta_data['name']
+ else:
+ cpp_filename = 'V8%s.cpp' % meta_data['name']
+
+ output.append('#include "bindings/%s/v8/%s"\n' %
+ (component_dir, cpp_filename))
if prev_conditional:
output.append('#endif\n')
@@ -173,18 +180,18 @@ def write_content(content, output_file_name):
def main(args):
if len(args) <= 4:
raise Exception('Expected at least 5 arguments.')
- if (args[1] == '--dart'):
- component_dir = args[2]
- input_file_name = args[3]
- prefix = 'Dart'
- else:
- component_dir = args[1]
- input_file_name = args[2]
- prefix = 'V8'
+ component_dir = args[1]
+ input_file_name = args[2]
in_out_break_index = args.index('--')
output_file_names = args[in_out_break_index + 1:]
idl_file_names = read_idl_files_list_from_file(input_file_name)
+ components = set([idl_filename_to_component(filename)
+ for filename in idl_file_names])
+ if len(components) != 1:
+ raise Exception('Cannot aggregate generated codes in different components')
+ aggregate_partial_interfaces = component_dir not in components
+
files_meta_data = extract_meta_data(idl_file_names)
total_partitions = len(output_file_names)
for partition, file_name in enumerate(output_file_names):
@@ -192,8 +199,8 @@ def main(args):
meta_data for meta_data in files_meta_data
if hash(meta_data['name']) % total_partitions == partition]
file_contents = generate_content(component_dir,
- files_meta_data_this_partition,
- prefix)
+ aggregate_partial_interfaces,
+ files_meta_data_this_partition)
write_content(file_contents, file_name)
« no previous file with comments | « bindings/dart/scripts/test/main.py ('k') | bindings/scripts/blink_idl_lexer.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698