commercialhaskell / commercialhaskell/stack

Move build-tool dependency logic earlier, into package promotion / snapshot loading

Open
#3,777 3 comments 0 reactions 0 assignees View on GitHub
type: bug
Dominant language
Haskell
Stars
4.1k
Forks
850
Avg merge
10h 37m
Merged PRs (30d)
4

Description

See this WIP branch - https://github.com/commercialhaskell/stack/tree/fix-finding-promoted-build-tools-3733 - it is intended to solve #3733, but it doesn't quite work.

What it does is add info about executables to every member of `SourceMap`, such that the tool map can be computed from the source map. Previously, the tool map was only using packages from the snapshot or the user's local packages. It was not taking into account snapshot packages that have been promoted to local

However, this doesn't quite cut it, with this change, doing `stack build hlint` in stack's directory triggers this assertion in ConstructPlan:

```haskell
-- An assertion to check for a recurrence of
-- https://github.com/commercialhaskell/stack/issues/345
(assert (destLoc == piiLocation ps) destLoc)
```

The issue is that `happy` is treated as a dep of `haskell-src-exts`, but the snapshot promotion logic thinks it can be installed to the snapshot DB.

I think the solution is to move the resolution of build tool ExeName to PackageName into snapshot loading (possibly in `calculatePackagePromotion`?), deferring any warnings associated with resolving these. These warnings can later be outputted if used in plan construction. This would allow for build tool dependencies to cause package promotion.

What do you think, @snoyberg ?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.