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

Unified Diff: sdk/lib/_internal/pub/lib/src/entrypoint.dart

Issue 15347004: Gracefully handle pubspecs with dependencies using unknown sources. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add tests for unknown sources in lockfiles. Created 7 years, 7 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 | « no previous file | sdk/lib/_internal/pub/lib/src/git_source.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/pub/lib/src/entrypoint.dart
diff --git a/sdk/lib/_internal/pub/lib/src/entrypoint.dart b/sdk/lib/_internal/pub/lib/src/entrypoint.dart
index edfffbaeb7d27034f6aba89001e21714a49ba817..a10a0c17063a717514ca5844a30f3a221f8df414 100644
--- a/sdk/lib/_internal/pub/lib/src/entrypoint.dart
+++ b/sdk/lib/_internal/pub/lib/src/entrypoint.dart
@@ -63,15 +63,17 @@ class Entrypoint {
/// using the `package:` scheme.
///
/// This will automatically install the package to the system-wide cache as
- /// well if it requires network access to retrieve (specifically, if
- /// `id.source.shouldCache` is true).
+ /// well if it requires network access to retrieve (specifically, if the
+ /// package's source has [shouldCache] as `true`).
///
/// See also [installDependencies].
Future<PackageId> install(PackageId id) {
- var pendingOrCompleted = _installs[id];
- if (pendingOrCompleted != null) return pendingOrCompleted;
+ var pending = _installs[id];
+ if (pending != null) return pending;
var packageDir = path.join(packagesDir, id.name);
+ var source;
+
var future = new Future.sync(() {
ensureDir(path.dirname(packageDir));
@@ -82,16 +84,18 @@ class Entrypoint {
deleteEntry(packageDir);
}
- if (id.source.shouldCache) {
+ source = cache.sources[id.source];
+
+ if (source.shouldCache) {
return cache.install(id).then(
(pkg) => createPackageSymlink(id.name, pkg.dir, packageDir));
} else {
- return id.source.install(id, packageDir).then((found) {
+ return source.install(id, packageDir).then((found) {
if (found) return null;
- fail('Package ${id.name} not found in source "${id.source.name}".');
+ fail('Package ${id.name} not found in source "${id.source}".');
});
}
- }).then((_) => id.resolved);
+ }).then((_) => source.resolveId(id));
_installs[id] = future;
« no previous file with comments | « no previous file | sdk/lib/_internal/pub/lib/src/git_source.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698