haskell / cabal

Official upstream development repository for Cabal and cabal-install
https://haskell.org/cabal
Other
1.63k stars 696 forks source link

Build a lone package with `--ignore-project` #10556

Open philderbeast opened 1 week ago

philderbeast commented 1 week ago

I wanted to try cabal build with a test package for cabal-testsuite so changed to its folder and tried building it there. I was surprised that I couldn't --ignore-project. I reached for --project-dir instead and this did seem to help ignore projects higher in the directory tree.

Could we please enable --ignore-project for cabal build?

$ cd cabal-testsuite/PackageTests/Check/PackageFiles/VersionBounds

$ ls
cabal.out  cabal.test.hs  pkg.cabal

$ cabal build all --dry-run
Warning: this is a debug build of cabal-install with assertions enabled.
Configuration is affected by the following files:
- cabal.project
Resolving dependencies...
Error: [Cabal-7107]
Could not resolve dependencies:
[__0] trying: cabal-testsuite-3 (user goal)
[__1] unknown package: Cabal-hooks (dependency of cabal-testsuite)
[__1] fail (backjumping, conflict set: Cabal-hooks, cabal-testsuite)
After searching the rest of the dependency tree exhaustively,
these were the goals I've had most trouble fulfilling: cabal-testsuite, Cabal-hooks

$ cabal build all --dry-run --ignore-project
Error: cabal: unrecognized 'build' option `--ignore-project'

$ cabal build all --dry-run --project-dir=.
Warning: this is a debug build of cabal-install with assertions enabled.
Resolving dependencies...
Build profile: -w ghc-9.10.1 -O1
In order, the following would be built (use -v for more details):
 - pkg-0 (lib) (first run)
ulysses4ever commented 1 week ago

That's, unfortunately, a long-standing issue and a duplicate of https://github.com/haskell/cabal/issues/7057