You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
new-build path-to-local-cabal-package does not work (?) #3318
it seems that an argument to new-build is ignored if there is ./some.cabal. Or maybe it is not, but it still tries to configure for the some package before considering the parameter (which does not make sense to me, either). Really i don't know if you are supposed to be able to new-build local paths, but then you can use new-build garbagethatdoesnotmakeanysense and get the same result.
so, you really are not supposed to new-build random stuff. it always (and only) works with the local foo.cabal or cabal.project. the documentation needs to be improved, one way or another.
Right, it lets you build things in the project. What ideally should happen when you ask to build something that's not in the package is that it should say something sensible, e.g. tell you how to add it to the project if that's what you mean to do.
As for the solving, yes that's a little tricky. Until we've run the solver we don't know if the package you're referring to might actually be a dependency of the project (in which case it is a legitimate target!), so it'd be premature to reject the target just from looking at the cabal.project file. But I can see the problem, you ask to build ./some/random/thing/not/in/the/project/ and it goes off and runs the solver for several seconds and perhaps solving fails and so it tells you about that rather than the problem with your target.
Suggestions?
I guess we can tell if a target is a file/dir rather than a package name (which is the case where it might be a dep) before running the solver. For package names however we'll have to run the solver (or at least a pre-solver) I think before we can inform you as to whether we can just build it or if you'll have to declare the package as an extra member of the project.
The behaviour of cabal v2-build /path/to/local/package and cabal v2-build garbagethatdoesnotmakeanysense is not the described in the issue:
PS D:\dev\ws\haskell\hls> cabal v2-build ..\cabal-test\
cabal.exe: Unknown target '..\cabal-test\'.
The project has no package directory '..\cabal-test\'.
PS D:\dev\ws\haskell\hls> cabal v2-build garbagethatdoesnotmakeanysense
cabal.exe: Cannot build the package garbagethatdoesnotmakeanysense, it is not
in this project (either directly or indirectly). If you want to add it to the
project then edit the cabal.project file.
Being ..\cabal-test a directory containing a cabal package.
It seems to me errors are good enough as is.
As jneira (see above), I think this can be closed: the way cabal works with these arguments is as expected. If the docs can be improved, please submit a more precise issue.
Activity
lspitzner commentedon Apr 11, 2016
so, you really are not supposed to new-build random stuff. it always (and only) works with the local
foo.cabalorcabal.project. the documentation needs to be improved, one way or another.dcoutts commentedon Apr 11, 2016
Right, it lets you build things in the project. What ideally should happen when you ask to build something that's not in the package is that it should say something sensible, e.g. tell you how to add it to the project if that's what you mean to do.
As for the solving, yes that's a little tricky. Until we've run the solver we don't know if the package you're referring to might actually be a dependency of the project (in which case it is a legitimate target!), so it'd be premature to reject the target just from looking at the cabal.project file. But I can see the problem, you ask to build ./some/random/thing/not/in/the/project/ and it goes off and runs the solver for several seconds and perhaps solving fails and so it tells you about that rather than the problem with your target.
Suggestions?
I guess we can tell if a target is a file/dir rather than a package name (which is the case where it might be a dep) before running the solver. For package names however we'll have to run the solver (or at least a pre-solver) I think before we can inform you as to whether we can just build it or if you'll have to declare the package as an extra member of the project.
jneira commentedon Sep 25, 2020
The behaviour of
cabal v2-build /path/to/local/packageandcabal v2-build garbagethatdoesnotmakeanysenseis not the described in the issue:Being
..\cabal-testa directory containing a cabal package.It seems to me errors are good enough as is.
//cc @phadej
ulysses4ever commentedon Sep 29, 2022
As jneira (see above), I think this can be closed: the way cabal works with these arguments is as expected. If the docs can be improved, please submit a more precise issue.
Mikolaj commentedon Oct 20, 2022
In the absence of further comments, let me close this. Thank you all!