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

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

Issue 10024016: Support passing the list of idl files to fremontcutbuilder. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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
« no previous file with comments | « lib/dom/scripts/databasebuilder.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/dom/scripts/fremontcutbuilder.py
diff --git a/lib/dom/scripts/fremontcutbuilder.py b/lib/dom/scripts/fremontcutbuilder.py
index bf38db9a914b1542ad4cdf4fb9ac002616e1d5a5..02643c06092e1f9c3e40d4066560263f7d1362d7 100755
--- a/lib/dom/scripts/fremontcutbuilder.py
+++ b/lib/dom/scripts/fremontcutbuilder.py
@@ -7,11 +7,11 @@ import database
import databasebuilder
import idlparser
import os.path
+import tempfile
import logging.config
import sys
-
-def main():
+def build_database(idl_list_file_name):
"""This code reconstructs the FremontCut IDL database from W3C,
WebKit and Dart IDL files."""
current_dir = os.path.dirname(__file__)
@@ -24,33 +24,6 @@ def main():
builder = databasebuilder.DatabaseBuilder(db)
- # Import WebKit IDL files:
- webkit_dirs = [
- 'Modules/speech',
- 'Modules/indexeddb',
- 'css',
- 'dom',
- 'fileapi',
- 'Modules/filesystem',
- 'html',
- 'html/canvas',
- 'inspector',
- 'loader',
- 'loader/appcache',
- 'Modules/mediastream',
- 'Modules/geolocation',
- 'notifications',
- 'page',
- 'plugins',
- 'storage',
- 'Modules/webdatabase',
- 'svg',
- 'Modules/webaudio',
- 'Modules/websockets',
- 'workers',
- 'xml',
- ]
-
# TODO(vsm): Move this to a README.
# This is the Dart SVN revision.
webkit_revision = '1060'
@@ -150,18 +123,13 @@ def main():
('IDBDatabase', 'transaction', 'mode'),
]
- # Assume Dartium checkout.
- webcore_path = os.path.join(current_dir, '..', '..', '..', '..',
- 'third_party', 'WebKit', 'Source', 'WebCore')
-
- if not os.path.exists(webcore_path):
- # Fall back to standard Dart checkout.
- webcore_path = os.path.join(current_dir, '..', '..', '..',
- 'third_party', 'WebCore')
-
- for dir_name in webkit_dirs:
- dir_path = os.path.join(webcore_path, dir_name)
- builder.import_idl_directory(dir_path, webkit_options)
+ # Import WebKit IDLs.
+ idl_list_file = open(idl_list_file_name, 'r')
+ for file_name in idl_list_file:
+ file_name = file_name.rstrip()
Anton Muhin 2012/04/09 13:26:29 nit: just strip to be slightly safer?
+ idl_file_name = os.path.join(os.path.dirname(idl_list_file_name), file_name)
+ builder.import_idl_file(idl_file_name, webkit_options)
+ idl_list_file.close()
webkit_supplemental_options = databasebuilder.DatabaseBuilderOptions(
idl_syntax=idlparser.FREMONTCUT_SYNTAX,
@@ -196,5 +164,55 @@ def main():
db.Save()
+def main():
+ webkit_dirs = [
+ 'Modules/speech',
+ 'Modules/indexeddb',
+ 'css',
+ 'dom',
+ 'fileapi',
+ 'Modules/filesystem',
+ 'html',
+ 'html/canvas',
+ 'inspector',
+ 'loader',
+ 'loader/appcache',
+ 'Modules/mediastream',
+ 'Modules/geolocation',
+ 'notifications',
+ 'page',
+ 'plugins',
+ 'storage',
+ 'Modules/webdatabase',
+ 'svg',
+ 'Modules/webaudio',
+ 'Modules/websockets',
+ 'workers',
+ 'xml',
+ ]
+
+ (idl_list_file, idl_list_file_name) = tempfile.mkstemp()
+
+ webcore_dir = os.path.join(os.path.dirname(__file__), '..', '..', '..',
+ 'third_party', 'WebCore')
+ if not os.path.exists(webcore_dir):
+ raise RuntimeError('directory not found: %s' % webcore_dir)
+
+ def visitor(arg, dir_name, names):
+ for name in names:
+ file_name = os.path.join(dir_name, name)
+ (interface, ext) = os.path.splitext(file_name)
+ if ext == '.idl' and not name.startswith('._'):
+ path = os.path.relpath(file_name, os.path.dirname(idl_list_file_name))
+ os.write(idl_list_file, '%s\n' % path)
+
+ for dir_name in webkit_dirs:
+ dir_path = os.path.join(webcore_dir, dir_name)
+ os.path.walk(dir_path, visitor, None)
+
+ os.close(idl_list_file)
+
+ return build_database(idl_list_file_name)
+
if __name__ == '__main__':
sys.exit(main())
« no previous file with comments | « lib/dom/scripts/databasebuilder.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698