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

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

Issue 10913125: Remove lib/dom directory! (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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
(Empty)
1 #!/usr/bin/python
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
4 # BSD-style license that can be found in the LICENSE file.
5
6 import database
7 import databasebuilder
8 import idlparser
9 import logging.config
10 import os.path
11 import sys
12
13 # TODO(antonm): most probably should go away or be autogenerated on IDLs roll.
14 DEFAULT_FEATURE_DEFINES = [
15 # Enabled Chrome WebKit build.
16 'ENABLE_3D_PLUGIN',
17 'ENABLE_3D_RENDERING',
18 'ENABLE_ACCELERATED_2D_CANVAS',
19 'ENABLE_BATTERY_STATUS',
20 'ENABLE_BLOB',
21 'ENABLE_BLOB_SLICE',
22 'ENABLE_CALENDAR_PICKER',
23 'ENABLE_CHANNEL_MESSAGING',
24 'ENABLE_CSS_FILTERS',
25 'ENABLE_CSS_IMAGE_SET',
26 'ENABLE_CSS_SHADERS',
27 'ENABLE_DART',
28 'ENABLE_DATA_TRANSFER_ITEMS',
29 'ENABLE_DATALIST_ELEMENT',
30 'ENABLE_DETAILS',
31 'ENABLE_DETAILS_ELEMENT',
32 'ENABLE_DEVICE_ORIENTATION',
33 'ENABLE_DIRECTORY_UPLOAD',
34 'ENABLE_DOWNLOAD_ATTRIBUTE',
35 'ENABLE_ENCRYPTED_MEDIA',
36 'ENABLE_FILE_SYSTEM',
37 'ENABLE_FILTERS',
38 'ENABLE_FULLSCREEN_API',
39 'ENABLE_GAMEPAD',
40 'ENABLE_GEOLOCATION',
41 'ENABLE_GESTURE_EVENTS',
42 'ENABLE_INDEXED_DATABASE',
43 'ENABLE_INPUT_SPEECH',
44 'ENABLE_INPUT_TYPE_COLOR',
45 'ENABLE_INPUT_TYPE_DATE',
46 'ENABLE_JAVASCRIPT_DEBUGGER',
47 'ENABLE_JAVASCRIPT_I18N_API',
48 'ENABLE_LEGACY_NOTIFICATIONS',
49 'ENABLE_LINK_PREFETCH',
50 'ENABLE_MEDIA_SOURCE',
51 'ENABLE_MEDIA_STATISTICS',
52 'ENABLE_MEDIA_STREAM',
53 'ENABLE_METER_ELEMENT',
54 'ENABLE_METER_TAG',
55 'ENABLE_MHTML',
56 'ENABLE_MUTATION_OBSERVERS',
57 'ENABLE_NOTIFICATIONS',
58 'ENABLE_OVERFLOW_SCROLLING',
59 'ENABLE_PAGE_POPUP',
60 'ENABLE_PAGE_VISIBILITY_API',
61 'ENABLE_POINTER_LOCK',
62 'ENABLE_PROGRESS_ELEMENT',
63 'ENABLE_PROGRESS_TAG',
64 'ENABLE_QUOTA',
65 'ENABLE_REGISTER_PROTOCOL_HANDLER',
66 'ENABLE_REQUEST_ANIMATION_FRAME',
67 'ENABLE_RUBY',
68 'ENABLE_SANDBOX',
69 'ENABLE_SCRIPTED_SPEECH',
70 'ENABLE_SHADOW_DOM',
71 'ENABLE_SHARED_WORKERS',
72 'ENABLE_SMOOTH_SCROLLING',
73 'ENABLE_SQL_DATABASE',
74 'ENABLE_STYLE_SCOPED',
75 'ENABLE_SVG',
76 'ENABLE_SVG_FONTS',
77 'ENABLE_TOUCH_EVENTS',
78 'ENABLE_V8_SCRIPT_DEBUG_SERVER',
79 'ENABLE_VIDEO',
80 'ENABLE_VIDEO_TRACK',
81 'ENABLE_VIEWPORT',
82 'ENABLE_WEBGL',
83 'ENABLE_WEB_AUDIO',
84 'ENABLE_WEB_INTENTS',
85 'ENABLE_WEB_SOCKETS',
86 'ENABLE_WEB_TIMING',
87 'ENABLE_WORKERS',
88 'ENABLE_XHR_RESPONSE_BLOB',
89 'ENABLE_XSLT',
90 ]
91
92 def build_database(idl_files, database_dir, feature_defines = None):
93 """This code reconstructs the FremontCut IDL database from W3C,
94 WebKit and Dart IDL files."""
95 current_dir = os.path.dirname(__file__)
96 logging.config.fileConfig(os.path.join(current_dir, "logging.conf"))
97
98 db = database.Database(database_dir)
99
100 # Delete all existing IDLs in the DB.
101 db.Delete()
102
103 builder = databasebuilder.DatabaseBuilder(db)
104
105 # TODO(vsm): Move this to a README.
106 # This is the Dart SVN revision.
107 webkit_revision = '1060'
108
109 # TODO(vsm): Reconcile what is exposed here and inside WebKit code
110 # generation. We need to recheck this periodically for now.
111 webkit_defines = [ 'LANGUAGE_DART', 'LANGUAGE_JAVASCRIPT' ]
112 if feature_defines is None:
113 feature_defines = DEFAULT_FEATURE_DEFINES
114
115 webkit_options = databasebuilder.DatabaseBuilderOptions(
116 idl_syntax=idlparser.WEBKIT_SYNTAX,
117 # TODO(vsm): What else should we define as on when processing IDL?
118 idl_defines=webkit_defines + feature_defines,
119 source='WebKit',
120 source_attributes={'revision': webkit_revision},
121 type_rename_map={
122 'BarInfo': 'BarProp',
123 'DedicatedWorkerContext': 'DedicatedWorkerGlobalScope',
124 'DOMApplicationCache': 'ApplicationCache',
125 'DOMCoreException': 'DOMException',
126 'DOMFormData': 'FormData',
127 'DOMSelection': 'Selection',
128 'DOMWindow': 'Window',
129 'SharedWorkerContext': 'SharedWorkerGlobalScope',
130 'WorkerContext': 'WorkerGlobalScope',
131 })
132
133 # Import WebKit IDLs.
134 for file_name in idl_files:
135 builder.import_idl_file(file_name, webkit_options)
136
137 # Import Dart idl:
138 dart_options = databasebuilder.DatabaseBuilderOptions(
139 idl_syntax=idlparser.FREMONTCUT_SYNTAX,
140 source='Dart',
141 rename_operation_arguments_on_merge=True)
142
143 builder.import_idl_file(
144 os.path.join(current_dir, '..', 'idl', 'dart', 'dart.idl'),
145 dart_options)
146
147 # Merging:
148 builder.merge_imported_interfaces()
149
150 builder.fetch_constructor_data(webkit_options)
151 builder.fix_displacements('WebKit')
152
153 # Cleanup:
154 builder.normalize_annotations(['WebKit', 'Dart'])
155
156 db.Save()
157
158 def main():
159 current_dir = os.path.dirname(__file__)
160
161 webkit_dirs = [
162 'css',
163 'dom',
164 'fileapi',
165 'html',
166 'html/canvas',
167 'inspector',
168 'loader',
169 'loader/appcache',
170 'Modules/battery',
171 'Modules/filesystem',
172 'Modules/gamepad',
173 'Modules/geolocation',
174 'Modules/indexeddb',
175 'Modules/mediasource',
176 'Modules/mediastream',
177 'Modules/notifications',
178 'Modules/quota',
179 'Modules/speech',
180 'Modules/webaudio',
181 'Modules/webdatabase',
182 'Modules/websockets',
183 'page',
184 'plugins',
185 'storage',
186 'svg',
187 'workers',
188 'xml',
189 ]
190
191 ignored_idls = [
192 'AbstractView.idl',
193 ]
194
195 idl_files = []
196
197 webcore_dir = os.path.join(current_dir, '..', '..', '..',
198 'third_party', 'WebCore')
199 if not os.path.exists(webcore_dir):
200 raise RuntimeError('directory not found: %s' % webcore_dir)
201
202 def visitor(arg, dir_name, names):
203 for name in names:
204 file_name = os.path.join(dir_name, name)
205 (interface, ext) = os.path.splitext(file_name)
206 if ext == '.idl' and name not in ignored_idls:
207 idl_files.append(file_name)
208
209 for dir_name in webkit_dirs:
210 dir_path = os.path.join(webcore_dir, dir_name)
211 os.path.walk(dir_path, visitor, None)
212
213 database_dir = os.path.join(current_dir, '..', 'database')
214 return build_database(idl_files, database_dir)
215
216 if __name__ == '__main__':
217 sys.exit(main())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698