| OLD | NEW |
| (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 parallel=False): | |
| 94 """This code reconstructs the FremontCut IDL database from W3C, | |
| 95 WebKit and Dart IDL files.""" | |
| 96 current_dir = os.path.dirname(__file__) | |
| 97 logging.config.fileConfig(os.path.join(current_dir, "logging.conf")) | |
| 98 | |
| 99 db = database.Database(database_dir) | |
| 100 | |
| 101 # Delete all existing IDLs in the DB. | |
| 102 db.Delete() | |
| 103 | |
| 104 builder = databasebuilder.DatabaseBuilder(db) | |
| 105 | |
| 106 # TODO(vsm): Move this to a README. | |
| 107 # This is the Dart SVN revision. | |
| 108 webkit_revision = '1060' | |
| 109 | |
| 110 # TODO(vsm): Reconcile what is exposed here and inside WebKit code | |
| 111 # generation. We need to recheck this periodically for now. | |
| 112 webkit_defines = [ 'LANGUAGE_DART', 'LANGUAGE_JAVASCRIPT' ] | |
| 113 if feature_defines is None: | |
| 114 feature_defines = DEFAULT_FEATURE_DEFINES | |
| 115 | |
| 116 webkit_options = databasebuilder.DatabaseBuilderOptions( | |
| 117 idl_syntax=idlparser.WEBKIT_SYNTAX, | |
| 118 # TODO(vsm): What else should we define as on when processing IDL? | |
| 119 idl_defines=webkit_defines + feature_defines, | |
| 120 source='WebKit', | |
| 121 source_attributes={'revision': webkit_revision}) | |
| 122 | |
| 123 # Import WebKit IDLs. | |
| 124 builder.import_idl_files(idl_files, webkit_options, parallel) | |
| 125 | |
| 126 # Import Dart idl: | |
| 127 dart_options = databasebuilder.DatabaseBuilderOptions( | |
| 128 idl_syntax=idlparser.FREMONTCUT_SYNTAX, | |
| 129 source='Dart', | |
| 130 rename_operation_arguments_on_merge=True) | |
| 131 | |
| 132 builder.import_idl_files( | |
| 133 [ os.path.join(current_dir, '..', 'idl', 'dart', 'dart.idl') ], | |
| 134 dart_options, | |
| 135 parallel) | |
| 136 | |
| 137 # Merging: | |
| 138 builder.merge_imported_interfaces() | |
| 139 | |
| 140 builder.fetch_constructor_data(webkit_options) | |
| 141 builder.fix_displacements('WebKit') | |
| 142 | |
| 143 # Cleanup: | |
| 144 builder.normalize_annotations(['WebKit', 'Dart']) | |
| 145 | |
| 146 db.Save() | |
| 147 return db | |
| 148 | |
| 149 def main(parallel=False): | |
| 150 current_dir = os.path.dirname(__file__) | |
| 151 | |
| 152 webkit_dirs = [ | |
| 153 'css', | |
| 154 'dom', | |
| 155 'fileapi', | |
| 156 'html', | |
| 157 'html/canvas', | |
| 158 'inspector', | |
| 159 'loader', | |
| 160 'loader/appcache', | |
| 161 'Modules/battery', | |
| 162 'Modules/filesystem', | |
| 163 'Modules/gamepad', | |
| 164 'Modules/geolocation', | |
| 165 'Modules/indexeddb', | |
| 166 'Modules/mediasource', | |
| 167 'Modules/mediastream', | |
| 168 'Modules/notifications', | |
| 169 'Modules/quota', | |
| 170 'Modules/speech', | |
| 171 'Modules/webaudio', | |
| 172 'Modules/webdatabase', | |
| 173 'Modules/websockets', | |
| 174 'page', | |
| 175 'plugins', | |
| 176 'storage', | |
| 177 'svg', | |
| 178 'workers', | |
| 179 'xml', | |
| 180 ] | |
| 181 | |
| 182 ignored_idls = [ | |
| 183 'AbstractView.idl', | |
| 184 ] | |
| 185 | |
| 186 idl_files = [] | |
| 187 | |
| 188 webcore_dir = os.path.join(current_dir, '..', '..', '..', '..', | |
| 189 'third_party', 'WebCore') | |
| 190 if not os.path.exists(webcore_dir): | |
| 191 raise RuntimeError('directory not found: %s' % webcore_dir) | |
| 192 | |
| 193 def visitor(arg, dir_name, names): | |
| 194 for name in names: | |
| 195 file_name = os.path.join(dir_name, name) | |
| 196 (interface, ext) = os.path.splitext(file_name) | |
| 197 if ext == '.idl' and name not in ignored_idls: | |
| 198 idl_files.append(file_name) | |
| 199 | |
| 200 for dir_name in webkit_dirs: | |
| 201 dir_path = os.path.join(webcore_dir, dir_name) | |
| 202 os.path.walk(dir_path, visitor, None) | |
| 203 | |
| 204 database_dir = os.path.join(current_dir, '..', 'database') | |
| 205 return build_database(idl_files, database_dir, parallel=parallel) | |
| 206 | |
| 207 if __name__ == '__main__': | |
| 208 sys.exit(main()) | |
| OLD | NEW |