| 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 sys | 11 import sys |
| 12 | 12 |
| 13 _logger = logging.getLogger('fremontcutbuilder') | 13 _logger = logging.getLogger('fremontcutbuilder') |
| 14 | 14 |
| 15 # See: |
| 16 # http://src.chromium.org/viewvc/multivm/trunk/webkit/Source/core/features.gypi |
| 17 # for ENABLE_* flags defined in Chromium / Blink. |
| 18 # We list all ENABLE flags used in IDL in one of these two lists. |
| 15 FEATURE_DISABLED = [ | 19 FEATURE_DISABLED = [ |
| 16 'ENABLE_BATTERY_STATUS', | 20 'ENABLE_BATTERY_STATUS', |
| 17 'ENABLE_CSS3_CONDITIONAL_RULES', | |
| 18 'ENABLE_CSS_DEVICE_ADAPTATION', | 21 'ENABLE_CSS_DEVICE_ADAPTATION', |
| 19 'ENABLE_CUSTOM_SCHEME_HANDLER', | 22 'ENABLE_CUSTOM_SCHEME_HANDLER', |
| 20 'ENABLE_ENCRYPTED_MEDIA_V2', | 23 'ENABLE_ENCRYPTED_MEDIA_V2', |
| 21 'ENABLE_MEDIA_CAPTURE', # Only enabled on Android. | 24 'ENABLE_MEDIA_CAPTURE', # Only enabled on Android. |
| 22 'ENABLE_ORIENTATION_EVENTS', # Only enabled on Android. | 25 'ENABLE_ORIENTATION_EVENTS', # Only enabled on Android. |
| 23 'ENABLE_SPEECH_SYNTHESIS', | |
| 24 'ENABLE_WEBVTT_REGIONS', | 26 'ENABLE_WEBVTT_REGIONS', |
| 25 'ENABLE_XHR_TIMEOUT', | 27 'ENABLE_XHR_TIMEOUT', |
| 26 ] | 28 ] |
| 27 | 29 |
| 28 FEATURE_DEFINES = [ | 30 FEATURE_DEFINES = [ |
| 29 'ENABLE_CALENDAR_PICKER', | 31 'ENABLE_CALENDAR_PICKER', # Not on Android |
| 30 'ENABLE_CANVAS_PROXY', | |
| 31 'ENABLE_CSS_REGIONS', | 32 'ENABLE_CSS_REGIONS', |
| 32 'ENABLE_CUSTOM_ELEMENTS', | 33 'ENABLE_DATALIST_ELEMENT', # Not on Android |
| 33 'ENABLE_DATALIST_ELEMENT', | |
| 34 'ENABLE_DIALOG_ELEMENT', | |
| 35 'ENABLE_ENCRYPTED_MEDIA', | 34 'ENABLE_ENCRYPTED_MEDIA', |
| 36 'ENABLE_FONT_LOAD_EVENTS', | 35 'ENABLE_INPUT_SPEECH', # Not on Android |
| 37 'ENABLE_GAMEPAD', | 36 'ENABLE_LEGACY_NOTIFICATIONS', # Not on Android |
| 38 'ENABLE_INPUT_SPEECH', | |
| 39 'ENABLE_LEGACY_NOTIFICATIONS', | |
| 40 'ENABLE_MEDIA_STREAM', | 37 'ENABLE_MEDIA_STREAM', |
| 41 'ENABLE_NAVIGATOR_CONTENT_UTILS', | 38 'ENABLE_NAVIGATOR_CONTENT_UTILS', # Not on Android |
| 42 'ENABLE_NOTIFICATIONS', | 39 'ENABLE_NOTIFICATIONS', # Not on Android |
| 43 'ENABLE_PAGE_POPUP', | 40 'ENABLE_PAGE_POPUP', # Not on Android |
| 44 'ENABLE_SHARED_WORKERS', | |
| 45 'ENABLE_SVG', | 41 'ENABLE_SVG', |
| 46 'ENABLE_SVG_FONTS', | 42 'ENABLE_SVG_FONTS', |
| 47 'ENABLE_VIDEO', | 43 'ENABLE_WEB_AUDIO', # Not on Android |
| 48 'ENABLE_WEB_AUDIO', | |
| 49 'ENABLE_WEBGL', | 44 'ENABLE_WEBGL', |
| 50 ] | 45 ] |
| 51 | 46 |
| 52 def build_database(idl_files, database_dir, feature_defines=None, parallel=False
): | 47 def build_database(idl_files, database_dir, feature_defines=None, parallel=False
): |
| 53 """This code reconstructs the FremontCut IDL database from W3C, | 48 """This code reconstructs the FremontCut IDL database from W3C, |
| 54 WebKit and Dart IDL files.""" | 49 WebKit and Dart IDL files.""" |
| 55 current_dir = os.path.dirname(__file__) | 50 current_dir = os.path.dirname(__file__) |
| 56 logging.config.fileConfig(os.path.join(current_dir, "logging.conf")) | 51 logging.config.fileConfig(os.path.join(current_dir, "logging.conf")) |
| 57 | 52 |
| 58 db = database.Database(database_dir) | 53 db = database.Database(database_dir) |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 builder.normalize_annotations(['WebKit', 'Dart']) | 99 builder.normalize_annotations(['WebKit', 'Dart']) |
| 105 | 100 |
| 106 conditionals_met = set( | 101 conditionals_met = set( |
| 107 'ENABLE_' + conditional for conditional in builder.conditionals_met) | 102 'ENABLE_' + conditional for conditional in builder.conditionals_met) |
| 108 known_conditionals = set(FEATURE_DEFINES + FEATURE_DISABLED) | 103 known_conditionals = set(FEATURE_DEFINES + FEATURE_DISABLED) |
| 109 | 104 |
| 110 unused_conditionals = known_conditionals - conditionals_met | 105 unused_conditionals = known_conditionals - conditionals_met |
| 111 if unused_conditionals: | 106 if unused_conditionals: |
| 112 _logger.warning('There are some unused conditionals %s' % | 107 _logger.warning('There are some unused conditionals %s' % |
| 113 sorted(unused_conditionals)) | 108 sorted(unused_conditionals)) |
| 109 _logger.warning('Please update fremontcutbuilder.py') |
| 114 | 110 |
| 115 unknown_conditionals = conditionals_met - known_conditionals | 111 unknown_conditionals = conditionals_met - known_conditionals |
| 116 if unknown_conditionals: | 112 if unknown_conditionals: |
| 117 _logger.warning('There are some unknown conditionals %s' % | 113 _logger.warning('There are some unknown conditionals %s' % |
| 118 sorted(unknown_conditionals)) | 114 sorted(unknown_conditionals)) |
| 115 _logger.warning('Please update fremontcutbuilder.py') |
| 119 | 116 |
| 120 db.Save() | 117 db.Save() |
| 121 return db | 118 return db |
| 122 | 119 |
| 123 def main(parallel=False): | 120 def main(parallel=False): |
| 124 current_dir = os.path.dirname(__file__) | 121 current_dir = os.path.dirname(__file__) |
| 125 | 122 |
| 126 idl_files = [] | 123 idl_files = [] |
| 127 | 124 |
| 128 webcore_dir = os.path.join(current_dir, '..', '..', '..', 'third_party', | 125 webcore_dir = os.path.join(current_dir, '..', '..', '..', 'third_party', |
| (...skipping 17 matching lines...) Expand all Loading... |
| 146 if ext == '.idl': | 143 if ext == '.idl': |
| 147 idl_files.append(file_name) | 144 idl_files.append(file_name) |
| 148 | 145 |
| 149 os.path.walk(webcore_dir, visitor, webcore_dir) | 146 os.path.walk(webcore_dir, visitor, webcore_dir) |
| 150 | 147 |
| 151 database_dir = os.path.join(current_dir, '..', 'database') | 148 database_dir = os.path.join(current_dir, '..', 'database') |
| 152 return build_database(idl_files, database_dir, parallel=parallel) | 149 return build_database(idl_files, database_dir, parallel=parallel) |
| 153 | 150 |
| 154 if __name__ == '__main__': | 151 if __name__ == '__main__': |
| 155 sys.exit(main()) | 152 sys.exit(main()) |
| OLD | NEW |