Chromium Code Reviews| 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..e317e81a3aa26586d72d3cb8e90bb02b3a9b19ce 100644 |
| --- a/sdk/lib/_internal/pub/lib/src/entrypoint.dart |
| +++ b/sdk/lib/_internal/pub/lib/src/entrypoint.dart |
| @@ -63,15 +63,16 @@ 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). |
|
nweiz
2013/05/17 23:55:55
I'd say something like "if the package's source ha
Bob Nystrom
2013/05/20 20:06:00
Done.
|
| + /// well if it requires network access to retrieve. |
| /// |
| /// 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 +83,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; |