| 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 logging.config | 8 import logging.config |
| 9 import os.path | 9 import os.path |
| 10 import sys | 10 import sys |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 'ENABLE_ENCRYPTED_MEDIA_V2', | 29 'ENABLE_ENCRYPTED_MEDIA_V2', |
| 30 'ENABLE_INPUT_SPEECH', # Not on Android | 30 'ENABLE_INPUT_SPEECH', # Not on Android |
| 31 'ENABLE_LEGACY_NOTIFICATIONS', # Not on Android | 31 'ENABLE_LEGACY_NOTIFICATIONS', # Not on Android |
| 32 'ENABLE_NAVIGATOR_CONTENT_UTILS', # Not on Android | 32 'ENABLE_NAVIGATOR_CONTENT_UTILS', # Not on Android |
| 33 'ENABLE_NOTIFICATIONS', # Not on Android | 33 'ENABLE_NOTIFICATIONS', # Not on Android |
| 34 'ENABLE_SVG_FONTS', | 34 'ENABLE_SVG_FONTS', |
| 35 'ENABLE_WEB_AUDIO', # Not on Android | 35 'ENABLE_WEB_AUDIO', # Not on Android |
| 36 ] | 36 ] |
| 37 | 37 |
| 38 def build_database(idl_files, database_dir, feature_defines=None, | 38 def build_database(idl_files, database_dir, feature_defines=None, |
| 39 logging_level=logging.WARNING): | 39 logging_level=logging.WARNING, examine_idls=False): |
| 40 """This code reconstructs the FremontCut IDL database from W3C, | 40 """This code reconstructs the FremontCut IDL database from W3C, |
| 41 WebKit and Dart IDL files.""" | 41 WebKit and Dart IDL files.""" |
| 42 current_dir = os.path.dirname(__file__) | 42 current_dir = os.path.dirname(__file__) |
| 43 logging.config.fileConfig(os.path.join(current_dir, "logging.conf")) | 43 logging.config.fileConfig(os.path.join(current_dir, "logging.conf")) |
| 44 | 44 |
| 45 _logger.setLevel(logging_level) | 45 _logger.setLevel(logging_level) |
| 46 | 46 |
| 47 db = database.Database(database_dir) | 47 db = database.Database(database_dir) |
| 48 | 48 |
| 49 # Delete all existing IDLs in the DB. | 49 # Delete all existing IDLs in the DB. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 | 91 |
| 92 builder.fetch_constructor_data(webkit_options) | 92 builder.fetch_constructor_data(webkit_options) |
| 93 builder.fix_displacements('WebKit') | 93 builder.fix_displacements('WebKit') |
| 94 | 94 |
| 95 # Cleanup: | 95 # Cleanup: |
| 96 builder.normalize_annotations(['WebKit', 'Dart']) | 96 builder.normalize_annotations(['WebKit', 'Dart']) |
| 97 | 97 |
| 98 # Map any IDL defined dictionaries to Dictionary. | 98 # Map any IDL defined dictionaries to Dictionary. |
| 99 builder.map_dictionaries() | 99 builder.map_dictionaries() |
| 100 | 100 |
| 101 # Examine all IDL and produce a diagnoses of areas (e.g., list dictionaries |
| 102 # declared and usage, etc.) |
| 103 if examine_idls: |
| 104 builder.examine_database() |
| 105 |
| 101 conditionals_met = set( | 106 conditionals_met = set( |
| 102 'ENABLE_' + conditional for conditional in builder.conditionals_met) | 107 'ENABLE_' + conditional for conditional in builder.conditionals_met) |
| 103 known_conditionals = set(FEATURE_DEFINES + FEATURE_DISABLED) | 108 known_conditionals = set(FEATURE_DEFINES + FEATURE_DISABLED) |
| 104 | 109 |
| 105 unused_conditionals = known_conditionals - conditionals_met | 110 unused_conditionals = known_conditionals - conditionals_met |
| 106 if unused_conditionals: | 111 if unused_conditionals: |
| 107 _logger.warning('There are some unused conditionals %s' % | 112 _logger.warning('There are some unused conditionals %s' % |
| 108 sorted(unused_conditionals)) | 113 sorted(unused_conditionals)) |
| 109 _logger.warning('Please update fremontcutbuilder.py') | 114 _logger.warning('Please update fremontcutbuilder.py') |
| 110 | 115 |
| 111 unknown_conditionals = conditionals_met - known_conditionals | 116 unknown_conditionals = conditionals_met - known_conditionals |
| 112 if unknown_conditionals: | 117 if unknown_conditionals: |
| 113 _logger.warning('There are some unknown conditionals %s' % | 118 _logger.warning('There are some unknown conditionals %s' % |
| 114 sorted(unknown_conditionals)) | 119 sorted(unknown_conditionals)) |
| 115 _logger.warning('Please update fremontcutbuilder.py') | 120 _logger.warning('Please update fremontcutbuilder.py') |
| 116 | 121 |
| 117 print 'Merging interfaces %s seconds' % round(time.time() - start_time, 2) | 122 print 'Merging interfaces %s seconds' % round(time.time() - start_time, 2) |
| 118 | 123 |
| 119 # TODO(terry): Don't generate the database cache. | |
| 120 # db.Save() | |
| 121 | |
| 122 return db | 124 return db |
| 123 | 125 |
| 124 def main(parallel=False, logging_level=logging.WARNING): | 126 def main(parallel=False, logging_level=logging.WARNING, examine_idls=False): |
| 125 current_dir = os.path.dirname(__file__) | 127 current_dir = os.path.dirname(__file__) |
| 126 | 128 |
| 127 idl_files = [] | 129 idl_files = [] |
| 128 | 130 |
| 129 # Check default location in a regular dart enlistment. | 131 # Check default location in a regular dart enlistment. |
| 130 webcore_dir = os.path.join(current_dir, '..', '..', '..', 'third_party', | 132 webcore_dir = os.path.join(current_dir, '..', '..', '..', 'third_party', |
| 131 'WebCore') | 133 'WebCore') |
| 132 | 134 |
| 133 if not os.path.exists(webcore_dir): | 135 if not os.path.exists(webcore_dir): |
| 134 # Check default location in a dartium enlistment. | 136 # Check default location in a dartium enlistment. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 160 for name in names: | 162 for name in names: |
| 161 file_name = os.path.join(dir_name, name) | 163 file_name = os.path.join(dir_name, name) |
| 162 (interface, ext) = os.path.splitext(file_name) | 164 (interface, ext) = os.path.splitext(file_name) |
| 163 if ext == '.idl' and not(name in FILES_TO_IGNORE): | 165 if ext == '.idl' and not(name in FILES_TO_IGNORE): |
| 164 idl_files.append(file_name) | 166 idl_files.append(file_name) |
| 165 | 167 |
| 166 os.path.walk(webcore_dir, visitor, webcore_dir) | 168 os.path.walk(webcore_dir, visitor, webcore_dir) |
| 167 | 169 |
| 168 database_dir = os.path.join(current_dir, '..', 'database') | 170 database_dir = os.path.join(current_dir, '..', 'database') |
| 169 | 171 |
| 170 return build_database(idl_files, database_dir, logging_level=logging_level) | 172 return build_database(idl_files, database_dir, logging_level=logging_level, ex
amine_idls=examine_idls) |
| 171 | 173 |
| 172 if __name__ == '__main__': | 174 if __name__ == '__main__': |
| 173 sys.exit(main()) | 175 sys.exit(main()) |
| OLD | NEW |