-
Notifications
You must be signed in to change notification settings - Fork 701
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
cabal-install 3.8.1.0 regression: can't control the order of hs-source-dirs anymore #8458
Comments
Thank you for the report! I don’t see anything related to preprocessing in release notes, so collateral damage, it seems. In the absence of any informed guesses, it’d be interesting to compare build outputs ran with |
Diff
Edit: I disabled syntax highlighting because it kind of falls apart with long lines. |
Cool, thanks! If anyone wants to stare it in a nice two-column mode, here's a version of it. |
Key lines seem to be:
For some reason it now picks |
As you say, the culprit seems to be the different ordering: if you look at the previous line, it differs in |
Indeed, in 3.6 it makes a difference, in 3.8 it doesn't. |
This part in particular: cabal/Cabal/src/Distribution/Simple/Build.hs Lines 476 to 481 in 9b300f3
|
The affected project relied on an undocumented feature where cabal searches for modules in |
Yeah, I agree it should be fixed, and also backported. It looks like it only kicks in when there's a preprocessor? I'll note that when I added it, it was in line with all the other "addExtra" stuff in that preprocessor module, all of which sorts and hence loses the order in which things were entered. Arguably we should move to using an |
See haskell/cabal#8458 for details. Basically, cabal-install 3.8.1.0 sorts source-dirs and then picks the first matching module from that list whereas it'd respect the order in the source file before. This caused it to pick up server/Main.hs over test/Main.hs when building the test suite, failing the build.
See haskell/cabal#8458 for details. Basically, cabal-install 3.8.1.0 sorts source-dirs and then picks the first matching module from that list whereas it'd respect the order in the source file before. This caused it to pick up server/Main.hs over test/Main.hs when building the test suite, failing the build.
Describe the bug
cabal-install
apparently seems to try to preprocess all modules inhs-source-dirs
, regardless of whether they are listed inexposed-modules
,other-modules
or required for compilation. This can lead to the build of a component failing because preprocessing of a module fails that isn't actually required to compile the component.To Reproduce
Checkout https://github.com/sternenseemann/spacecookie/tree/75275cf971197f1b1da4464b17e39129428e527b and run
cabal v2-build test
.The test suite includes the
server
directory additionally to be able to import a single internal module of the executable component (all needed modules are listed explicitly inother-modules
). This causes cabal-install since 3.8.1.0 to preprocess unrelated modules and fail (because they have aMIN_VERSION_aeson
macro that won't work if the component doesn't depend onaeson
). Withcabal-install
3.6.2.0` it is possible to build the test suite without any problems.Expected behavior
The test suite should compile successfully.
System information
cabal
3.8.1.0,ghc
9.0.2The text was updated successfully, but these errors were encountered: