Skip to content

build-tool-depends silently ignored for non-existent executable #4781

Closed

Description

@hvr

Consider the following specification,

name:                dummypkg
version:             0
build-type:          Simple
cabal-version:       >=2.0

library
  default-language: Haskell2010
  build-tool-depends: mtl:imaginary-exe

when invoking new-build, this silently succeeds. And also, plan.json doesn't record any exe-depends from dummypkg-0-inplace on mtl as it would if build-tool-depends referred to an actually existing executable:

    {
      "type": "configured",
      "id": "dummypkg-0-inplace",
      "pkg-name": "dummypkg",
      "pkg-version": "0",
      "flags": {},
      "style": "local",
      "dist-dir": ".../dist-newstyle/build/x86_64-linux/ghc-8.2.1/dummypkg-0",
      "depends": [],
      "exe-depends": [],
      "component-name": "lib"
    },

For a build-tool-depends declaration, I'd expect the solver to require the existence of that executable in the respective package as a constraint to solve for. The reason being is that packages may start out as a library, and in later releases start adding an executable. Or sometimes executables may get renamed or removed.

/cc @GrayJay @Ericson2314

Activity

  1. sebright commented on Sep 23, 2017

    @sebright
    Collaborator

    It looks like cabal doesn't solve for specific executables yet:

    -- TODO do something about the name of the exe component itself
    convExeDep :: DependencyReason PN -> ExeDependency -> LDep PN
    convExeDep dr (ExeDependency pn _ vr) = LDep dr $ Dep (IsExe True) pn (Constrained vr)

    That will probably require #4087.

  2. Ericson2314 commented on Sep 23, 2017

    @Ericson2314
    Collaborator

    @GrayJay yeah that was a stop-gap in lieu of per-component solving. Is a better solution possible now?

  3. phadej commented on Sep 23, 2017

    @phadej
    Collaborator

    Can we make specific constraints, including only versions of package with an executable requested. That should work even we don't have per-component solving

  4. Ericson2314 commented on Sep 23, 2017

    @Ericson2314
    Collaborator

    That would be nice. To be clear, this still fails on the Cabal library side of things, right? I added a bunch of tests and stuff for those failure cases.

  5. sebright commented on Sep 25, 2017

    @sebright
    Collaborator

    @Ericson2314 I don't know of a better solution now.

    @phadej Where would the constraints be specified? It seems like that would be easier to implement than complete per-component dependency solving.

  6. phadej commented on Sep 25, 2017

    @phadej
    Collaborator

    @GrayJay when the build-tool-depends executable is requested, we could elaborate that into more precise constraints than just package (+ bounds). I don't know how it happens now though :(

  7. sebright commented on Sep 25, 2017

    @sebright
    Collaborator

    I think that would need to happen in the solver, after it chooses to build a package that has a build-tool-depends dependency. That corresponds to the first tree transformation that I described under "Component dependency validation steps" in #4087 (comment). I don't think we need to add the other tree transformations as long as we continue to require the dependencies for all executables for each package.

  8. self-assigned this
    on Oct 14, 2017
  9. added 2 commits that reference this issue on Nov 11, 2017
    52a30db
    e86f838
  10. added a commit that references this issue on Nov 22, 2017
    272151f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions