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

Side by Side Diff: lib/dom/scripts/fremontcutbuilder.py

Issue 10014028: Remove EventListener attributes from Dart DOM API. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Create real IDLParentInterface. Created 8 years, 8 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) 2011, the Dart project authors. Please see the AUTHORS file 2 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
3 # for details. All rights reserved. Use of this source code is governed by a 3 # for details. All rights reserved. Use of this source code is governed by a
4 # BSD-style license that can be found in the LICENSE file. 4 # BSD-style license that can be found in the LICENSE file.
5 5
6 import database 6 import database
7 import databasebuilder 7 import databasebuilder
8 import idlparser 8 import idlparser
9 import logging.config 9 import logging.config
10 import os.path 10 import os.path
11 import tempfile 11 import tempfile
12 import sys 12 import sys
13 13
14 def build_database(idl_list_file_name): 14 def build_database(idl_list_file_name, database_dir):
15 """This code reconstructs the FremontCut IDL database from W3C, 15 """This code reconstructs the FremontCut IDL database from W3C,
16 WebKit and Dart IDL files.""" 16 WebKit and Dart IDL files."""
17 current_dir = os.path.dirname(__file__) 17 current_dir = os.path.dirname(__file__)
18 logging.config.fileConfig(os.path.join(current_dir, "logging.conf")) 18 logging.config.fileConfig(os.path.join(current_dir, "logging.conf"))
19 19
20 db = database.Database(os.path.join(current_dir, '..', 'database')) 20 db = database.Database(database_dir)
21 21
22 # Delete all existing IDLs in the DB. 22 # Delete all existing IDLs in the DB.
23 db.Delete() 23 db.Delete()
24 24
25 builder = databasebuilder.DatabaseBuilder(db) 25 builder = databasebuilder.DatabaseBuilder(db)
26 26
27 # TODO(vsm): Move this to a README. 27 # TODO(vsm): Move this to a README.
28 # This is the Dart SVN revision. 28 # This is the Dart SVN revision.
29 webkit_revision = '1060' 29 webkit_revision = '1060'
30 30
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 ] 119 ]
120 120
121 # Import WebKit IDLs. 121 # Import WebKit IDLs.
122 idl_list_file = open(idl_list_file_name, 'r') 122 idl_list_file = open(idl_list_file_name, 'r')
123 for file_name in idl_list_file: 123 for file_name in idl_list_file:
124 file_name = file_name.strip() 124 file_name = file_name.strip()
125 idl_file_name = os.path.join(os.path.dirname(idl_list_file_name), file_name) 125 idl_file_name = os.path.join(os.path.dirname(idl_list_file_name), file_name)
126 builder.import_idl_file(idl_file_name, webkit_options) 126 builder.import_idl_file(idl_file_name, webkit_options)
127 idl_list_file.close() 127 idl_list_file.close()
128 128
129 webkit_supplemental_options = databasebuilder.DatabaseBuilderOptions(
130 idl_syntax=idlparser.FREMONTCUT_SYNTAX,
131 source='WebKit',
132 rename_operation_arguments_on_merge=True)
133 builder.import_idl_file(
134 os.path.join(current_dir, '..', 'idl', 'dart', 'webkit-supplemental.idl'),
135 webkit_supplemental_options)
136
137 # Import Dart idl: 129 # Import Dart idl:
138 dart_options = databasebuilder.DatabaseBuilderOptions( 130 dart_options = databasebuilder.DatabaseBuilderOptions(
139 idl_syntax=idlparser.FREMONTCUT_SYNTAX, 131 idl_syntax=idlparser.FREMONTCUT_SYNTAX,
140 source='Dart', 132 source='Dart',
141 rename_operation_arguments_on_merge=True) 133 rename_operation_arguments_on_merge=True)
142 134
143 builder.import_idl_file( 135 builder.import_idl_file(
144 os.path.join(current_dir, '..', 'idl', 'dart', 'dart.idl'), 136 os.path.join(current_dir, '..', 'idl', 'dart', 'dart.idl'),
145 dart_options) 137 dart_options)
146 138
147 builder.set_same_signatures({ 139 builder.set_same_signatures({
148 'EventListener': 'Function', 140 'EventListener': 'Function',
149 'int': 'long', 141 'int': 'long',
150 }) 142 })
151 143
152 # Merging: 144 # Merging:
153 builder.merge_imported_interfaces(optional_argument_whitelist) 145 builder.merge_imported_interfaces(optional_argument_whitelist)
154 146
155 builder.fix_displacements('WebKit') 147 builder.fix_displacements('WebKit')
156 148
157 # Cleanup: 149 # Cleanup:
158 builder.normalize_annotations(['WebKit', 'Dart']) 150 builder.normalize_annotations(['WebKit', 'Dart'])
159 151
160 db.Save() 152 db.Save()
161 153
162 def main(): 154 def main():
155 current_dir = os.path.dirname(__file__)
156
163 webkit_dirs = [ 157 webkit_dirs = [
164 'Modules/speech', 158 'Modules/speech',
165 'Modules/indexeddb', 159 'Modules/indexeddb',
166 'css', 160 'css',
167 'dom', 161 'dom',
168 'fileapi', 162 'fileapi',
169 'Modules/filesystem', 163 'Modules/filesystem',
170 'html', 164 'html',
171 'html/canvas', 165 'html/canvas',
172 'inspector', 166 'inspector',
173 'loader', 167 'loader',
174 'loader/appcache', 168 'loader/appcache',
175 'Modules/mediastream', 169 'Modules/mediastream',
176 'Modules/geolocation', 170 'Modules/geolocation',
177 'notifications', 171 'notifications',
178 'page', 172 'page',
179 'plugins', 173 'plugins',
180 'storage', 174 'storage',
181 'Modules/webdatabase', 175 'Modules/webdatabase',
182 'svg', 176 'svg',
183 'Modules/webaudio', 177 'Modules/webaudio',
184 'Modules/websockets', 178 'Modules/websockets',
185 'workers', 179 'workers',
186 'xml', 180 'xml',
187 ] 181 ]
188 182
189 (idl_list_file, idl_list_file_name) = tempfile.mkstemp() 183 (idl_list_file, idl_list_file_name) = tempfile.mkstemp()
190 184
191 webcore_dir = os.path.join(os.path.dirname(__file__), '..', '..', '..', 185 webcore_dir = os.path.join(current_dir, '..', '..', '..',
192 'third_party', 'WebCore') 186 'third_party', 'WebCore')
193 if not os.path.exists(webcore_dir): 187 if not os.path.exists(webcore_dir):
194 raise RuntimeError('directory not found: %s' % webcore_dir) 188 raise RuntimeError('directory not found: %s' % webcore_dir)
195 189
196 def visitor(arg, dir_name, names): 190 def visitor(arg, dir_name, names):
197 for name in names: 191 for name in names:
198 file_name = os.path.join(dir_name, name) 192 file_name = os.path.join(dir_name, name)
199 (interface, ext) = os.path.splitext(file_name) 193 (interface, ext) = os.path.splitext(file_name)
200 if ext == '.idl' and not name.startswith('._'): 194 if ext == '.idl' and not name.startswith('._'):
201 path = os.path.relpath(file_name, os.path.dirname(idl_list_file_name)) 195 path = os.path.relpath(file_name, os.path.dirname(idl_list_file_name))
202 os.write(idl_list_file, '%s\n' % path) 196 os.write(idl_list_file, '%s\n' % path)
203 197
204 for dir_name in webkit_dirs: 198 for dir_name in webkit_dirs:
205 dir_path = os.path.join(webcore_dir, dir_name) 199 dir_path = os.path.join(webcore_dir, dir_name)
206 os.path.walk(dir_path, visitor, None) 200 os.path.walk(dir_path, visitor, None)
207 201
208 os.close(idl_list_file) 202 os.close(idl_list_file)
209 203
210 return build_database(idl_list_file_name) 204 database_dir = os.path.join(current_dir, '..', 'database')
205 return build_database(idl_list_file_name, database_dir)
211 206
212 if __name__ == '__main__': 207 if __name__ == '__main__':
213 sys.exit(main()) 208 sys.exit(main())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698