Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The PUB_CACHE have moved. #4882

Merged
merged 9 commits into from
May 23, 2023
Merged

Conversation

jonasfj
Copy link
Member

@jonasfj jonasfj commented May 15, 2023

This migration started in Dart 2.8.0, since then we've used the old
location of the PUB_CACHE if it already existed at that location.
But users who have started using Dart since 2.8.0 should be unaffected
as we started creating the PUB_CACHE in the new location, when no
PUB_CACHE was present anywhere.
@atsansone atsansone added the review.await-update Awaiting Updates after Edits label May 15, 2023
@jonasfj jonasfj force-pushed the document-pub-cache-movement branch from a498d35 to 5b83f5d Compare May 16, 2023 13:46
@jonasfj jonasfj force-pushed the document-pub-cache-movement branch from f4af388 to 7400fea Compare May 16, 2023 13:48
Comment on lines 599 to 603
* Ending backwards compatibility for the old location of pub-cache on Windows.
Prior to Dart 3 `%APPDATA%\Pub\Cache` was a fallback location for pub-cache.
As of Dart 3, the default pub-cache is always `%LOCALAPPDATA%\Pub\Cache`.
If you have added globally activated packages to your `PATH`, you may wish
to update `PATH` to contain `%LOCALAPPDATA%\Pub\Cache\bin`.
Copy link
Contributor

@atsansone atsansone May 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Clean up for length, clarity, and active voice.

Suggested change
* Ending backwards compatibility for the old location of pub-cache on Windows.
Prior to Dart 3 `%APPDATA%\Pub\Cache` was a fallback location for pub-cache.
As of Dart 3, the default pub-cache is always `%LOCALAPPDATA%\Pub\Cache`.
If you have added globally activated packages to your `PATH`, you may wish
to update `PATH` to contain `%LOCALAPPDATA%\Pub\Cache\bin`.
* Ending backwards compatibility for the old location of pub-cache on Windows.
Prior to Dart 3, `%APPDATA%\Pub\Cache` was a fallback location for pub-cache.
Starting with Dart 3, the default pub-cache is located at `%LOCALAPPDATA%\Pub\Cache`.
If you [added a package][] to your `PATH` as a command line app,
to update `PATH` to contain `%LOCALAPPDATA%\Pub\Cache\bin`.
[added a package]: /tools/pub/cmd/pub-global

Copy link
Member Author

@jonasfj jonasfj May 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

   If you [added a package][]  to your `PATH` as a command line app,
   to update `PATH` to contain `%LOCALAPPDATA%\Pub\Cache\bin`.

You can do dart pub global activate <package>.

If the <package> being activated contains and executable section in pubspec.yaml, then executable files will be created in $PUB_CACHE/bin.

Thus, if you do dart pub global activate mono_repo you can execute: $PUB_CACHE/bin/mono_repo.
But the executable mono_repo is only available on PATH if you've added $PUB_CACHE/bin to PATH.

So I wouldn't really say that "you have added a package to your PATH".

What you did was:

  • (a) Globally activate one or more packages (which contains an executable section).
  • (b) Added $PUB_CACHE/bin to PATH.

We're trying to suggest that if you did (b), then action may be warranted.

"you have added a package to your PATH"

Implies to me that there was some action you did that added a package to PATH.

I suggest using the term "added globally activated packages to PATH" because it might remind the user of that time they modified PATH in order to get globally activated packages working without having to type dart pub global run <package>.

Note. I figured that referring to "globally activated packages", because it's usually dart pub global activate <package> that will be print a notice suggesting you update your PATH by adding ...\path\to\pub-cache\bin to PATH.


We could also change the line to:

If you previously added path\to\pub-cache\bin to PATH you may wish to update PATH to contain %LOCALAPPDATA%\Pub\Cache\bin.

Intentionally, avoiding to use the qualifier "If you previously added %APPDATA\Pub\Cache\bin", because while doing so might work, it's quite likely that users actually added the absolute path (e.g. c:\path\to\pub-cache\bin) to PATH.

I think it's viable to argue that path\to\pub-cache\bin can be a stand-in for both:

  • %APPDATA\Pub\Cache\bin, and,
  • c:\path\to\pub-cache\bin.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you [added a package][] to your PATH as a command line app,
to update PATH to contain %LOCALAPPDATA%\Pub\Cache\bin.

I don't think "added a package to your PATH" is a good description of what might have happened.

You can't add a package, only the executables declared within a package. This happens when you globally activate a package.
But the action that is concerning is "adding globally activated packages to PATH".

Which is really a shorter variant of "adding all executables from globally activated packages to PATH".

Copy link
Contributor

@atsansone atsansone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jonasfj : A small update. I'll approve once fixed.

Copy link
Contributor

@atsansone atsansone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed issue to suggestion. LGTM % suggestion.

@atsansone atsansone added st.RFM.% Ready to Merge but has suggestions and removed review.await-update Awaiting Updates after Edits labels May 22, 2023
@jonasfj
Copy link
Member Author

jonasfj commented May 23, 2023

Let's ship this, the goal was the help Dart 3 migration -- and we shipped Dart 3 a while ago 🤣

Copy link
Member

@parlough parlough left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@parlough parlough merged commit 19a68f2 into dart-lang:main May 23, 2023
rmacnak-google pushed a commit to rmacnak-google/site-www that referenced this pull request Sep 5, 2023
Context: dart-lang/sdk#52386

---------

Co-authored-by: Anthony Sansone <[email protected]>
Co-authored-by: Parker Lougheed <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
st.RFM.% Ready to Merge but has suggestions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants