Have `cabal target` show the impossible
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
**Describe the bug**
If the build plan does not exist then the targets that do exist but are impossible to build are not shown with `cabal target`.
**To Reproduce**
With the following `.cabal` file that is buildable, the one test suite is shown as a target.
```
$ cat build-tool-depends-twice.cabal
cabal-version: 3.0
name: build-tool-depends-twice
version: 0.1.0.0
build-type: Simple
common warnings
ghc-options: -Wall
test-suite build-tool-depends-twice-test
import: warnings
default-language: Haskell2010
type: exitcode-stdio-1.0
hs-source-dirs: test
main-is: Main.hs
build-depends: base >=4 && <5
build-tool-depends: markdown-unlit:markdown-unlit > 0.5.0 && <= 0.6
$ cabal target all:tests
...
Fully qualified target forms:
- build-tool-depends-twice:test:build-tool-depends-twice-test
Found 1 target matching all:tests.
```
If I now alter the package, adding an impossible to satisfy constraint then the target is not shown.
```diff
build-tool-depends: markdown-unlit:markdown-unlit > 0.5.0 && <= 0.6
+ build-tool-depends: markdown-unlit:markdown-unlit <0
```
```
$ cabal target all:tests
...
Error: [Cabal-7127]
Cannot target all the test suites in the project because none of the components
are available to build: the test suite 'build-tool-depends-twice-test' is not
available because the solver picked a plan that does not include the test
suites, perhaps because no such plan exists. To see the error message explaining
the problems with such plans, force the solver to include the test suites for
all packages, by adding the line 'tests: True' to the 'cabal.project.local'
file.
```
**Expected behavior**
If the target exists in the package, buildable or not, then show it as a target, maybe annotating or separately listing unbuildable ones. This would include `buildable: False` ones too.
Contributor guide
Assessment
This issue has not been assessed yet.