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

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..b53ef4b228f5172b2fb69ff8e01c8aa007584743 100755
--- a/Source/bindings/scripts/idl_compiler.py
+++ b/Source/bindings/scripts/idl_compiler.py
@@ -52,6 +52,7 @@ 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('--generate-partial', action='store_true')
bashi 2014/10/10 09:48:11 default=False
tasak 2014/10/10 11:43:40 Done.
# ensure output comes last, so command line easy to parse via regexes
parser.disable_interspersed_args()
@@ -83,7 +84,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,
+ generate_partial=False):
"""
Args:
interfaces_info:
@@ -100,16 +102,25 @@ class IdlCompiler(object):
self.interfaces_info = interfaces_info
self.only_if_changed = only_if_changed
self.output_directory = output_directory
+ self.generate_partial = generate_partial
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)
+ if self.generate_partial and 'modules' in definitions:
+ assert component == 'core'
+ target_definitions = definitions['modules']
+ else:
+ target_definitions = definitions[component]
output_code_list = self.code_generator.generate_code(
- definitions[component], interface_name)
+ target_definitions, interface_name)
+ if output_code_list is None:
bashi 2014/10/10 09:48:11 When does this happen?
tasak 2014/10/10 11:43:40 Now we are using core_idl_with_modules_dependency_
+ return
for output_path, output_code in output_code_list:
- write_file(output_code, output_path, self.only_if_changed)
+ if output_code and output_path:
bashi 2014/10/10 09:48:11 When does this happen?
tasak 2014/10/10 11:43:40 Done.
+ write_file(output_code, output_path, self.only_if_changed)
@abc.abstractmethod
def compile_file(self, idl_filename):
@@ -142,7 +153,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,
+ generate_partial=options.generate_partial)
idl_compiler.compile_file(input_filename)

Powered by Google App Engine
This is Rietveld 408576698