Chromium Code Reviews| 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 | |
| 12 import sys | 11 import sys |
| 13 | 12 |
| 14 # TODO(antonm): most probably should go away or be autogenerated on IDLs roll. | 13 # TODO(antonm): most probably should go away or be autogenerated on IDLs roll. |
| 15 DEFAULT_FEATURE_DEFINES = [ | 14 DEFAULT_FEATURE_DEFINES = [ |
| 16 # Enabled Chrome WebKit build. | 15 # Enabled Chrome WebKit build. |
| 17 'ENABLE_3D_PLUGIN', | 16 'ENABLE_3D_PLUGIN', |
| 18 'ENABLE_3D_RENDERING', | 17 'ENABLE_3D_RENDERING', |
| 19 'ENABLE_ACCELERATED_2D_CANVAS', | 18 'ENABLE_ACCELERATED_2D_CANVAS', |
| 20 'ENABLE_BATTERY_STATUS', | 19 'ENABLE_BATTERY_STATUS', |
| 21 'ENABLE_BLOB', | 20 'ENABLE_BLOB', |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 77 'ENABLE_WEB_SOCKETS', | 76 'ENABLE_WEB_SOCKETS', |
| 78 'ENABLE_WEB_TIMING', | 77 'ENABLE_WEB_TIMING', |
| 79 'ENABLE_WORKERS', | 78 'ENABLE_WORKERS', |
| 80 'ENABLE_XHR_RESPONSE_BLOB', | 79 'ENABLE_XHR_RESPONSE_BLOB', |
| 81 'ENABLE_XSLT', | 80 'ENABLE_XSLT', |
| 82 ] | 81 ] |
| 83 | 82 |
| 84 # TODO(antonm): Remove this filter. | 83 # TODO(antonm): Remove this filter. |
| 85 UNSUPPORTED_FEATURES = [ 'ENABLE_WEB_INTENTS' ] | 84 UNSUPPORTED_FEATURES = [ 'ENABLE_WEB_INTENTS' ] |
| 86 | 85 |
| 87 def build_database(idl_list_file_name, database_dir, feature_defines = None): | 86 def build_database(idl_files, database_dir, feature_defines = None): |
| 88 """This code reconstructs the FremontCut IDL database from W3C, | 87 """This code reconstructs the FremontCut IDL database from W3C, |
| 89 WebKit and Dart IDL files.""" | 88 WebKit and Dart IDL files.""" |
| 90 current_dir = os.path.dirname(__file__) | 89 current_dir = os.path.dirname(__file__) |
| 91 logging.config.fileConfig(os.path.join(current_dir, "logging.conf")) | 90 logging.config.fileConfig(os.path.join(current_dir, "logging.conf")) |
| 92 | 91 |
| 93 db = database.Database(database_dir) | 92 db = database.Database(database_dir) |
| 94 | 93 |
| 95 # Delete all existing IDLs in the DB. | 94 # Delete all existing IDLs in the DB. |
| 96 db.Delete() | 95 db.Delete() |
| 97 | 96 |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 124 'SharedWorkerContext': 'SharedWorkerGlobalScope', | 123 'SharedWorkerContext': 'SharedWorkerGlobalScope', |
| 125 'WorkerContext': 'WorkerGlobalScope', | 124 'WorkerContext': 'WorkerGlobalScope', |
| 126 }) | 125 }) |
| 127 | 126 |
| 128 optional_argument_whitelist = [ | 127 optional_argument_whitelist = [ |
| 129 ('CSSStyleDeclaration', 'setProperty', 'priority'), | 128 ('CSSStyleDeclaration', 'setProperty', 'priority'), |
| 130 ('IDBDatabase', 'transaction', 'mode'), | 129 ('IDBDatabase', 'transaction', 'mode'), |
| 131 ] | 130 ] |
| 132 | 131 |
| 133 # Import WebKit IDLs. | 132 # Import WebKit IDLs. |
| 134 idl_list_file = open(idl_list_file_name, 'r') | 133 if isinstance(idl_files, list): |
| 135 for file_name in idl_list_file: | 134 for file_name in idl_files: |
| 136 file_name = file_name.strip() | 135 builder.import_idl_file(idl_file_name, webkit_options) |
| 137 idl_file_name = os.path.join(os.path.dirname(idl_list_file_name), file_name) | 136 else: |
| 138 builder.import_idl_file(idl_file_name, webkit_options) | 137 idl_list_file = open(idl_files, 'r') |
|
podivilov
2012/04/16 09:24:58
Is it needed for two-side patching only?
Anton Muhin
2012/04/16 09:39:38
Sorry? I just do not want to make breaking change
| |
| 139 idl_list_file.close() | 138 for file_name in idl_list_file: |
| 139 file_name = file_name.strip() | |
| 140 idl_file_name = os.path.join(os.path.dirname(idl_files), file_name) | |
| 141 builder.import_idl_file(idl_file_name, webkit_options) | |
| 142 idl_list_file.close() | |
| 140 | 143 |
| 141 # Import Dart idl: | 144 # Import Dart idl: |
| 142 dart_options = databasebuilder.DatabaseBuilderOptions( | 145 dart_options = databasebuilder.DatabaseBuilderOptions( |
| 143 idl_syntax=idlparser.FREMONTCUT_SYNTAX, | 146 idl_syntax=idlparser.FREMONTCUT_SYNTAX, |
| 144 source='Dart', | 147 source='Dart', |
| 145 rename_operation_arguments_on_merge=True) | 148 rename_operation_arguments_on_merge=True) |
| 146 | 149 |
| 147 builder.import_idl_file( | 150 builder.import_idl_file( |
| 148 os.path.join(current_dir, '..', 'idl', 'dart', 'dart.idl'), | 151 os.path.join(current_dir, '..', 'idl', 'dart', 'dart.idl'), |
| 149 dart_options) | 152 dart_options) |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 185 'plugins', | 188 'plugins', |
| 186 'storage', | 189 'storage', |
| 187 'Modules/webdatabase', | 190 'Modules/webdatabase', |
| 188 'svg', | 191 'svg', |
| 189 'Modules/webaudio', | 192 'Modules/webaudio', |
| 190 'Modules/websockets', | 193 'Modules/websockets', |
| 191 'workers', | 194 'workers', |
| 192 'xml', | 195 'xml', |
| 193 ] | 196 ] |
| 194 | 197 |
| 195 (idl_list_file, idl_list_file_name) = tempfile.mkstemp() | 198 idl_files = [] |
| 196 | 199 |
| 197 webcore_dir = os.path.join(current_dir, '..', '..', '..', | 200 webcore_dir = os.path.join(current_dir, '..', '..', '..', |
| 198 'third_party', 'WebCore') | 201 'third_party', 'WebCore') |
| 199 if not os.path.exists(webcore_dir): | 202 if not os.path.exists(webcore_dir): |
| 200 raise RuntimeError('directory not found: %s' % webcore_dir) | 203 raise RuntimeError('directory not found: %s' % webcore_dir) |
| 201 | 204 |
| 202 def visitor(arg, dir_name, names): | 205 def visitor(arg, dir_name, names): |
| 203 for name in names: | 206 for name in names: |
| 204 file_name = os.path.join(dir_name, name) | 207 file_name = os.path.join(dir_name, name) |
| 205 (interface, ext) = os.path.splitext(file_name) | 208 (interface, ext) = os.path.splitext(file_name) |
| 206 if ext == '.idl' and not name.startswith('._'): | 209 if ext == '.idl' and not name.startswith('._'): |
| 207 path = os.path.relpath(file_name, os.path.dirname(idl_list_file_name)) | 210 idl_files.add(file_name) |
| 208 os.write(idl_list_file, '%s\n' % path) | |
| 209 | 211 |
| 210 for dir_name in webkit_dirs: | 212 for dir_name in webkit_dirs: |
| 211 dir_path = os.path.join(webcore_dir, dir_name) | 213 dir_path = os.path.join(webcore_dir, dir_name) |
| 212 os.path.walk(dir_path, visitor, None) | 214 os.path.walk(dir_path, visitor, None) |
| 213 | 215 |
| 214 os.close(idl_list_file) | |
| 215 | |
| 216 database_dir = os.path.join(current_dir, '..', 'database') | 216 database_dir = os.path.join(current_dir, '..', 'database') |
| 217 return build_database(idl_list_file_name, database_dir) | 217 return build_database(idl_files, database_dir) |
| 218 | 218 |
| 219 if __name__ == '__main__': | 219 if __name__ == '__main__': |
| 220 sys.exit(main()) | 220 sys.exit(main()) |
| OLD | NEW |