-
Notifications
You must be signed in to change notification settings - Fork 229
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
dart pub global activate
rebuilding unnecessarily
#4334
Comments
Summary: The user is experiencing unnecessary rebuilds of a custom tool ( |
@liamappelbe feel free to share a minimally reproduciable example. Actually if you're activating from path I wouldn't be surprised if we throw away the precompilation everytime. But double resolution of dependencies is weird 🤣 Also include |
Minimal example: dart create -t cli testcli
dart pub global activate --source path testcli
dart pub global run testcli
dart pub global run testcli # Rebuilds unnecessarily Dart version: |
When you are activating from path, the package is considered "mutable" so we rebuild the executable each time. We should though be using incremental compilation, so the second build should be much faster - are you seeing that?
Yeah - that seems wrong. I was however not able to reproduce this.
@liamappelbe can you give a simple reproduction of the reresolution of dependencies? As a workaround for
This will activate a static view of the testcli package (and thus not reflect local updates to the package without reactivation). |
Also note that the "Building package executable... " output from pub is suppressed when no terminal is attached to the process. |
Could we add a flag to
The build is small enough that I'm not noticing any difference between the first and second runs. It's about 2 seconds each time to build and execute the script (this is true of both the testcli example, and my qq script). If I write a bash script that just checks whether the snapshot exists, and runs it directly if it does, then the time reduces to 1 second (and I don't get spurious prints). But I think it'd be better if this behavior was simply a flag in the activate command.
Not really. It seems to just happen randomly on my Mac. The steps I outlined above are enough to reproduce it flakily on my Mac. |
Stop treating developers like they’re incapable of making informed decisions. We know exactly what we’re doing when we activate from a path, and we don’t need this unnecessary hand-holding. The fact that future changes to the source won’t be reflected in the activated executable? Yeah, we can grasp that concept perfectly fine. I want to be in full control of what's displayed on my screen. I don’t need the system cluttering it with unnecessary info or decisions I didn’t ask for. I actually prefer to manage things myself—like any normal developer would. Add a flag to disable rebuilding, or better yet, don’t rebuild at all. |
I've used
dart pub global activate
to make a tool usable directly from the command line. It works, but it's rebuilding the tool every time I invoke it. The tool (named qq) is just a thin git wrapper I wrote, customized to my workflow. It's unpublished, I just clone its git repo.Here's an example output. It says
Building package executable... Built qq:qq
every time I invoke it:My Dart SDK comes from Flutter. My Flutter SDK is from a cloned git repo:
The text was updated successfully, but these errors were encountered: