| OLD | NEW |
| 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, database_dir): | 14 # TODO(antonm): most probably should go away or be autogenerated on IDLs roll. |
| 15 DEFAULT_FEATURE_DEFINES = [ |
| 16 # Enabled Chrome WebKit build. |
| 17 'ENABLE_3D_PLUGIN', |
| 18 'ENABLE_3D_RENDERING', |
| 19 'ENABLE_ACCELERATED_2D_CANVAS', |
| 20 'ENABLE_BATTERY_STATUS', |
| 21 'ENABLE_BLOB', |
| 22 'ENABLE_BLOB_SLICE', |
| 23 'ENABLE_CALENDAR_PICKER', |
| 24 'ENABLE_CHANNEL_MESSAGING', |
| 25 'ENABLE_CSS_FILTERS', |
| 26 'ENABLE_CSS_SHADERS', |
| 27 'ENABLE_DATA_TRANSFER_ITEMS', |
| 28 'ENABLE_DETAILS', |
| 29 'ENABLE_DEVICE_ORIENTATION', |
| 30 'ENABLE_DIRECTORY_UPLOAD', |
| 31 'ENABLE_DOWNLOAD_ATTRIBUTE', |
| 32 'ENABLE_FILE_SYSTEM', |
| 33 'ENABLE_FILTERS', |
| 34 'ENABLE_FULLSCREEN_API', |
| 35 'ENABLE_GAMEPAD', |
| 36 'ENABLE_GEOLOCATION', |
| 37 'ENABLE_GESTURE_EVENTS', |
| 38 'ENABLE_INDEXED_DATABASE', |
| 39 'ENABLE_INPUT_SPEECH', |
| 40 'ENABLE_INPUT_TYPE_COLOR', |
| 41 'ENABLE_JAVASCRIPT_DEBUGGER', |
| 42 'ENABLE_JAVASCRIPT_I18N_API', |
| 43 'ENABLE_LEGACY_NOTIFICATIONS', |
| 44 'ENABLE_LINK_PREFETCH', |
| 45 'ENABLE_MEDIA_SOURCE', |
| 46 'ENABLE_MEDIA_STATISTICS', |
| 47 'ENABLE_MEDIA_STREAM', |
| 48 'ENABLE_METER_TAG', |
| 49 'ENABLE_MHTML', |
| 50 'ENABLE_MUTATION_OBSERVERS', |
| 51 'ENABLE_NOTIFICATIONS', |
| 52 'ENABLE_OVERFLOW_SCROLLING', |
| 53 'ENABLE_PAGE_POPUP', |
| 54 'ENABLE_PAGE_VISIBILITY_API', |
| 55 'ENABLE_POINTER_LOCK', |
| 56 'ENABLE_PROGRESS_TAG', |
| 57 'ENABLE_QUOTA', |
| 58 'ENABLE_REGISTER_PROTOCOL_HANDLER', |
| 59 'ENABLE_REQUEST_ANIMATION_FRAME', |
| 60 'ENABLE_RUBY', |
| 61 'ENABLE_SANDBOX', |
| 62 'ENABLE_SCRIPTED_SPEECH', |
| 63 'ENABLE_SHADOW_DOM', |
| 64 'ENABLE_SHARED_WORKERS', |
| 65 'ENABLE_SMOOTH_SCROLLING', |
| 66 'ENABLE_SQL_DATABASE', |
| 67 'ENABLE_STYLE_SCOPED', |
| 68 'ENABLE_SVG', |
| 69 'ENABLE_SVG_FONTS', |
| 70 'ENABLE_TOUCH_EVENTS', |
| 71 'ENABLE_V8_SCRIPT_DEBUG_SERVER', |
| 72 'ENABLE_VIDEO', |
| 73 'ENABLE_VIDEO_TRACK', |
| 74 'ENABLE_WEBGL', |
| 75 'ENABLE_WEB_AUDIO', |
| 76 'ENABLE_WEB_INTENTS', |
| 77 'ENABLE_WEB_SOCKETS', |
| 78 'ENABLE_WEB_TIMING', |
| 79 'ENABLE_WORKERS', |
| 80 'ENABLE_XHR_RESPONSE_BLOB', |
| 81 'ENABLE_XSLT', |
| 82 ] |
| 83 |
| 84 # TODO(antonm): Remove this filter. |
| 85 UNSUPPORTED_FEATURES = [ 'ENABLE_WEB_INTENTS' ] |
| 86 |
| 87 def build_database(idl_list_file_name, database_dir, feature_defines = None): |
| 15 """This code reconstructs the FremontCut IDL database from W3C, | 88 """This code reconstructs the FremontCut IDL database from W3C, |
| 16 WebKit and Dart IDL files.""" | 89 WebKit and Dart IDL files.""" |
| 17 current_dir = os.path.dirname(__file__) | 90 current_dir = os.path.dirname(__file__) |
| 18 logging.config.fileConfig(os.path.join(current_dir, "logging.conf")) | 91 logging.config.fileConfig(os.path.join(current_dir, "logging.conf")) |
| 19 | 92 |
| 20 db = database.Database(database_dir) | 93 db = database.Database(database_dir) |
| 21 | 94 |
| 22 # Delete all existing IDLs in the DB. | 95 # Delete all existing IDLs in the DB. |
| 23 db.Delete() | 96 db.Delete() |
| 24 | 97 |
| 25 builder = databasebuilder.DatabaseBuilder(db) | 98 builder = databasebuilder.DatabaseBuilder(db) |
| 26 | 99 |
| 27 # TODO(vsm): Move this to a README. | 100 # TODO(vsm): Move this to a README. |
| 28 # This is the Dart SVN revision. | 101 # This is the Dart SVN revision. |
| 29 webkit_revision = '1060' | 102 webkit_revision = '1060' |
| 30 | 103 |
| 31 # TODO(vsm): Reconcile what is exposed here and inside WebKit code | 104 # TODO(vsm): Reconcile what is exposed here and inside WebKit code |
| 32 # generation. We need to recheck this periodically for now. | 105 # generation. We need to recheck this periodically for now. |
| 33 webkit_defines = [ | 106 webkit_defines = [ 'LANGUAGE_DART', 'LANGUAGE_JAVASCRIPT' ] |
| 34 'LANGUAGE_DART', | 107 if feature_defines is None: |
| 35 'LANGUAGE_JAVASCRIPT', | 108 feature_defines = DEFAULT_FEATURE_DEFINES |
| 36 | 109 |
| 37 # Enabled Chrome WebKit build. | |
| 38 'ENABLE_3D_PLUGIN', | |
| 39 'ENABLE_3D_RENDERING', | |
| 40 'ENABLE_ACCELERATED_2D_CANVAS', | |
| 41 'ENABLE_BATTERY_STATUS', | |
| 42 'ENABLE_BLOB', | |
| 43 'ENABLE_BLOB_SLICE', | |
| 44 'ENABLE_CHANNEL_MESSAGING', | |
| 45 'ENABLE_CLIENT_BASED_GEOLOCATION', | |
| 46 'ENABLE_DATA_TRANSFER_ITEMS', | |
| 47 'ENABLE_DETAILS', | |
| 48 'ENABLE_DEVICE_ORIENTATION', | |
| 49 'ENABLE_DIRECTORY_UPLOAD', | |
| 50 'ENABLE_DOWNLOAD_ATTRIBUTE', | |
| 51 'ENABLE_FILE_SYSTEM', | |
| 52 'ENABLE_FILTERS', | |
| 53 'ENABLE_FULLSCREEN_API', | |
| 54 'ENABLE_GAMEPAD', | |
| 55 'ENABLE_GEOLOCATION', | |
| 56 'ENABLE_GESTURE_EVENTS', | |
| 57 'ENABLE_GESTURE_RECOGNIZER', | |
| 58 'ENABLE_INDEXED_DATABASE', | |
| 59 'ENABLE_INPUT_SPEECH', | |
| 60 'ENABLE_JAVASCRIPT_DEBUGGER', | |
| 61 'ENABLE_JAVASCRIPT_I18N_API', | |
| 62 'ENABLE_LINK_PREFETCH', | |
| 63 'ENABLE_MEDIA_SOURCE', | |
| 64 'ENABLE_MEDIA_STATISTICS', | |
| 65 'ENABLE_MEDIA_STREAM', | |
| 66 'ENABLE_METER_TAG', | |
| 67 'ENABLE_MHTML', | |
| 68 'ENABLE_MOUSE_LOCK_API', | |
| 69 'ENABLE_MUTATION_OBSERVERS', | |
| 70 'ENABLE_NOTIFICATIONS', | |
| 71 'ENABLE_PAGE_VISIBILITY_API', | |
| 72 'ENABLE_PROGRESS_TAG', | |
| 73 'ENABLE_QUOTA', | |
| 74 'ENABLE_REGISTER_PROTOCOL_HANDLER', | |
| 75 'ENABLE_REQUEST_ANIMATION_FRAME', | |
| 76 'ENABLE_RUBY', | |
| 77 'ENABLE_SANDBOX', | |
| 78 'ENABLE_SCRIPTED_SPEECH', | |
| 79 'ENABLE_SHADOW_DOM', | |
| 80 'ENABLE_SHARED_WORKERS', | |
| 81 'ENABLE_SMOOTH_SCROLLING', | |
| 82 'ENABLE_SPEECH_RECOGNITION', | |
| 83 'ENABLE_SQL_DATABASE', | |
| 84 'ENABLE_SVG', | |
| 85 'ENABLE_SVG_FONTS', | |
| 86 'ENABLE_TOUCH_EVENTS', | |
| 87 'ENABLE_V8_SCRIPT_DEBUG_SERVER', | |
| 88 'ENABLE_VIDEO', | |
| 89 'ENABLE_VIDEO_TRACK', | |
| 90 'ENABLE_WEBGL', | |
| 91 'ENABLE_WEB_AUDIO', | |
| 92 'ENABLE_WEB_SOCKETS', | |
| 93 'ENABLE_WEB_TIMING', | |
| 94 'ENABLE_WORKERS', | |
| 95 'ENABLE_XHR_RESPONSE_BLOB', | |
| 96 'ENABLE_XSLT', | |
| 97 ] | |
| 98 webkit_options = databasebuilder.DatabaseBuilderOptions( | 110 webkit_options = databasebuilder.DatabaseBuilderOptions( |
| 99 idl_syntax=idlparser.WEBKIT_SYNTAX, | 111 idl_syntax=idlparser.WEBKIT_SYNTAX, |
| 100 # TODO(vsm): What else should we define as on when processing IDL? | 112 # TODO(vsm): What else should we define as on when processing IDL? |
| 101 idl_defines=webkit_defines, | 113 idl_defines=[define for define in webkit_defines + feature_defines if defi
ne not in UNSUPPORTED_FEATURES], |
| 102 source='WebKit', | 114 source='WebKit', |
| 103 source_attributes={'revision': webkit_revision}, | 115 source_attributes={'revision': webkit_revision}, |
| 104 type_rename_map={ | 116 type_rename_map={ |
| 105 'BarInfo': 'BarProp', | 117 'BarInfo': 'BarProp', |
| 106 'DedicatedWorkerContext': 'DedicatedWorkerGlobalScope', | 118 'DedicatedWorkerContext': 'DedicatedWorkerGlobalScope', |
| 107 'DOMApplicationCache': 'ApplicationCache', | 119 'DOMApplicationCache': 'ApplicationCache', |
| 108 'DOMCoreException': 'DOMException', | 120 'DOMCoreException': 'DOMException', |
| 109 'DOMFormData': 'FormData', | 121 'DOMFormData': 'FormData', |
| 110 'DOMSelection': 'Selection', | 122 'DOMSelection': 'Selection', |
| 111 'DOMWindow': 'Window', | 123 'DOMWindow': 'Window', |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 dir_path = os.path.join(webcore_dir, dir_name) | 219 dir_path = os.path.join(webcore_dir, dir_name) |
| 208 os.path.walk(dir_path, visitor, None) | 220 os.path.walk(dir_path, visitor, None) |
| 209 | 221 |
| 210 os.close(idl_list_file) | 222 os.close(idl_list_file) |
| 211 | 223 |
| 212 database_dir = os.path.join(current_dir, '..', 'database') | 224 database_dir = os.path.join(current_dir, '..', 'database') |
| 213 return build_database(idl_list_file_name, database_dir) | 225 return build_database(idl_list_file_name, database_dir) |
| 214 | 226 |
| 215 if __name__ == '__main__': | 227 if __name__ == '__main__': |
| 216 sys.exit(main()) | 228 sys.exit(main()) |
| OLD | NEW |