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 |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 40 'ENABLE_NOTIFICATIONS', | 40 'ENABLE_NOTIFICATIONS', |
| 41 'ENABLE_PAGE_POPUP', | 41 'ENABLE_PAGE_POPUP', |
| 42 'ENABLE_SHARED_WORKERS', | 42 'ENABLE_SHARED_WORKERS', |
| 43 'ENABLE_SVG', | 43 'ENABLE_SVG', |
| 44 'ENABLE_SVG_FONTS', | 44 'ENABLE_SVG_FONTS', |
| 45 'ENABLE_VIDEO', | 45 'ENABLE_VIDEO', |
| 46 'ENABLE_WEB_AUDIO', | 46 'ENABLE_WEB_AUDIO', |
| 47 'ENABLE_WEBGL', | 47 'ENABLE_WEBGL', |
| 48 ] | 48 ] |
| 49 | 49 |
| 50 def build_database(idl_files, database_dir, parallel=False): | 50 def build_database(idl_files, database_dir, feature_defs=None, parallel=False): |
|
podivilov1
2013/04/26 08:11:23
nit: feature_defines
Anton Muhin
2013/04/26 08:25:49
Done.
| |
| 51 """This code reconstructs the FremontCut IDL database from W3C, | 51 """This code reconstructs the FremontCut IDL database from W3C, |
| 52 WebKit and Dart IDL files.""" | 52 WebKit and Dart IDL files.""" |
| 53 current_dir = os.path.dirname(__file__) | 53 current_dir = os.path.dirname(__file__) |
| 54 logging.config.fileConfig(os.path.join(current_dir, "logging.conf")) | 54 logging.config.fileConfig(os.path.join(current_dir, "logging.conf")) |
| 55 | 55 |
| 56 db = database.Database(database_dir) | 56 db = database.Database(database_dir) |
| 57 | 57 |
| 58 # Delete all existing IDLs in the DB. | 58 # Delete all existing IDLs in the DB. |
| 59 db.Delete() | 59 db.Delete() |
| 60 | 60 |
| 61 builder = databasebuilder.DatabaseBuilder(db) | 61 builder = databasebuilder.DatabaseBuilder(db) |
| 62 | 62 |
| 63 # TODO(vsm): Move this to a README. | 63 # TODO(vsm): Move this to a README. |
| 64 # This is the Dart SVN revision. | 64 # This is the Dart SVN revision. |
| 65 webkit_revision = '1060' | 65 webkit_revision = '1060' |
| 66 | 66 |
| 67 # TODO(vsm): Reconcile what is exposed here and inside WebKit code | 67 # TODO(vsm): Reconcile what is exposed here and inside WebKit code |
| 68 # generation. We need to recheck this periodically for now. | 68 # generation. We need to recheck this periodically for now. |
| 69 webkit_defines = [ 'LANGUAGE_DART', 'LANGUAGE_JAVASCRIPT' ] | 69 webkit_defines = [ 'LANGUAGE_DART', 'LANGUAGE_JAVASCRIPT' ] |
| 70 | 70 |
| 71 if feature_defs is None: | |
| 72 feature_defs = FEATURE_DEFINES | |
|
podivilov1
2013/04/26 08:10:30
Maybe make FEATURE_DEFINES a default?
Anton Muhin
2013/04/26 08:25:49
Usually it's not recommended to have mutable objec
| |
| 73 | |
| 71 webkit_options = databasebuilder.DatabaseBuilderOptions( | 74 webkit_options = databasebuilder.DatabaseBuilderOptions( |
| 72 idl_syntax=idlparser.WEBKIT_SYNTAX, | 75 idl_syntax=idlparser.WEBKIT_SYNTAX, |
| 73 # TODO(vsm): What else should we define as on when processing IDL? | 76 # TODO(vsm): What else should we define as on when processing IDL? |
| 74 idl_defines=webkit_defines + FEATURE_DEFINES, | 77 idl_defines=webkit_defines + feature_defs, |
| 75 source='WebKit', | 78 source='WebKit', |
| 76 source_attributes={'revision': webkit_revision}) | 79 source_attributes={'revision': webkit_revision}) |
| 77 | 80 |
| 78 # Import WebKit IDLs. | 81 # Import WebKit IDLs. |
| 79 builder.import_idl_files(idl_files, webkit_options, parallel) | 82 builder.import_idl_files(idl_files, webkit_options, parallel) |
| 80 | 83 |
| 81 # Import Dart idl: | 84 # Import Dart idl: |
| 82 dart_options = databasebuilder.DatabaseBuilderOptions( | 85 dart_options = databasebuilder.DatabaseBuilderOptions( |
| 83 idl_syntax=idlparser.FREMONTCUT_SYNTAX, | 86 idl_syntax=idlparser.FREMONTCUT_SYNTAX, |
| 84 source='Dart', | 87 source='Dart', |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 141 if ext == '.idl': | 144 if ext == '.idl': |
| 142 idl_files.append(file_name) | 145 idl_files.append(file_name) |
| 143 | 146 |
| 144 os.path.walk(webcore_dir, visitor, webcore_dir) | 147 os.path.walk(webcore_dir, visitor, webcore_dir) |
| 145 | 148 |
| 146 database_dir = os.path.join(current_dir, '..', 'database') | 149 database_dir = os.path.join(current_dir, '..', 'database') |
| 147 return build_database(idl_files, database_dir, parallel=parallel) | 150 return build_database(idl_files, database_dir, parallel=parallel) |
| 148 | 151 |
| 149 if __name__ == '__main__': | 152 if __name__ == '__main__': |
| 150 sys.exit(main()) | 153 sys.exit(main()) |
| OLD | NEW |