Open
Description
Describe the bug
I find this error message confusing. It describes two situations. Could we have a specific error message for each situation instead?
There is no <pkgname>.cabal package file or cabal.project file.
To Reproduce
Perform cabal init
then touch cabal.project
but keep the project empty.
$ cabal build all --enable-tests --enable-benchmarks
Warning: There are no packages or optional-packages in the project
Error: [Cabal-7136]
There is no <pkgname>.cabal package file or cabal.project file. To build
packages locally you need at minimum a <pkgname>.cabal file. You can use 'cabal
init' to create one.
For non-trivial projects you will also want a cabal.project file in the root
directory of your project. This file lists the packages in your project and all
other build configuration. See the Cabal user guide for full details.
Now go to an empty directory and run the same command.
$ cabal build all --enable-tests --enable-benchmarks
Error: [Cabal-7136]
There is no <pkgname>.cabal package file or cabal.project file. To build
packages locally you need at minimum a <pkgname>.cabal file. You can use 'cabal
init' to create one.
For non-trivial projects you will also want a cabal.project file in the root
directory of your project. This file lists the packages in your project and all
other build configuration. See the Cabal user guide for full details.
Notice the difference?
- Warning: There are no packages or optional-packages in the project
Error: [Cabal-7136]
There is no <pkgname>.cabal package file or cabal.project file. To build
packages locally you need at minimum a <pkgname>.cabal file. You can use 'cabal
init' to create one.
For non-trivial projects you will also want a cabal.project file in the root
directory of your project. This file lists the packages in your project and all
other build configuration. See the Cabal user guide for full details.
Expected behavior
Error with one of these messages instead or something similar:
- The cabal.project file is empty. It needs to contain at least one package or optional-package.
- The cabal.project file contains no packages or optional-packages. At least one is needed.
- There is no .cabal package file. To build packages locally you'll need one and can use 'cabal init' to create a package.
- There are .cabal package files in child directories. Do you have a cabal.project file in another directory (preferably above) packages in your project?
System information
I have cabal-install
built from source at e3fd74c on ubuntu 23.10.
$ cabal --version
cabal-install version 3.11.0.0
compiled using version 3.11.0.0 of the Cabal library
Activity