haskell / haskell/cabal

Is it possible to force consistent versions for a library and an associated build tool with new-build?

Open
#5,105 38 comments 1 reaction 0 assignees View on GitHub
cabal-install: solver Cabal: file format re: build-tool type: discussion type: enhancement
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

Simplified scenario: We have a library that ships with a build tool. The library and the build tool are meant to be used together and must be of the same version. With sandboxed builds you would just depend on the library and `cabal` would make sure that the build tool is available when building.

With `new-build` this approach will lead to a build failure. The user is required to specify `build-tool-depends::` to make it work. However, as far as I can tell, there is no guarantee that the build tool and the library will be of the same version.

Is there a way to achieve this without specifying exact dependency versions on both the library and build tool (say I would want to continue to use e.g. `== 2.*` instead of specifying `== 2.4.0` in two places)?

For my real use case, the library and the build tool are actually two separate packages, `hspec` and `hspec-discover`, where `hspec` depends on an exact version of `hspec-discover`.

Scope: 1.3k packages on Hackage depend on `hspec` + an unknown number of in-house projects.

Contributor guide

Open the contributing guide

Research direction

The issue names new-build and build-tool-depends but no files or tests. Start by reading the discussion and locating how new-build resolves build-tool dependencies. Done would require an agreed implementation and tests showing compatible library and build-tool versions without duplicating exact constraints.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.