OLD | NEW |
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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 generate_contents = v8_interface.generate_interface | 126 generate_contents = v8_interface.generate_interface |
127 header_template = self.jinja_env.get_template(header_template_filename) | 127 header_template = self.jinja_env.get_template(header_template_filename) |
128 cpp_template = self.jinja_env.get_template(cpp_template_filename) | 128 cpp_template = self.jinja_env.get_template(cpp_template_filename) |
129 | 129 |
130 # Generate contents (input parameters for Jinja) | 130 # Generate contents (input parameters for Jinja) |
131 template_contents = generate_contents(interface) | 131 template_contents = generate_contents(interface) |
132 | 132 |
133 # Add includes for interface itself and any dependencies | 133 # Add includes for interface itself and any dependencies |
134 interface_info = self.interfaces_info[interface_name] | 134 interface_info = self.interfaces_info[interface_name] |
135 template_contents['header_includes'].add(interface_info['include_path']) | 135 template_contents['header_includes'].add(interface_info['include_path']) |
| 136 if not template_contents['has_class_bindings']: |
| 137 template_contents['header_includes'].add( |
| 138 'V8%s.h' % interface_info['implemented_as']) |
136 template_contents['header_includes'] = sorted(template_contents['header_
includes']) | 139 template_contents['header_includes'] = sorted(template_contents['header_
includes']) |
137 includes.update(interface_info.get('dependencies_include_paths', [])) | 140 includes.update(interface_info.get('dependencies_include_paths', [])) |
138 template_contents['cpp_includes'] = sorted(includes) | 141 template_contents['cpp_includes'] = sorted(includes) |
139 | 142 |
140 # Render Jinja templates | 143 # Render Jinja templates |
141 header_text = header_template.render(template_contents) | 144 header_text = header_template.render(template_contents) |
142 cpp_text = cpp_template.render(template_contents) | 145 cpp_text = cpp_template.render(template_contents) |
143 return header_text, cpp_text | 146 return header_text, cpp_text |
144 | 147 |
145 | 148 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 | 204 |
202 # Create a dummy file as output for the build system, | 205 # Create a dummy file as output for the build system, |
203 # since filenames of individual cache files are unpredictable and opaque | 206 # since filenames of individual cache files are unpredictable and opaque |
204 # (they are hashes of the template path, which varies based on environment) | 207 # (they are hashes of the template path, which varies based on environment) |
205 with open(dummy_filename, 'w') as dummy_file: | 208 with open(dummy_filename, 'w') as dummy_file: |
206 pass # |open| creates or touches the file | 209 pass # |open| creates or touches the file |
207 | 210 |
208 | 211 |
209 if __name__ == '__main__': | 212 if __name__ == '__main__': |
210 sys.exit(main(sys.argv)) | 213 sys.exit(main(sys.argv)) |
OLD | NEW |