Skip to content

new-build path-to-local-cabal-package does not work (?) #3318

Closed

Description

@lspitzner

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.

Activity

  1. added
    cabal-install: v2-build system
    on Apr 11, 2016
  2. lspitzner commented on Apr 11, 2016

    @lspitzner
    CollaboratorAuthor

    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.

  3. dcoutts commented on Apr 11, 2016

    @dcoutts
    Contributor

    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.

  4. jneira commented on Sep 25, 2020

    @jneira
    Member

    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.

    //cc @phadej

  5. ulysses4ever commented on Sep 29, 2022

    @ulysses4ever
    Collaborator

    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.

  6. Mikolaj commented on Oct 20, 2022

    @Mikolaj
    Member

    In the absence of further comments, let me close this. Thank you all!

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    cabal-install: v2-build systemtype: bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions