-
Notifications
You must be signed in to change notification settings - Fork 711
Fix #3391: build all packages if no target is specified. #3715
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
Conversation
This behavior is probably wrong for REPL, because when you pass multiple targets to repl you get the repl brought up multiple times. Which is a bit silly. #3659 |
I notice this triggers building |
That's because pretty-show depends on happy which has a custom setup, which HEAD currently decides to pick the inplace Cabal to build with. See #3706 |
Nice! |
@ezyang then doesn't that mean we've got the wrong meaning of "all packages" here? Surely we want all packages that are local to the project, not all packages that are being built inplace. Pulling in non-local packages to get built inplace is an implementation detail and not something that should determine the default set of things to build. Note that determining local packages as opposed to inplace is not hard. |
@dcoutts, no, this behavior is unrelated to this patch; you can repro it if you just say |
Ok true, if it doesn't pick pretty-show as a target then that's fine. |
Do we really think this is what people want? That if they're in a dir with a package it'll build just that package and if they're anywhere else within the project (e.g. some random subdir, or in a top level dir that contains no .cabal file) that it'll build everything? It seems a little confusing to me. As an alternative idea: when there's nothing obvious to build, report a message saying what packages are available in the project, and mention an "all" target to build them all. I'm not strongly advocating one or another, just want to make sure we're sure this is a good idea. |
Another option which might be good for consistency is to look at what stack does. IIUC it builds all packages when you call |
I'm OK with @hesselink's plan. Do file paths work already? Relevant bug: #3318 |
I pushed a commit with @hesselink's proposed semantics. Please give it a try. |
Yes, they do. That ticket is about paths to packages that are not part of the project. |
So that behaviour is indeed more consistent, then the worry is that it's rather different behaviour from what cabal has done in the past, and that might be confusing for users. That said, we can give it a go and see what people think. |
Honestly, I like @hesselink's proposal the least (sorry!), I liked both what @ezyang implemented originally, as well as what @dcoutts proposed much better. It's quite non-intuitive to me, being used to other build-systems, which take into account the current $CWD (and are thus more DWIM-compliant). Especially since Why can't we do one of the other two suggestions? |
If |
@ezyang Only if there was some global configuration setting I could set so that |
Signed-off-by: Edward Z. Yang <[email protected]>
I reset the PR to the first proposed fix. |
@hvr No need to be sorry, I was just presenting an option :) Anything is better than having to specify all packages on the command line. IIUC right now it acts like current cabal if you're in a package dir (build that package) and builds all packages otherwise? That sounds good to me. I think the only use cases I've had are 1) build one package, either from the current dir or by name, 2) build a set of packages by names and 3) build all packages in the project. All of those are possible with this PR 👍 The only other scenario I can imagine is building a subset of packages contained in a directory tree. What happens now if you pass a path to |
Nothing like that is implemented. I'm inclined to not implement unless someone asks for it? |
I like the new behavior a lot, but that might just be because of the grooves worn into my brain by Stack. I did notice that we need a friendlier error message when running without a target in a directory with no
|
See #3636 |
I get the sense that what most people care most about is that "cabal new-build" in the 'top' directory does The Right Thing. Therefore I'm going to (somewhat arbitrarily) merge and let's see what people think after there's a little bit of practical experience with this. EDIT: Let's not forget that "new-build" is still beta in 2.0 (AFAIUI), so it's not like we need to get this perfect from the start. Btw, huge thanks to @ezyang for the ridiculous amount of code he's been pushing out! 😸 EDIT#2: Generally, I think we're spending hugely too much time bikeshedding instead of experimenting. Obviously, Cabal (the library) is special, but it seems a lot of us (including me!) are also walking on eggshells when it comes to |
Fixes #3391. CC @hesselink , @23Skidoo , @hvr, @dcoutts, @acfoltzer. Please test and report.
Signed-off-by: Edward Z. Yang [email protected]