`cabal new-build [all]` fails to honour `--dependency-only`
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
#3815 implemented `--dependency-only` handling, but didn't yet properly handle the implicit build-all `cabal new-build --dep` case as was pointed out in https://github.com/haskell/cabal/pull/3815#issuecomment-246097359 (relevant part quoted below).
This can be workarounded for now by using `--dependency-only` with explicitly named targets rather than the implicit "all" target.
---
@dcoutts This seems to work nice, except for the `cabal new-build` case when using a `cabal.project` file (and no `.cabal` file in the top-level folder & with CWD=top-level-folder) and thus causing it to implicitly build all packages: in this case `cabal new-build --deps` seems to consider nothing to be a dependency goal, e.g.
```
$ cd /tmp/foo
$ cabal get uhttpc-0.1.1.0
Unpacking to uhttpc-0.1.1.0/
$ echo "packages: uhttpc-0.1.1.0" > cabal.project
$ cabal new-build --dry
Resolving dependencies...
In order, the following would be built (use -v for more details):
- bytestring-lexing-0.5.0.2 (lib:bytestring-lexing, lib:bytestring-lexing) (requires build)
- uhttpc-0.1.1.0 (lib) (first run)
- uhttpc-0.1.1.0 (exe:uhttpc-bench) (first run)
$ cabal new-build --dep
Up to date
```
Contributor guide
Research direction
Start with the `cabal new-build` command path and reproduce the case using a top-level `cabal.project` file without a `.cabal` file, then compare explicit targets with the implicit build-all target. Focus on how `--dependency-only` is handled for that implicit target. Done means `cabal new-build --dep` selects the dependency goals instead of reporting `Up to date`.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- build-system, cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100