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
Flutter-specific pub cache causes issues #53833
Comments
|
Some more context: I'm not sure that we're getting a lot of mileage out of the bundled pub cache. This will only help developers with an offline mode until they add their first plugin, then they need to pull dependencies for Gradle/Cocoapods too |
|
I would like to retain the property that the SDK bundles contain most or all of what needs to be downloaded from Flutter/Dart to get started. As noted elsewhere, there was a measurable uptick in retention concomitant with that change. This implies that the first time the tool runs from an SDK bundle, it will need to do some surgery to migrate to |
The safest option is for you to create a tarball containing a pre-populated Beware that there is special tricks on place on Windows. You can also extract specific package tarballs into |
|
One case where this hydration strategy worsens the situation is when a user had previously tried Flutter or Dart and has a pub cache as a result. I don't have an idea of how common this would be, but we could avoid making the situation worse if there were a way to populate an existing cache. @jonasfj though I don't think the cache structure of pub is necessarily a public API, we do ship the flutter tool in lockstep with pub. Would it be reasonable for the tool to make some assumptions here and still preserve safety? |
I would suggest not populating the cache if there is already one present. In this case it's likely many of the packages are already there :D
We can probably promise that if the Hence, if you only create the cache when no |
|
This is likely contributing to Dart analyzer performance issues for mono-repo projects where |
|
Can you elaborate, @jacob314 ? |
|
TLDR: The analyzer relies on absolute file system paths to determine whether two versions of a package are the same. If your mono-repo has two pub cache directories, 2X the memory and CPU is used for resolving packages that are used from both pub cache directories. If you have a mono-repo with some Dart packages (for example: |
|
After having a discussion with @jacob314. @christopherfujino and I believe the best approach to handle this case is to copy your pub cache located at |
|
Yes, I think something like that makes sense; WDYT @jonasfj ? |
Love it! Not having two |
|
breadcrumbs: before implementing this, further discussion is needed to find a good strategy for testing the migration |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

Our package archives pre-caches packages in
$FLUTTER_ROOT/.pub-cache, whereas normal Pub behavior is to use$HOME/.pub-cache. This causes a number of issues:pub global activatepackages with commands available from$PATHThe existence of and support for
$FLUTTER_ROOT/.pub-cachesupports the "offline" Flutter tool usage (e.g.flutter create --offline) as well as lowering the number of "post-installation" downloads the user has to suffer. But given that we don't advertise the--offlineflag very well, many users aren't gaining its benefit. This leaves us with all the pain of the solution and little of the gain.Two things we could do to improve this:
$FLUTTER_ROOT/.pub-cacheto$HOME/.pub-cachewhen it detects its existence.--offlineif their command fails due to lack of connectivity.The text was updated successfully, but these errors were encountered: