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

Unified Diff: sdk/lib/_internal/pub/test/test_pub.dart

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/lib/src/io.dart ('k') | tools/create_pub_snapshot.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/pub/test/test_pub.dart
diff --git a/sdk/lib/_internal/pub/test/test_pub.dart b/sdk/lib/_internal/pub/test/test_pub.dart
index 0c3121f4fffbc6689522df12525882ad45e62696..8a11024011234b92e8765c87043effb542e8def4 100644
--- a/sdk/lib/_internal/pub/test/test_pub.dart
+++ b/sdk/lib/_internal/pub/test/test_pub.dart
@@ -476,6 +476,39 @@ void confirmPublish(ScheduledProcess pub) {
pub.writeLine("y");
}
+/// Whether the async/await compiler has already been run.
+///
+/// If a test suite runs pub more than once, we only need to run the compiler
+/// the first time.
+// TODO(rnystrom): Remove this when #104 is fixed.
+bool _compiledAsync = false;
+
+/// Gets the path to the pub entrypoint Dart script to run.
+// TODO(rnystrom): This exists to run the async/await compiler on pub and then
+// get the path to the output of that. Once #104 is fixed, remove this.
+String _getPubPath(String dartBin) {
+ var buildDir = path.join(path.dirname(dartBin), '../../');
+
+ // Ensure the async/await compiler has been run once for this test suite. The
+ // compiler itself will only re-compile source files that have actually
+ // changed, so this is a no-op if everything is already compiled.
+ if (!_compiledAsync) {
+ var result = Process.runSync(dartBin, [
+ '--package-root=$_packageRoot/',
+ path.join(testDirectory, '..', 'bin', 'async_compile.dart'),
+ buildDir,
+ '--silent'
+ ]);
+ stdout.write(result.stdout);
+ stderr.write(result.stderr);
+ if (result.exitCode != 0) fail("Async/await compiler failed.");
+
+ _compiledAsync = true;
+ }
+
+ return path.join(buildDir, 'pub_async/bin/pub.dart');
+}
+
/// Starts a Pub process and returns a [ScheduledProcess] that supports
/// interaction with that process.
///
@@ -498,7 +531,10 @@ ScheduledProcess startPub({List args, Future<Uri> tokenEndpoint}) {
}
// Find the main pub entrypoint.
- var pubPath = path.join(testDirectory, '..', 'bin', 'pub.dart');
+ var pubPath = _getPubPath(dartBin);
+ // TODO(rnystrom): Replace the above line with the following when #104 is
+ // fixed.
+ //var pubPath = path.join(testDirectory, '..', 'bin', 'pub.dart');
var dartArgs = ['--package-root=$_packageRoot/', '--checked', pubPath,
'--verbose'];
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/io.dart ('k') | tools/create_pub_snapshot.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698