Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inscrutable error message if cabal.project has no packages field #6013

Closed
Boarders opened this issue Apr 24, 2019 · 4 comments
Closed

Inscrutable error message if cabal.project has no packages field #6013

Boarders opened this issue Apr 24, 2019 · 4 comments

Comments

@Boarders
Copy link

If I create a project with a cabal.project file that does not list the packages field then I get the error:

cabal: 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.

I think this is not a very helpful message for the problem at hand.

@mitchellwrosen
Copy link

mitchellwrosen commented Apr 24, 2019

I believe it also does this if you write

packages:
  my-package

EDIT: Played with a parser a bit. It's this that fails with the above error message:

packages:
  .

However, this works fine:

packages: .

As does

packages:
  ./

@Boarders
Copy link
Author

To be clear, this behavior occurs if I do have a <pkgname>.cabal file and a cabal.project but fail to list the packages field in the cabal.project file.

@23Skidoo
Copy link
Member

Yep, bumped into this too.

@23Skidoo 23Skidoo added this to the 3.0 milestone Apr 26, 2019
@23Skidoo 23Skidoo modified the milestones: 3.0, 3.0.1.0 Oct 16, 2019
@phadej phadej modified the milestones: 3.0.1.0, 3.2 Nov 27, 2019
@phadej phadej self-assigned this Nov 28, 2019
@phadej phadej closed this as completed in 4e6128b Dec 15, 2019
phadej added a commit that referenced this issue Dec 15, 2019
Resolve #6013: Warn if packages and optional-packages are both empty
@phadej
Copy link
Collaborator

phadej commented Dec 15, 2019

Related: #6144

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants