haskell.nix icon indicating copy to clipboard operation
haskell.nix copied to clipboard

`cabalProject'`: Consider `cabalProjectLocal` even if `cabalProject` argument is null

Open L-as opened this issue 3 years ago • 4 comments

I haven't tested this.

L-as avatar Aug 13 '22 00:08 L-as

Motivation?

michaelpj avatar Aug 16 '22 07:08 michaelpj

Sometimes you want to use cabalProjectLocal without cabalProject? This is just a plain bug, no?

L-as avatar Aug 16 '22 20:08 L-as

Yes this is a bug. I thought it only affected hackage-project based things (that is where I found it annoying). Can you please remove the old work around here? I'm pretty sure this change will make that redundant.

hamishmack avatar Aug 17 '22 00:08 hamishmack

Does cabal accept a cabal.project.local without cabal.project?

michaelpj avatar Aug 17 '22 07:08 michaelpj

Does cabal accept a cabal.project.local without cabal.project?

It does (with a warning):

[nix-shell:~/iohk/hello-1.0.0.2]$ cabal --version
cabal-install version 3.6.2.0
compiled using version 3.6.2.0 of the Cabal library

[nix-shell:~/iohk/hello-1.0.0.2]$ ls -l cabal.project
ls: cannot access 'cabal.project': No such file or directory

[nix-shell:~/iohk/hello-1.0.0.2]$ cat cabal.project.local
packages: test

[nix-shell:~/iohk/hello-1.0.0.2]$ cabal build all
Warning: both implicit and explicit configuration is present.When using configuration(s) from /Users/hamish/iohk/hello-1.0.0.2/cabal.project.local, the following errors occurred:
The package location 'test' does not exist.

hamishmack avatar Aug 18 '22 07:08 hamishmack

Do we want the same Warning: both implicit and explicit configuration is present. warning when cabalProjectLocal is set and not cabalProject? (rather than just ignore cabalProjectLocal like this PR does?)

yvan-sraka avatar Aug 18 '22 07:08 yvan-sraka

cabal only seems to print that warning when there is an error. I think we could write the cabalProjectLocal to cabal.project.local to get the same behaviour. That is a bigger change though as it would require we correctly handle source-repository-package blocks in both files (rather than just combining them and parsing once).

hamishmack avatar Aug 18 '22 07:08 hamishmack

Good. Then please include a note explaining that this behaviour matches cabal and we tested it.

michaelpj avatar Aug 18 '22 08:08 michaelpj

I've updated the PR

L-as avatar Sep 01 '22 14:09 L-as

bors try

hamishmack avatar Sep 02 '22 00:09 hamishmack

try

Build failed:

iohk-bors[bot] avatar Sep 02 '22 00:09 iohk-bors[bot]

bors try is all green now.

hamishmack avatar Sep 02 '22 01:09 hamishmack

try

Build failed:

iohk-bors[bot] avatar Sep 02 '22 01:09 iohk-bors[bot]