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

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

Issue 429853002: IDL: Add build target for IDL dictionary impl generation in core (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 4 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 | « Source/bindings/scripts/compute_interfaces_info_individual.py ('k') | Source/bindings/scripts/scripts.gni » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/scripts/idl_compiler.py
diff --git a/Source/bindings/scripts/idl_compiler.py b/Source/bindings/scripts/idl_compiler.py
index c74aae7a002777349c65c6c18c68f1ae8c266ba8..23c0bcceaf3995ab483953a9c7d02be16e5a4ea1 100755
--- a/Source/bindings/scripts/idl_compiler.py
+++ b/Source/bindings/scripts/idl_compiler.py
@@ -38,15 +38,17 @@ import os
import cPickle as pickle
import sys
-from code_generator_v8 import CodeGeneratorV8
+from code_generator_v8 import CodeGeneratorDictionaryImpl, CodeGeneratorV8
from idl_reader import IdlReader
-from utilities import write_file
+from utilities import read_idl_files_list_from_file, write_file
def parse_options():
parser = OptionParser()
parser.add_option('--cache-directory',
help='cache directory, defaults to output directory')
+ parser.add_option('--generate-dictionary-impl',
+ action="store_true", default=False)
parser.add_option('--output-directory')
parser.add_option('--interfaces-info-file')
parser.add_option('--write-file-only-if-changed', type='int')
@@ -124,14 +126,46 @@ class IdlCompilerV8(IdlCompiler):
self.compile_and_write(idl_filename)
-def main():
- options, idl_filename = parse_options()
+class IdlCompilerDictionaryImpl(IdlCompiler):
+ def __init__(self, *args, **kwargs):
+ IdlCompiler.__init__(self, *args, **kwargs)
+ self.code_generator = CodeGeneratorDictionaryImpl(
+ self.interfaces_info, self.cache_directory, self.output_directory)
+
+ def compile_file(self, idl_filename):
+ self.compile_and_write(idl_filename)
+
+
+def generate_bindings(options, input_filename):
idl_compiler = IdlCompilerV8(
options.output_directory,
cache_directory=options.cache_directory,
interfaces_info_filename=options.interfaces_info_file,
only_if_changed=options.write_file_only_if_changed)
- idl_compiler.compile_file(idl_filename)
+ idl_compiler.compile_file(input_filename)
+
+
+def generate_dictionary_impl(options, input_filename):
+ idl_compiler = IdlCompilerDictionaryImpl(
+ options.output_directory,
+ cache_directory=options.cache_directory,
+ interfaces_info_filename=options.interfaces_info_file,
+ only_if_changed=options.write_file_only_if_changed)
+
+ idl_filenames = read_idl_files_list_from_file(input_filename)
+ for idl_filename in idl_filenames:
+ idl_compiler.compile_file(idl_filename)
+
+
+def main():
+ options, input_filename = parse_options()
+ if options.generate_dictionary_impl:
+ # |input_filename| should be a file which contains a list of IDL
+ # dictionary paths.
+ generate_dictionary_impl(options, input_filename)
+ else:
+ # |input_filename| should be a path of an IDL file.
+ generate_bindings(options, input_filename)
if __name__ == '__main__':
« no previous file with comments | « Source/bindings/scripts/compute_interfaces_info_individual.py ('k') | Source/bindings/scripts/scripts.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698