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

Issue 10340005: Add support for pub install. (Closed)

Created:
8 years, 7 months ago by nweiz
Modified:
8 years, 7 months ago
Reviewers:
Bob Nystrom
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Add support for pub install. This CL does several things: * Adds explicit infrastructure for package sources. * Adds the Dart SDK as such a source. * Adds an explicit class for managing the packages/ directory (AppCache, as opposed to SystemCache). * Adds an "install" command that installs to packages/, backed up by the system cache. Committed: https://code.google.com/p/dart/source/detail?r=7398

Patch Set 1 #

Total comments: 12

Patch Set 2 : Fix Chromium review errors? #

Total comments: 37

Patch Set 3 : Code review changes #

Patch Set 4 : More review changes #

Total comments: 6

Patch Set 5 : Code review changes #

Patch Set 6 : Code review changes #

Unified diffs Side-by-side diffs Delta from patch set Stats (+567 lines, -182 lines) Patch
D utils/pub/cache.dart View 1 chunk +0 lines, -64 lines 0 comments Download
A utils/pub/command_install.dart View 1 2 3 4 1 chunk +14 lines, -0 lines 0 comments Download
M utils/pub/command_list.dart View 1 2 1 chunk +14 lines, -6 lines 0 comments Download
M utils/pub/command_update.dart View 1 chunk +3 lines, -22 lines 0 comments Download
M utils/pub/io.dart View 1 2 3 4 3 chunks +56 lines, -0 lines 0 comments Download
M utils/pub/package.dart View 1 2 3 5 chunks +60 lines, -47 lines 0 comments Download
A utils/pub/packages_dir.dart View 1 2 3 4 1 chunk +119 lines, -0 lines 0 comments Download
M utils/pub/pub.dart View 1 2 4 chunks +25 lines, -18 lines 0 comments Download
A utils/pub/sdk_source.dart View 1 2 3 1 chunk +34 lines, -0 lines 0 comments Download
A utils/pub/source.dart View 1 2 3 1 chunk +71 lines, -0 lines 0 comments Download
A utils/pub/system_cache.dart View 1 2 3 1 chunk +78 lines, -0 lines 0 comments Download
M utils/pub/utils.dart View 1 2 1 chunk +32 lines, -1 line 0 comments Download
M utils/tests/pub/pub_test.dart View 4 chunks +34 lines, -22 lines 0 comments Download
M utils/tests/pub/test_pub.dart View 1 2 5 chunks +27 lines, -2 lines 0 comments Download

Messages

Total messages: 6 (0 generated)
nweiz
8 years, 7 months ago (2012-05-02 20:28:53 UTC) #1
Bob Nystrom
Some minor suggestions but overall looks excellent. I'd like to talk about names a bit ...
8 years, 7 months ago (2012-05-03 00:15:48 UTC) #2
Bob Nystrom
Name changes like we discussed. https://chromiumcodereview.appspot.com/10340005/diff/6006/utils/pub/app_cache.dart File utils/pub/app_cache.dart (right): https://chromiumcodereview.appspot.com/10340005/diff/6006/utils/pub/app_cache.dart#newcode14 utils/pub/app_cache.dart:14: class AppCache { "EntrypointCache" ...
8 years, 7 months ago (2012-05-03 00:23:02 UTC) #3
nweiz
https://chromiumcodereview.appspot.com/10340005/diff/1/utils/pub/app_cache.dart File utils/pub/app_cache.dart (right): https://chromiumcodereview.appspot.com/10340005/diff/1/utils/pub/app_cache.dart#newcode12 utils/pub/app_cache.dart:12: * This corresponds to the application's packages directory. On ...
8 years, 7 months ago (2012-05-04 01:03:43 UTC) #4
Bob Nystrom
A couple of suggestions but otherwise LGTM! https://chromiumcodereview.appspot.com/10340005/diff/6006/utils/pub/utils.dart File utils/pub/utils.dart (right): https://chromiumcodereview.appspot.com/10340005/diff/6006/utils/pub/utils.dart#newcode27 utils/pub/utils.dart:27: always(Future future, ...
8 years, 7 months ago (2012-05-04 17:02:06 UTC) #5
nweiz
8 years, 7 months ago (2012-05-07 18:28:35 UTC) #6
https://chromiumcodereview.appspot.com/10340005/diff/6006/utils/pub/utils.dart
File utils/pub/utils.dart (right):

https://chromiumcodereview.appspot.com/10340005/diff/6006/utils/pub/utils.dar...
utils/pub/utils.dart:27: always(Future future, fn()) {
On 2012/05/04 17:02:06, Bob Nystrom wrote:
> On 2012/05/04 01:03:43, nweiz wrote:
> > On 2012/05/03 00:15:49, Bob Nystrom wrote:
> > > I sketched out something like this once but didn't end up keeping it. It
> might
> > > be nice to have it take (optional) arguments for the then and exception
> cases
> > > too so you don't have to capture the future in a variable at all in the
> > calling
> > > code.
> > 
> > I don't follow... what would these arguments do?
> 
> I don't know if this is a good idea, but for example, here's some (simplified
> code using always:
> 
> 
> Future<Package> install(PackageId id) {
>   var future = ensureDir(dirname(packageDir)).chain((_) {
>     return exists(packageDir);
>   }).chain((exists) {
>     ...
>   }).chain((_) => Package.load(packageDir));
> 
>   future.then((pkg) => _loadedPackages[id] = pkg);
>   always(future, () => _pendingInstalls.remove(id));
>   return future;
> }
> 
> Instead of "always" imagine you replace that with "foo" (need some real name),
> like:
> 
> Future<Package> install(PackageId id) {
>   return foo(ensureDir(dirname(packageDir)).chain((_) {
>       return exists(packageDir);
>     }).chain((exists) {
>       ...
>     }).chain((_) => Package.load(packageDir)),
>     then: (pkg) => _loadedPackages[id] = pkg,
>     always: () => _pendingInstalls.remove(id));
>   return future;
> }

I don't think that really adds any clarity.

https://chromiumcodereview.appspot.com/10340005/diff/29001/utils/pub/command_...
File utils/pub/command_install.dart (right):

https://chromiumcodereview.appspot.com/10340005/diff/29001/utils/pub/command_...
utils/pub/command_install.dart:10: var installedDeps =
packagesDir.package.dependencies.map(
On 2012/05/04 17:02:07, Bob Nystrom wrote:
> Seems like this could be a method on PackagesDir itself. Feels a bit non-OOP
to
> pull out a property of packagesDir and call a method on it passing the
> packagesDir back in. Maybe just do:
> 
> packagesDir.install();

Done.

https://chromiumcodereview.appspot.com/10340005/diff/29001/utils/pub/io.dart
File utils/pub/io.dart (right):

https://chromiumcodereview.appspot.com/10340005/diff/29001/utils/pub/io.dart#...
utils/pub/io.dart:146: if (path == '.') return new Future.immediate(new
Directory('.'));
On 2012/05/04 17:02:07, Bob Nystrom wrote:
> What if path == new File('.')?
> 
> Should probably do the _getPath() call first.

Done.

https://chromiumcodereview.appspot.com/10340005/diff/29001/utils/pub/packages...
File utils/pub/packages_dir.dart (right):

https://chromiumcodereview.appspot.com/10340005/diff/29001/utils/pub/packages...
utils/pub/packages_dir.dart:16: final Package package;
On 2012/05/04 17:02:07, Bob Nystrom wrote:
> I found this name confusing when I saw it being used. How about "owner" or
> something along those lines?

Done.

Powered by Google App Engine
This is Rietveld 408576698