| 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 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 'ENABLE_WEBGL', | 82 'ENABLE_WEBGL', |
| 83 'ENABLE_WEB_AUDIO', | 83 'ENABLE_WEB_AUDIO', |
| 84 'ENABLE_WEB_INTENTS', | 84 'ENABLE_WEB_INTENTS', |
| 85 'ENABLE_WEB_SOCKETS', | 85 'ENABLE_WEB_SOCKETS', |
| 86 'ENABLE_WEB_TIMING', | 86 'ENABLE_WEB_TIMING', |
| 87 'ENABLE_WORKERS', | 87 'ENABLE_WORKERS', |
| 88 'ENABLE_XHR_RESPONSE_BLOB', | 88 'ENABLE_XHR_RESPONSE_BLOB', |
| 89 'ENABLE_XSLT', | 89 'ENABLE_XSLT', |
| 90 ] | 90 ] |
| 91 | 91 |
| 92 def build_database(idl_files, database_dir, feature_defines = None): | 92 def build_database(idl_files, database_dir, feature_defines=None, |
| 93 parallel=False): |
| 93 """This code reconstructs the FremontCut IDL database from W3C, | 94 """This code reconstructs the FremontCut IDL database from W3C, |
| 94 WebKit and Dart IDL files.""" | 95 WebKit and Dart IDL files.""" |
| 95 current_dir = os.path.dirname(__file__) | 96 current_dir = os.path.dirname(__file__) |
| 96 logging.config.fileConfig(os.path.join(current_dir, "logging.conf")) | 97 logging.config.fileConfig(os.path.join(current_dir, "logging.conf")) |
| 97 | 98 |
| 98 db = database.Database(database_dir) | 99 db = database.Database(database_dir) |
| 99 | 100 |
| 100 # Delete all existing IDLs in the DB. | 101 # Delete all existing IDLs in the DB. |
| 101 db.Delete() | 102 db.Delete() |
| 102 | 103 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 113 feature_defines = DEFAULT_FEATURE_DEFINES | 114 feature_defines = DEFAULT_FEATURE_DEFINES |
| 114 | 115 |
| 115 webkit_options = databasebuilder.DatabaseBuilderOptions( | 116 webkit_options = databasebuilder.DatabaseBuilderOptions( |
| 116 idl_syntax=idlparser.WEBKIT_SYNTAX, | 117 idl_syntax=idlparser.WEBKIT_SYNTAX, |
| 117 # TODO(vsm): What else should we define as on when processing IDL? | 118 # TODO(vsm): What else should we define as on when processing IDL? |
| 118 idl_defines=webkit_defines + feature_defines, | 119 idl_defines=webkit_defines + feature_defines, |
| 119 source='WebKit', | 120 source='WebKit', |
| 120 source_attributes={'revision': webkit_revision}) | 121 source_attributes={'revision': webkit_revision}) |
| 121 | 122 |
| 122 # Import WebKit IDLs. | 123 # Import WebKit IDLs. |
| 123 builder.import_idl_files(idl_files, webkit_options) | 124 builder.import_idl_files(idl_files, webkit_options, parallel) |
| 124 | 125 |
| 125 # Import Dart idl: | 126 # Import Dart idl: |
| 126 dart_options = databasebuilder.DatabaseBuilderOptions( | 127 dart_options = databasebuilder.DatabaseBuilderOptions( |
| 127 idl_syntax=idlparser.FREMONTCUT_SYNTAX, | 128 idl_syntax=idlparser.FREMONTCUT_SYNTAX, |
| 128 source='Dart', | 129 source='Dart', |
| 129 rename_operation_arguments_on_merge=True) | 130 rename_operation_arguments_on_merge=True) |
| 130 | 131 |
| 131 builder.import_idl_files( | 132 builder.import_idl_files( |
| 132 [ os.path.join(current_dir, '..', 'idl', 'dart', 'dart.idl') ], | 133 [ os.path.join(current_dir, '..', 'idl', 'dart', 'dart.idl') ], |
| 133 dart_options) | 134 dart_options, |
| 135 parallel) |
| 134 | 136 |
| 135 # Merging: | 137 # Merging: |
| 136 builder.merge_imported_interfaces() | 138 builder.merge_imported_interfaces() |
| 137 | 139 |
| 138 builder.fetch_constructor_data(webkit_options) | 140 builder.fetch_constructor_data(webkit_options) |
| 139 builder.fix_displacements('WebKit') | 141 builder.fix_displacements('WebKit') |
| 140 | 142 |
| 141 # Cleanup: | 143 # Cleanup: |
| 142 builder.normalize_annotations(['WebKit', 'Dart']) | 144 builder.normalize_annotations(['WebKit', 'Dart']) |
| 143 | 145 |
| 144 db.Save() | 146 db.Save() |
| 145 return db | 147 return db |
| 146 | 148 |
| 147 def main(): | 149 def main(parallel=False): |
| 148 current_dir = os.path.dirname(__file__) | 150 current_dir = os.path.dirname(__file__) |
| 149 | 151 |
| 150 webkit_dirs = [ | 152 webkit_dirs = [ |
| 151 'css', | 153 'css', |
| 152 'dom', | 154 'dom', |
| 153 'fileapi', | 155 'fileapi', |
| 154 'html', | 156 'html', |
| 155 'html/canvas', | 157 'html/canvas', |
| 156 'inspector', | 158 'inspector', |
| 157 'loader', | 159 'loader', |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 file_name = os.path.join(dir_name, name) | 195 file_name = os.path.join(dir_name, name) |
| 194 (interface, ext) = os.path.splitext(file_name) | 196 (interface, ext) = os.path.splitext(file_name) |
| 195 if ext == '.idl' and name not in ignored_idls: | 197 if ext == '.idl' and name not in ignored_idls: |
| 196 idl_files.append(file_name) | 198 idl_files.append(file_name) |
| 197 | 199 |
| 198 for dir_name in webkit_dirs: | 200 for dir_name in webkit_dirs: |
| 199 dir_path = os.path.join(webcore_dir, dir_name) | 201 dir_path = os.path.join(webcore_dir, dir_name) |
| 200 os.path.walk(dir_path, visitor, None) | 202 os.path.walk(dir_path, visitor, None) |
| 201 | 203 |
| 202 database_dir = os.path.join(current_dir, '..', 'database') | 204 database_dir = os.path.join(current_dir, '..', 'database') |
| 203 return build_database(idl_files, database_dir) | 205 return build_database(idl_files, database_dir, parallel=parallel) |
| 204 | 206 |
| 205 if __name__ == '__main__': | 207 if __name__ == '__main__': |
| 206 sys.exit(main()) | 208 sys.exit(main()) |
| OLD | NEW |