Flag field in cabal.project package stanza does not apply to build tools
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
**Describe the bug**
The solver doesn't seem to take into account constraints placed on packages in build-tool-depends.
**To Reproduce**
With the following cabal file & the cabal.project file:
--- chc.cabal
```cabal
cabal-version: 3.6
name: chc
version: 0.1.0.0
author: pranaysashank
maintainer: pranaysashank@gmail.com
executable chc
main-is: Main.hs
build-depends: base ^>=4.16.0.0
build-tool-depends: happy:happy ^>=1.21.0
hs-source-dirs: app
default-language: Haskell2010
```
```
-- cabal.project
packages: ./
package happy
flags: -bootstrap
```
```
$ cabal v2-build
Resolving dependencies...
Build profile: -w ghc-9.2.1 -O1
In order, the following will be built (use -v for more details):
- happy-1.21.0 (exe:happy) (requires build)
- chc-0.1.0.0 (exe:chc) (first run)
Starting happy-1.21.0 (exe:happy)
Building happy-1.21.0 (exe:happy)
Failed to build exe:happy from happy-1.21.0.
Build log (
/home/pranaysashank/.cabal/logs/ghc-9.2.1/happy-1.21.0-e-happy-60bda9d03a0488981bf080d8b712a1922aef99a5d52432048bbaabc1659bece1.log
):
Configuring executable 'happy' for happy-1.21.0..
Preprocessing executable 'happy' for happy-1.21.0..
cabal: The program 'happy' is required but it could not be found
cabal: Failed to build exe:happy from happy-1.21.0 (which is required by
exe:chc from chc-0.1.0.0). See the build log above for details.
```
**Expected behavior**
Expect the build to succeed with `happy` package built with `-bootstrap` flag.
**System information**
- Operating system: nixos
- `cabal`: 3.6.0.0, master
- `ghc`: ghc-9.2.1
Contributor guide
Assessment
This issue has not been assessed yet.