-
Notifications
You must be signed in to change notification settings - Fork 711
'cabal build' implies 'cabal configure'; 'cabal test' and 'cabal bench' imply 'cabal build' #997
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
I'm really excited about this change. Could you please rebase the edits you make so you still end up with three commits? Thanks! |
@tibbe I made the changes you requested, so that calling 'cabal build' alone does not enable tests or benchmarks. I didn't realize it would delete your comments when I pushed the rebased edits (sorry!). I think I addressed all of the issues, though. |
Something is not right. This works:
but this doesn't
|
I can't seem to reproduce this problem; in both cases, unordered-containers builds correctly for me! Is it possible that you have some changes from another branch mixed in? I've also tried pulling in the upstream changes since I originally wrote the patches, but it still works fine. |
I just repulled your branch to make sure and the problem remains. This his how I built the cabal-install binary:
Here's the output of
|
I started from scratch by deleting my |
I don't think so. The I think I've identified the issue: cabal test seems to imply |
Can you explain what the difference between this pull request and request #995 is? |
@kosmikus This pull request is a subset of #995. #995 would have e.g. I will close #995 for now, until we agree on the design. |
Yes, that's it! Thank you. The problem is that I'm configuring with (I feel silly that I didn't notice this, because I've run into this problem before; the actual default flags for commands are only incidentally related to their default flags in |
OK, I fixed the commits. Apparently, the correct way to get the default |
verbosity = fromFlagOrDefault normal (buildVerbosity buildFlags) | ||
|
||
reconfigure verbosity distPref mempty [] globalFlags (const Nothing) | ||
build verbosity distPref buildFlags extraArgs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a place where Cabal and cabal-install are very inconsistent. If you run ./Setup build
, the default BuildFlags
are defaultBuildFlags
. Prior to my patches, cabal build
used mempty
for the default BuildFlags
because buildCommand
was invoked using wrapperAction
, which overrides each command's default flags, using mempty
instead.
Here's the rub: on L143, I use buildCommand
unmodified, which means that with my patches in their current state, cabal build
uses defaultBuildFlags
. However, cabal test
and cabal bench
use mempty
. In summary,
Before:
./setup build
usesdefaultBuildFlags
cabal build
usesmempty
After:
./Setup build
usesdefaultBuildFlags
cabal build
usesdefaultBuildFlags
cabal test
andcabal bench
usemempty
I assume I should change the behaviour of my patch to respect the prior behaviour of cabal build
and ignore the behaviour of ./Setup build
entirely?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume I should change the behaviour of my patch to respect the prior behaviour of
cabal build
and ignore the behaviour of./Setup build
entirely?
Yes please.
You're right, the commit message does need to be changed. I'll do that as soon as I get feedback on the The problem with
I have to admit that when the second issue occurred to me, I didn't initially think it was a big deal because I assumed that any errors would cause configuration to fail, prompting the user to reconfigure manually and avoiding later disaster. That is obviously not the case. Now I'm thinking that this whole thing is for nought without a way to save Edit: On second thought, I don't actually need to do anything about the first problem. Those flags only affect |
Change the behavior of 'cabal build' to automatically run 'cabal configure' if the package in the current directory has never been configured or if the configuration is outdated. In the former case, use the default options or in the latter case, use the most recently used options.
Package will be reconfigured with test suites enabled, if necessary.
Regarding (2) above, is the behavior you've implemented any worse than what I think we should definitely start a discussion with Duncan about (2) e.g. on the [email protected] mailing list, but as long the new behavior of |
Package will be reconfigured with benchmarks enabled, if necessary.
No, I just pushed the updated patches. While I was patching, I noticed that there was a corner case where the user was not advised to reconfigure manually if automatic reconfiguration failed, so I took care of that, too. I'm writing up that message to the mailing list now, so that will go out later today. |
In that case I think you can go ahead and push your patches to the master branch (which will close this pull request). The new behavior is an improvement to the past behavior and we can always improve it further in the future, when we resolved the |
'cabal build' reconfigures if necessary or configures with default options if the package has never been configured. 'cabal test' and 'cabal bench' configure or reconfigure and rebuild the package as necessary.
These commits improve the user interface of the cabal-install tool by automatically running 'configure' before 'build' as necessary and by running
build
beforetest
andbench
. The end result is thatcabal unpack foo; cd foo; cabal test
very probably does what the user expects.The commits for running
build
beforetest
andbench
are largely plumbing. The first commit, which runsconfigure
beforebuild
, has a bit of convoluted logic to decide whatConfigFlags
to use when reconfiguring.