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

Issue 428313004: Support activating packages from local paths. (Closed)

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

Description

Support activating packages from Git and local paths. BUG=https://code.google.com/p/dart/issues/detail?id=19902 Committed: https://code.google.com/p/dart/source/detail?r=38798 R=nweiz@google.com Committed: https://code.google.com/p/dart/source/detail?r=38945

Patch Set 1 #

Total comments: 41

Patch Set 2 : Revise and rebase. #

Patch Set 3 : Fix deactivate. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+480 lines, -144 lines) Patch
M sdk/lib/_internal/pub/lib/src/command/global_activate.dart View 1 1 chunk +39 lines, -17 lines 0 comments Download
M sdk/lib/_internal/pub/lib/src/command/global_deactivate.dart View 1 2 2 chunks +5 lines, -1 line 0 comments Download
M sdk/lib/_internal/pub/lib/src/global_packages.dart View 1 2 6 chunks +177 lines, -65 lines 0 comments Download
M sdk/lib/_internal/pub/lib/src/source/path.dart View 1 5 chunks +22 lines, -7 lines 0 comments Download
A sdk/lib/_internal/pub/test/global/activate/activate_hosted_after_path_test.dart View 1 1 chunk +43 lines, -0 lines 0 comments Download
A sdk/lib/_internal/pub/test/global/activate/activate_path_after_hosted_test.dart View 1 1 chunk +41 lines, -0 lines 0 comments Download
M sdk/lib/_internal/pub/test/global/activate/bad_version_test.dart View 1 1 chunk +4 lines, -2 lines 0 comments Download
A + sdk/lib/_internal/pub/test/global/activate/constraint_with_path_test.dart View 1 1 chunk +7 lines, -5 lines 0 comments Download
M sdk/lib/_internal/pub/test/global/activate/different_version_test.dart View 1 1 chunk +1 line, -1 line 0 comments Download
A sdk/lib/_internal/pub/test/global/activate/does_not_install_dependencies_for_path_test.dart View 1 1 chunk +29 lines, -0 lines 0 comments Download
M sdk/lib/_internal/pub/test/global/activate/missing_package_arg_test.dart View 1 1 chunk +5 lines, -4 lines 0 comments Download
A sdk/lib/_internal/pub/test/global/activate/path_package_test.dart View 1 1 chunk +25 lines, -0 lines 0 comments Download
M sdk/lib/_internal/pub/test/global/activate/same_version_test.dart View 1 1 chunk +1 line, -1 line 0 comments Download
M sdk/lib/_internal/pub/test/global/activate/unexpected_arguments_test.dart View 1 1 chunk +5 lines, -4 lines 0 comments Download
D sdk/lib/_internal/pub/test/global/deactivate/deactivate_package_test.dart View 1 chunk +0 lines, -19 lines 0 comments Download
A + sdk/lib/_internal/pub/test/global/deactivate/hosted_package_test.dart View 1 1 chunk +1 line, -1 line 0 comments Download
A sdk/lib/_internal/pub/test/global/deactivate/path_package_test.dart View 1 1 chunk +27 lines, -0 lines 0 comments Download
A sdk/lib/_internal/pub/test/global/run/missing_path_package_test.dart View 1 1 chunk +31 lines, -0 lines 0 comments Download
A + sdk/lib/_internal/pub/test/global/run/reflects_changes_to_local_package_test.dart View 1 1 chunk +10 lines, -9 lines 0 comments Download
A + sdk/lib/_internal/pub/test/global/run/runs_path_script_test.dart View 1 1 chunk +7 lines, -8 lines 0 comments Download

Messages

Total messages: 9 (0 generated)
Bob Nystrom
6 years, 4 months ago (2014-07-31 00:00:11 UTC) #1
nweiz
There should be tests for activating a package from git before activating it from another ...
6 years, 4 months ago (2014-07-31 20:01:54 UTC) #2
Bob Nystrom
Committed patchset #1 manually as r38798 (presubmit successful).
6 years, 4 months ago (2014-07-31 21:00:43 UTC) #3
Bob Nystrom
On 2014/07/31 21:00:43, Bob Nystrom wrote: > Committed patchset #1 manually as r38798 (presubmit successful). ...
6 years, 4 months ago (2014-07-31 22:26:27 UTC) #4
Bob Nystrom
On 2014/07/31 22:26:27, Bob Nystrom wrote: > I'll respond to the code review here and ...
6 years, 4 months ago (2014-07-31 22:27:26 UTC) #5
Bob Nystrom
https://codereview.chromium.org/428313004/diff/1/sdk/lib/_internal/pub/lib/src/command/global_activate.dart File sdk/lib/_internal/pub/lib/src/command/global_activate.dart (right): https://codereview.chromium.org/428313004/diff/1/sdk/lib/_internal/pub/lib/src/command/global_activate.dart#newcode16 sdk/lib/_internal/pub/lib/src/command/global_activate.dart:16: String get usage => "pub global activate [--source source] ...
6 years, 4 months ago (2014-08-04 23:41:52 UTC) #6
nweiz
lgtm https://codereview.chromium.org/428313004/diff/1/sdk/lib/_internal/pub/lib/src/global_packages.dart File sdk/lib/_internal/pub/lib/src/global_packages.dart (right): https://codereview.chromium.org/428313004/diff/1/sdk/lib/_internal/pub/lib/src/global_packages.dart#newcode196 sdk/lib/_internal/pub/lib/src/global_packages.dart:196: "version ${log.bold(id.version)}."); On 2014/08/04 23:41:50, Bob Nystrom wrote: ...
6 years, 4 months ago (2014-08-05 19:14:42 UTC) #7
Bob Nystrom
Committed patchset #3 manually as 38945 (presubmit successful).
6 years, 4 months ago (2014-08-06 20:19:57 UTC) #8
Bob Nystrom
6 years, 4 months ago (2014-08-06 20:21:14 UTC) #9
Message was sent while issue was closed.
https://codereview.chromium.org/428313004/diff/1/sdk/lib/_internal/pub/test/g...
File
sdk/lib/_internal/pub/test/global/activate/does_not_install_dependencies_for_path_test.dart
(right):

https://codereview.chromium.org/428313004/diff/1/sdk/lib/_internal/pub/test/g...
sdk/lib/_internal/pub/test/global/activate/does_not_install_dependencies_for_path_test.dart:23:
output: "Activated foo 1.0.0.");
On 2014/08/05 19:14:42, nweiz wrote:
> On 2014/08/04 23:41:51, Bob Nystrom wrote:
> > On 2014/07/31 20:01:54, nweiz wrote:
> > > This doesn't seem like the behavior users would want. It seems like, if
the
> > > dependencies haven't yet been installed for a path package, they should be
> > when
> > > that package is activated.
> > 
> > When you activate a package at a path, it relies on the lock file in that
> > directory. I felt like implicitly running pub get in *that* directory when
you
> > want pub global activate wasn't the behavior users would expect, but if we
> don't
> > do that, we can't install the dependencies.
> > 
> > In practice, I don't think it matters much: most users activating a package
at
> a
> > path will already have a lockfile which implies they'll already have the
> > dependencies. If they don't, pub global run *will* implicitly run pub get.
> > 
> > I think it's useful for pub global activate to eagerly pull down
dependencies
> > when you activate remote (hosted/git) packages because you may be about to
go
> > offline. But for path packages, you probably have the deps already and/or
know
> > what you're doing, so it's less important to do the get eagerly.
> > 
> > You're right that this is a semantically strange corner case. I added this
> test
> > specifically to track the current behavior since I didn't realize it at
first
> > either. If you think it makes sense to implicitly run pub get on the
activated
> > directory, I could be persuaded.
> 
> I think it does. Think about what happens with the current behavior if you run
> "pub global run" after activating a path package. Either it will install the
> dependencies before running, in which case that's very similar to just
> installing them eagerly when the package is activated; or it will break due to
> lack of dependencies, which really hoses the use case of installing a package
> from a tarfile (or whatever).

I'm convinced. I realized that pub build and serve will implicitly run pub
get--including overwriting your lockfile too--so it doesn't seem inconsistent to
do so here.

Done.

Powered by Google App Engine
This is Rietveld 408576698