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

Unified Diff: tools/create_pub_snapshot.py

Issue 472173004: Skeleton code for running the forthcoming async/await compiler on pub. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revise. Created 6 years, 4 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 | « sdk/lib/_internal/pub/test/test_pub.dart ('k') | tools/create_sdk.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/create_pub_snapshot.py
diff --git a/tools/create_pub_snapshot.py b/tools/create_pub_snapshot.py
new file mode 100644
index 0000000000000000000000000000000000000000..5ba0beba921e6419cdd06c842dffb2c0d70e9d3e
--- /dev/null
+++ b/tools/create_pub_snapshot.py
@@ -0,0 +1,61 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2014 The Dart Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+This script runs the async/await compiler on pub and then compiles the output
+of that to a snapshot.
+
+Usage: create_pub_snapshot.py <dart> <compiler> <package root> <output dir>
+
+When #104 is fixed, this script is no longer needed. Instead, replace the
+generate_pub_snapshot action in utils/pub.gyp with:
+
+ 'action': [
+ '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)dart<(EXECUTABLE_SUFFIX)',
+ '--package-root=<(PRODUCT_DIR)/pub_packages/',
+ '--snapshot=<(SHARED_INTERMEDIATE_DIR)/pub.dart.snapshot',
+ '../../sdk/lib/_internal/pub/bin/pub.dart',
+ ]
+"""
+
+import os
+import subprocess
+import sys
+
+
+def Main():
+ if len(sys.argv) < 5:
+ raise Exception("""Not enough arguments.
+
+Usage: create_pub_snapshot.py <dart> <compiler> <package root> <output file>""")
+
+ dart_path = sys.argv[1]
+ compiler = sys.argv[2]
+ package_root = sys.argv[3]
+ output_dir = sys.argv[4]
+
+ # Run the async compiler.
+ status = subprocess.call([
+ dart_path,
+ '--package-root=' + package_root,
+ compiler,
+ output_dir,
+ '--silent'
+ ])
+ if status != 0: return status
+
+ # Generate the snapshot from the output of that.
+ status = subprocess.call([
+ dart_path,
+ '--package-root=' + package_root,
+ '--snapshot=' + os.path.join(output_dir, 'pub.dart.snapshot'),
+ os.path.join(output_dir, 'pub_async/bin/pub.dart')
+ ])
+ if status != 0: return status
+
+
+if __name__ == '__main__':
+ sys.exit(Main())
« no previous file with comments | « sdk/lib/_internal/pub/test/test_pub.dart ('k') | tools/create_sdk.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698