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

Unified Diff: Source/bindings/scripts/idl_compiler.py

Issue 618373003: [bindings] partial interfaces should not violate componentization (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
Index: Source/bindings/scripts/idl_compiler.py
diff --git a/Source/bindings/scripts/idl_compiler.py b/Source/bindings/scripts/idl_compiler.py
index 3721e12129c7f232c30e03e2bfb0102eb21a95ac..8e3d4240fa69e41160a9e174cda1c7839e707f1d 100755
--- a/Source/bindings/scripts/idl_compiler.py
+++ b/Source/bindings/scripts/idl_compiler.py
@@ -52,6 +52,9 @@ def parse_options():
parser.add_option('--output-directory')
parser.add_option('--interfaces-info-file')
parser.add_option('--write-file-only-if-changed', type='int')
+ parser.add_option('--target-component',
haraken 2014/10/16 04:24:08 We should always explicitly specify --target-compo
tasak 2014/10/17 07:38:17 Done.
+ help='target component to generate code, defaults to '
+ 'component of input idl file')
# ensure output comes last, so command line easy to parse via regexes
parser.disable_interspersed_args()
@@ -83,7 +86,8 @@ class IdlCompiler(object):
def __init__(self, output_directory, cache_directory='',
code_generator=None, interfaces_info=None,
- interfaces_info_filename='', only_if_changed=False):
+ interfaces_info_filename='', only_if_changed=False,
+ target_component=None):
"""
Args:
interfaces_info:
@@ -100,14 +104,16 @@ class IdlCompiler(object):
self.interfaces_info = interfaces_info
self.only_if_changed = only_if_changed
self.output_directory = output_directory
+ self.target_component = target_component
self.reader = IdlReader(interfaces_info, cache_directory)
def compile_and_write(self, idl_filename):
interface_name = idl_filename_to_interface_name(idl_filename)
- component = idl_filename_to_component(idl_filename)
definitions = self.reader.read_idl_definitions(idl_filename)
+ target_component = self.target_component or idl_filename_to_component(idl_filename)
+ target_definitions = definitions[target_component]
output_code_list = self.code_generator.generate_code(
- definitions[component], interface_name)
+ target_definitions, interface_name)
for output_path, output_code in output_code_list:
write_file(output_code, output_path, self.only_if_changed)
@@ -142,7 +148,8 @@ def generate_bindings(options, input_filename):
options.output_directory,
cache_directory=options.cache_directory,
interfaces_info_filename=options.interfaces_info_file,
- only_if_changed=options.write_file_only_if_changed)
+ only_if_changed=options.write_file_only_if_changed,
+ target_component=options.target_component)
idl_compiler.compile_file(input_filename)

Powered by Google App Engine
This is Rietveld 408576698