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

Side by Side Diff: bindings/dart/scripts/dart_compiler.py

Issue 959933002: Move IDLs to 39 roll (Closed) Base URL: https://dart.googlecode.com/svn/third_party/WebCore
Patch Set: Created 5 years, 9 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 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (C) 2013 Google Inc. All rights reserved. 2 # Copyright (C) 2013 Google Inc. All rights reserved.
3 # 3 #
4 # Redistribution and use in source and binary forms, with or without 4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are 5 # modification, are permitted provided that the following conditions are
6 # met: 6 # met:
7 # 7 #
8 # * Redistributions of source code must retain the above copyright 8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer. 9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above 10 # * Redistributions in binary form must reproduce the above
(...skipping 20 matching lines...) Expand all
31 31
32 Design doc: http://www.chromium.org/developers/design-documents/idl-compiler 32 Design doc: http://www.chromium.org/developers/design-documents/idl-compiler
33 """ 33 """
34 34
35 import abc 35 import abc
36 from optparse import OptionParser 36 from optparse import OptionParser
37 import os 37 import os
38 import cPickle as pickle 38 import cPickle as pickle
39 39
40 from idl_reader import IdlReader 40 from idl_reader import IdlReader
41 from utilities import write_file 41 from utilities import write_file, idl_filename_to_component
42 42
43 43
44 # TODO(terry): Temporary whitelist of IDL files to skip code generating. e.g., 44 # TODO(terry): Temporary whitelist of IDL files to skip code generating. e.g.,
45 # adding 'Animation.idl' to this list will skip that IDL file. 45 # adding 'Animation.idl' to this list will skip that IDL file.
46 SKIP_IDL_FILES = [''] 46 SKIP_IDL_FILES = ['']
47 47
48 48
49 def parse_options(): 49 def parse_options():
50 parser = OptionParser() 50 parser = OptionParser()
51 parser.add_option('--idl-attributes-file', 51 parser.add_option('--idl-attributes-file',
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 100
101 self.only_if_changed = only_if_changed 101 self.only_if_changed = only_if_changed
102 self.output_directory = output_directory 102 self.output_directory = output_directory
103 self.reader = IdlReader(interfaces_info, output_directory) 103 self.reader = IdlReader(interfaces_info, output_directory)
104 104
105 def compile_and_write(self, idl_filename, output_filenames): 105 def compile_and_write(self, idl_filename, output_filenames):
106 interface_name = idl_filename_to_interface_name(idl_filename) 106 interface_name = idl_filename_to_interface_name(idl_filename)
107 idl_pickle_filename = os.path.join(self.output_directory, 107 idl_pickle_filename = os.path.join(self.output_directory,
108 '%s_globals.pickle' % interface_name) 108 '%s_globals.pickle' % interface_name)
109 definitions = self.reader.read_idl_definitions(idl_filename) 109 definitions = self.reader.read_idl_definitions(idl_filename)
110 output_code_list = self.code_generator.generate_code(definitions, 110 component = idl_filename_to_component(idl_filename)
111
112 output_code_list = self.code_generator.generate_code(definitions[compone nt],
111 interface_name, 113 interface_name,
112 idl_pickle_filename , 114 idl_pickle_filename ,
113 self.only_if_change d) 115 self.only_if_change d)
114 116
115 # TODO(terry): Temporary to disable code generating an IDL. 117 # TODO(terry): Temporary to disable code generating an IDL.
116 base_idl_filename = os.path.basename(idl_filename) 118 base_idl_filename = os.path.basename(idl_filename)
117 if base_idl_filename in SKIP_IDL_FILES: 119 if base_idl_filename in SKIP_IDL_FILES:
118 print "----- Skipping %s -----" % base_idl_filename 120 print "----- Skipping %s -----" % base_idl_filename
119 else: 121 else:
120 for output_code, output_filename in zip(output_code_list, output_fil enames): 122 for output_code, output_filename in zip(output_code_list, output_fil enames):
121 write_file(output_code, output_filename, self.only_if_changed) 123 write_file(output_code, output_filename, self.only_if_changed)
122 124
123 def generate_global_and_write(self, global_pickle_directories, output_filena mes): 125 def generate_global_and_write(self, global_entries, output_filenames):
124 output_code_list = self.code_generator.generate_globals(global_pickle_di rectories, 126 output_code_list = self.code_generator.generate_globals(global_entries)
125 self.output_dire ctory)
126 for output_code, output_filename in zip(output_code_list, output_filenam es): 127 for output_code, output_filename in zip(output_code_list, output_filenam es):
127 write_file(output_code, output_filename, self.only_if_changed) 128 write_file(output_code, output_filename, self.only_if_changed)
128 129
130 def generate_dart_blink_and_write(self, global_entries, output_filename):
131 output_code = self.code_generator.generate_dart_blink(global_entries)
132 write_file(output_code, output_filename, self.only_if_changed)
133
129 @abc.abstractmethod 134 @abc.abstractmethod
130 def compile_file(self, idl_filename): 135 def compile_file(self, idl_filename):
131 pass 136 pass
OLDNEW
« no previous file with comments | « bindings/dart/scripts/dart_callback_interface.py ('k') | bindings/dart/scripts/dart_dictionary.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698