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

Side by Side Diff: Source/bindings/scripts/unstable/code_generator_v8.py

Issue 24156003: Revert IDL compiler build flow to Perl, rename 'deprecated' (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 # Copyright (C) 2013 Google Inc. All rights reserved. 1 # Copyright (C) 2013 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 10 matching lines...) Expand all
21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 28
29 """Generate Blink V8 bindings (.h and .cpp files). 29 """Generate Blink V8 bindings (.h and .cpp files).
30 30
31 FIXME: Not currently used in build.
32 This is a rewrite of the Perl IDL compiler in Python, but is not complete.
33 Once it is complete, we will switch all IDL files over to Python at once.
34 Until then, please work on the Perl IDL compiler.
35 For details, see bug http://crbug.com/239771
36
31 Input: An object of class IdlDefinitions, containing an IDL interface X 37 Input: An object of class IdlDefinitions, containing an IDL interface X
32 Output: V8X.h and V8X.cpp 38 Output: V8X.h and V8X.cpp
33 """ 39 """
34 40
35 import os 41 import os
36 import posixpath 42 import posixpath
37 import sys 43 import sys
38 44
39 # jinja2 is in chromium's third_party directory. 45 # jinja2 is in chromium's third_party directory.
40 module_path, module_name = os.path.split(__file__) 46 module_path, module_name = os.path.split(__file__)
41 third_party = os.path.join(module_path, os.pardir, os.pardir, os.pardir, os.pard ir) 47 third_party = os.path.join(module_path, os.pardir, os.pardir, os.pardir, os.pard ir, os.pardir)
42 # Insert at front to override system libraries, and after path[0] == script dir 48 # Insert at front to override system libraries, and after path[0] == script dir
43 sys.path.insert(1, third_party) 49 sys.path.insert(1, third_party)
44 import jinja2 50 import jinja2
45 51
46 templates_dir = os.path.join(module_path, os.pardir, 'templates') 52 templates_dir = os.path.join(module_path, os.pardir, os.pardir, 'templates')
47 53
48 import v8_callback_interface 54 import v8_callback_interface
49 import v8_interface 55 import v8_interface
50 from v8_utilities import cpp_class_name, generate_conditional_string, v8_class_n ame 56 from v8_utilities import cpp_class_name, generate_conditional_string, v8_class_n ame
51 57
52 58
53 class CodeGeneratorV8: 59 class CodeGeneratorV8:
54 def __init__(self, definitions, interface_name, output_directory, relative_d ir_posix, idl_directories, verbose=False): 60 def __init__(self, definitions, interface_name, output_directory, relative_d ir_posix, idl_directories, verbose=False):
55 self.idl_definitions = definitions 61 self.idl_definitions = definitions
56 self.interface_name = interface_name 62 self.interface_name = interface_name
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 self.write_file(header_basename, header_file_text) 118 self.write_file(header_basename, header_file_text)
113 119
114 cpp_basename = v8_class_name(interface) + '.cpp' 120 cpp_basename = v8_class_name(interface) + '.cpp'
115 cpp_file_text = self.cpp_template.render(template_contents) 121 cpp_file_text = self.cpp_template.render(template_contents)
116 self.write_file(cpp_basename, cpp_file_text) 122 self.write_file(cpp_basename, cpp_file_text)
117 123
118 def write_file(self, basename, file_text): 124 def write_file(self, basename, file_text):
119 filename = os.path.join(self.output_directory, basename) 125 filename = os.path.join(self.output_directory, basename)
120 with open(filename, 'w') as output_file: 126 with open(filename, 'w') as output_file:
121 output_file.write(file_text) 127 output_file.write(file_text)
OLDNEW
« no previous file with comments | « Source/bindings/scripts/unstable/blink_idl_parser.py ('k') | Source/bindings/scripts/unstable/idl_compiler.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698