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

Unified Diff: utils/pub/sdk_source.dart

Issue 11783009: Big merge from experimental to bleeding edge. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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 | « utils/pub/pubspec.dart ('k') | utils/pub/source.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/pub/sdk_source.dart
diff --git a/utils/pub/sdk_source.dart b/utils/pub/sdk_source.dart
index 654043a266c7c87fa84801f779f22342ebe41c53..13ffa2525e91176f6d3cc1742c8f9593fff10879 100644
--- a/utils/pub/sdk_source.dart
+++ b/utils/pub/sdk_source.dart
@@ -4,6 +4,7 @@
library sdk_source;
+import 'dart:async';
import 'io.dart';
import 'package.dart';
import 'pubspec.dart';
@@ -30,14 +31,14 @@ class SdkSource extends Source {
/// inferred from the revision number of the SDK itself.
Future<Pubspec> describe(PackageId id) {
var version;
- return readTextFile(join(rootDir, "revision")).chain((revision) {
+ return readTextFile(join(rootDir, "revision")).then((revision) {
version = new Version.parse("0.0.0-r.${revision.trim()}");
// Read the pubspec for the package's dependencies.
return _getPackagePath(id);
- }).chain((packageDir) {
+ }).then((packageDir) {
// TODO(rnystrom): What if packageDir is null?
return Package.load(id.name, packageDir, systemCache.sources);
- }).transform((package) {
+ }).then((package) {
// Ignore the pubspec's version, and use the SDK's.
return new Pubspec(id.name, version, package.pubspec.dependencies);
});
@@ -46,10 +47,10 @@ class SdkSource extends Source {
/// Since all the SDK files are already available locally, installation just
/// involves symlinking the SDK library into the packages directory.
Future<bool> install(PackageId id, String destPath) {
- return _getPackagePath(id).chain((path) {
+ return _getPackagePath(id).then((path) {
if (path == null) return new Future<bool>.immediate(false);
- return createPackageSymlink(id.name, path, destPath).transform(
+ return createPackageSymlink(id.name, path, destPath).then(
(_) => true);
});
}
@@ -60,14 +61,14 @@ class SdkSource extends Source {
Future<String> _getPackagePath(PackageId id) {
// Look in "pkg" first.
var pkgPath = join(rootDir, "pkg", id.description);
- return exists(pkgPath).chain((found) {
+ return exists(pkgPath).then((found) {
if (found) return new Future<String>.immediate(pkgPath);
// Not in "pkg", so try "lib".
// TODO(rnystrom): Get rid of this when all SDK packages are moved from
// "lib" to "pkg".
var libPath = join(rootDir, "lib", id.description);
- return exists(libPath).transform((found) => found ? libPath : null);
+ return exists(libPath).then((found) => found ? libPath : null);
});
}
}
« no previous file with comments | « utils/pub/pubspec.dart ('k') | utils/pub/source.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698