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

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

Issue 745153002: Make pub's binstubs resilient to changes in snapshot format. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 6 years 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: 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 6a6fec12e1520cd4da2a21641bd2816c0303d528..51eb18a0fcb4290a1d83dfa1e8df1616a31a3208 100644
--- a/sdk/lib/_internal/pub/test/test_pub.dart
+++ b/sdk/lib/_internal/pub/test/test_pub.dart
@@ -486,7 +486,7 @@ String _pathInSandbox(String relPath) {
}
/// Gets the environment variables used to run pub in a test context.
-Map getPubTestEnvironment([String tokenEndpoint]) {
+Future<Map> getPubTestEnvironment([String tokenEndpoint]) async {
var environment = {};
environment['_PUB_TESTING'] = 'true';
environment['PUB_CACHE'] = _pathInSandbox(cachePath);
@@ -498,6 +498,13 @@ Map getPubTestEnvironment([String tokenEndpoint]) {
environment['_PUB_TEST_TOKEN_ENDPOINT'] = tokenEndpoint.toString();
}
+ if (_hasServer) {
+ return port.then((p) {
+ environment['PUB_HOSTED_URL'] = "http://localhost:$p";
+ return environment;
+ });
+ }
+
return environment;
}
@@ -534,20 +541,9 @@ ScheduledProcess startPub({List args, Future<String> tokenEndpoint,
dartArgs.addAll(args);
if (tokenEndpoint == null) tokenEndpoint = new Future.value();
- var environmentFuture = tokenEndpoint.then((tokenEndpoint) {
- var pubEnvironment = getPubTestEnvironment(tokenEndpoint);
-
- // If there is a server running, tell pub what its URL is so hosted
- // dependencies will look there.
- if (_hasServer) {
- return port.then((p) {
- pubEnvironment['PUB_HOSTED_URL'] = "http://localhost:$p";
- return pubEnvironment;
- });
- }
-
- return pubEnvironment;
- }).then((pubEnvironment) {
+ var environmentFuture = tokenEndpoint
+ .then((tokenEndpoint) => getPubTestEnvironment(tokenEndpoint))
+ .then((pubEnvironment) {
if (environment != null) pubEnvironment.addAll(environment);
return pubEnvironment;
});
@@ -854,6 +850,11 @@ Map packageVersionApiMap(Map pubspec, {bool full: false}) {
return map;
}
+/// Returns the name of the shell script for a binstub named [name].
+///
+/// Adds a ".bat" extension on Windows.
+String binStubName(String name) => Platform.isWindows ? '$name.bat' : name;
+
/// Compares the [actual] output from running pub with [expected].
///
/// If [expected] is a [String], ignores leading and trailing whitespace
« no previous file with comments | « sdk/lib/_internal/pub/test/global/binstubs/utils.dart ('k') | sdk/lib/_internal/pub_generated/bin/async_compile.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698