-
Notifications
You must be signed in to change notification settings - Fork 841
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
Building tests can cause unnecessary recompilation #2800
Comments
+1 |
Unfortunately, this is due to behavior in Cabal that we cannot work around. When tests are enabled, it combines their dependencies. Worth investigating whether it has changed in Cabal-2.0, and opening an upstream issue about it if one doesn't already exist. |
Yeah, honestly, this has been driving me insane for years. |
We do this by matching all build configurations and always include building tests. Performing a regular build without tests and then running the tests invalidates the previous build as test dependencies are added. See: - commercialhaskell/stack#4977 (comment) - commercialhaskell/stack#2800 (comment)
We do this by matching all build configurations and always include building tests. Performing a regular build without tests and then running the tests invalidates the previous build as test dependencies are added. See: - commercialhaskell/stack#4977 (comment) - commercialhaskell/stack#2800 (comment)
See: - commercialhaskell/stack#4977 (comment) - commercialhaskell/stack#2800 (comment)
I think this one is fixed, no? |
No, I confirmed that this issue is still there on |
@mgsloan Do you know if this is still the case? Is this behavior fixed in Cabal? |
This has come up recently on Matrix. I'll post more comprehensively here later. This is more a feature request than a bug: Stack is behaving as expected. Stack does not build a package's targeted components 'separately', it builds them 'all together' (if it can), so 'build lib against dependencies X, Y' and 'build lib (and test suite) against dependencies X, Y and Z' are different builds. There is a desire to change Stack so that it thinks of building in terms of 'components (of packages)' instead of 'packages (with components)', but that change is non-trivial. I think @theobat has been giving it the most thought in recent years, and he has an open issue here: #6356. |
@mpilgrem Awesome. Thank you for the summary here. It'd be amazing to have this feature. Do you know if this package-oriented limitation is still in the Cabal library? Or is it purely a stack issue? Said another way, given the state of Cabal today, is it theoretically possible to build this component-oriented build in stack? |
@wraithm, to approach building in terms of 'components (of packages)' requires |
The following steps cause the library portion of a project to be unnecessarily recompiled:
when the testsuite has a build-depend that isn't in the library.
For example, with this cabal file:
I get the following:
I get
foo-0.1.1.0: unregistering (missing dependencies: data-default)
when the additional dependency has not yet been build, orfoo-0.1.1.0: unregistering (dependencies changed)
if the additional dependency has already been built. There's no need to unregister the library if it has already been built and I would like to additionally build the tests.The text was updated successfully, but these errors were encountered: