haskell / cabal

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

Fake package leaking when no `[TARGETS]` #9983

Open philderbeast opened 3 weeks ago

philderbeast commented 3 weeks ago

There are quite a few fake-package issues. The user experience around this is not good when a cabal command expecting [TARGETS] is called without a target.

With https://github.com/haskell/containers/commit/c651094ec026b90c4e9d4ed81bc15eb337d3fc2e;

$ cabal repl
Resolving dependencies...
Error: [Cabal-7076]
Internal error when trying to open a repl for the package fake-package-0.
The package is not in the set of available targets for the project plan, which
would suggest an inconsistency between readTargetSelectors and resolveTargets.

$ cabal repl containers
Resolving dependencies...
Build profile: -w ghc-9.8.2 -O1
In order, the following will be built (use -v for more details):
 - containers-0.6.8 (interactive) (lib) (configuration changed)
...
Ok, 37 modules loaded.
ghci> 

There is a cabal.project that we could use to list possible [TARGETS], such as those shown by #9744.

packages:
  containers/
  containers-tests/

tests: True
benchmarks: True

-- package containers-tests
--   ghc-options: -Werror