Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(236)

Unified Diff: tools/dom/scripts/fremontcutbuilder.py

Issue 444743002: Use Blink IDL parser for dart libraries. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: cleanup Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/dom/scripts/fremontcutbuilder.py
diff --git a/tools/dom/scripts/fremontcutbuilder.py b/tools/dom/scripts/fremontcutbuilder.py
index 085e01bfcc25582cc4d59f21f485115300992009..09511dfbaf26cea94dd41266fd80eb2c15ae3f53 100755
--- a/tools/dom/scripts/fremontcutbuilder.py
+++ b/tools/dom/scripts/fremontcutbuilder.py
@@ -9,6 +9,7 @@ import idlparser
import logging.config
import os.path
import sys
+import time
_logger = logging.getLogger('fremontcutbuilder')
@@ -34,12 +35,15 @@ FEATURE_DEFINES = [
'ENABLE_WEB_AUDIO', # Not on Android
]
-def build_database(idl_files, database_dir, feature_defines=None, parallel=False):
+def build_database(idl_files, database_dir, feature_defines=None, parallel=False,
+ blink_parser=False, logging_level=logging.WARNING):
"""This code reconstructs the FremontCut IDL database from W3C,
WebKit and Dart IDL files."""
current_dir = os.path.dirname(__file__)
logging.config.fileConfig(os.path.join(current_dir, "logging.conf"))
+ _logger.setLevel(logging_level)
+
db = database.Database(database_dir)
# Delete all existing IDLs in the DB.
@@ -63,24 +67,28 @@ def build_database(idl_files, database_dir, feature_defines=None, parallel=False
# TODO(vsm): What else should we define as on when processing IDL?
idl_defines=webkit_defines + feature_defines,
source='WebKit',
- source_attributes={'revision': webkit_revision})
+ source_attributes={'revision': webkit_revision},
+ logging_level=logging_level)
# Import WebKit IDLs.
- builder.import_idl_files(idl_files, webkit_options, parallel)
+ builder.import_idl_files(idl_files, webkit_options, parallel, blink_parser, False)
# Import Dart idl:
dart_options = databasebuilder.DatabaseBuilderOptions(
idl_syntax=idlparser.FREMONTCUT_SYNTAX,
source='Dart',
- rename_operation_arguments_on_merge=True)
+ rename_operation_arguments_on_merge=True,
+ logging_level=logging_level)
builder.import_idl_files(
- [ os.path.join(current_dir, '..', 'idl', 'dart', 'dart.idl') ],
- dart_options,
- parallel)
+ [ os.path.join(current_dir, '..', 'idl', 'dart',
+ 'new_dart.idl' if blink_parser else 'dart.idl') ],
+ dart_options, parallel, blink_parser, True)
+
+ start_time = time.time()
# Merging:
- builder.merge_imported_interfaces()
+ builder.merge_imported_interfaces(blink_parser)
builder.fetch_constructor_data(webkit_options)
builder.fix_displacements('WebKit')
@@ -104,17 +112,26 @@ def build_database(idl_files, database_dir, feature_defines=None, parallel=False
sorted(unknown_conditionals))
_logger.warning('Please update fremontcutbuilder.py')
- db.Save()
+ print 'Merging interfaces %s seconds' % round(time.time() - start_time, 2)
+
+# TODO(terry): Don't generate the database cache.
+# db.Save()
+
return db
-def main(parallel=False):
+def main(parallel=False, blink_parser=False, logging_level=logging.WARNING):
current_dir = os.path.dirname(__file__)
idl_files = []
# Check default location in a regular dart enlistment.
- webcore_dir = os.path.join(current_dir, '..', '..', '..', 'third_party',
- 'WebCore')
+ if blink_parser:
+ # TODO(terry): Parse the Roll 37 IDLs
+ webcore_dir = os.path.join(current_dir, '..', '..', '..', 'third_party',
vsm 2014/09/03 22:23:41 You'll need to update this path.
terry 2014/09/05 20:22:55 The below old webcore_dir will be used.
+ 'chrome', 'third_party', 'WebKit', 'Source')
+ else:
+ webcore_dir = os.path.join(current_dir, '..', '..', '..', 'third_party',
+ 'WebCore')
if not os.path.exists(webcore_dir):
# Check default location in a dartium enlistment.
@@ -132,19 +149,27 @@ def main(parallel=False):
'inspector',
]
+ FILES_TO_IGNORE = [
vsm 2014/09/03 22:23:41 We've got some logic for this in htmlrenamer.py -
terry 2014/09/05 20:22:55 Quickly tried it and it didn't work. I'll look at
+ 'InspectorFrontendHostFileSystem.idl', # Uses interfaces in inspector dir (which is ignored)
+ 'WebKitGamepad.idl', # Gamepad.idl is the new one.
+ 'WebKitGamepadList.idl', # GamepadList is the new one.
+ ]
+
def visitor(arg, dir_name, names):
if os.path.basename(dir_name) in DIRS_TO_IGNORE:
names[:] = [] # Do not go underneath
for name in names:
file_name = os.path.join(dir_name, name)
(interface, ext) = os.path.splitext(file_name)
- if ext == '.idl':
+ if ext == '.idl' and not(name in FILES_TO_IGNORE):
idl_files.append(file_name)
os.path.walk(webcore_dir, visitor, webcore_dir)
database_dir = os.path.join(current_dir, '..', 'database')
- return build_database(idl_files, database_dir, parallel=parallel)
+
+ return build_database(idl_files, database_dir, parallel=parallel,
+ blink_parser=blink_parser, logging_level=logging_level)
if __name__ == '__main__':
sys.exit(main())

Powered by Google App Engine
This is Rietveld 408576698