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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 self.target_component = target_component | 323 self.target_component = target_component |
324 set_global_type_info(info_provider) | 324 set_global_type_info(info_provider) |
325 | 325 |
326 def generate_code(self): | 326 def generate_code(self): |
327 union_types = self.info_provider.union_types | 327 union_types = self.info_provider.union_types |
328 if not union_types: | 328 if not union_types: |
329 return () | 329 return () |
330 header_template = self.jinja_env.get_template('union.h') | 330 header_template = self.jinja_env.get_template('union.h') |
331 cpp_template = self.jinja_env.get_template('union.cpp') | 331 cpp_template = self.jinja_env.get_template('union.cpp') |
332 template_context = v8_union.union_context( | 332 template_context = v8_union.union_context( |
333 union_types, self.info_provider.interfaces_info) | 333 union_types, self.info_provider.interfaces_info, self.target_compone
nt) |
334 template_context['code_generator'] = module_pyname | 334 template_context['code_generator'] = module_pyname |
335 capitalized_component = self.target_component.capitalize() | 335 capitalized_component = self.target_component.capitalize() |
336 template_context['header_filename'] = 'bindings/%s/v8/UnionTypes%s.h' %
( | 336 template_context['header_filename'] = 'bindings/%s/v8/UnionTypes%s.h' %
( |
337 self.target_component, capitalized_component) | 337 self.target_component, capitalized_component) |
338 template_context['macro_guard'] = 'UnionType%s_h' % capitalized_componen
t | 338 template_context['macro_guard'] = 'UnionType%s_h' % capitalized_componen
t |
339 | 339 |
340 # Add UnionTypesCore.h as a dependency when we generate modules union ty
pes | 340 # Add UnionTypesCore.h as a dependency when we generate modules union ty
pes |
341 # because we only generate union type containers which are used by both | 341 # because we only generate union type containers which are used by both |
342 # core and modules in UnionTypesCore.h. | 342 # core and modules in UnionTypesCore.h. |
343 # FIXME: This is an ad hoc workaround and we need a general way to | 343 # FIXME: This is an ad hoc workaround and we need a general way to |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 | 438 |
439 # Create a dummy file as output for the build system, | 439 # Create a dummy file as output for the build system, |
440 # since filenames of individual cache files are unpredictable and opaque | 440 # since filenames of individual cache files are unpredictable and opaque |
441 # (they are hashes of the template path, which varies based on environment) | 441 # (they are hashes of the template path, which varies based on environment) |
442 with open(dummy_filename, 'w') as dummy_file: | 442 with open(dummy_filename, 'w') as dummy_file: |
443 pass # |open| creates or touches the file | 443 pass # |open| creates or touches the file |
444 | 444 |
445 | 445 |
446 if __name__ == '__main__': | 446 if __name__ == '__main__': |
447 sys.exit(main(sys.argv)) | 447 sys.exit(main(sys.argv)) |
OLD | NEW |