Support for `setup-tool-depends`
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
I just ran into a case in https://github.com/google/proto-lens/issues/110#issuecomment-318984283 which requires us to specify a `build-tool-depend`-style dependency for `custom-setup`, as Setup.hs needs to be able to execute the `proto-lens-protoc` tool provided by the `proto-lens-protoc` package.
I originally mistook #4047 for providing this feature, but then I realized this is subtly different (because #4047 is about replacing Setup.hs with an externally provided executable, while this is merely about the ability to specify dependencies on `exe` components); so we'd like to say something like
```
custom-setup
setup-depends: base >= 4.8 && < 4.11, proto-lens-protoc == 0.2.*
setup-tool-depends: proto-lens-protoc:proto-lens-protoc == 0.2.*
```
```hs
-- Setup.hs
import Data.ProtoLens.Setup -- from lib:proto-lens-protoc
-- executes proto-lens-protoc:exe:proto-lens-protoc
main :: IO ()
main = defaultMainGeneratingProtos "tests"
```
----
PS: it appears that `build-tool-depends` in non-setup stanzas makes an executable available to `Setup.hs` via $PATH, even though that wasn't obvious to me from the log-output, as the last environment-dump before `setup` is executed didn't show it in the $PATH. So it seems the environment dumped only applied to the `ghc --make Setup.hs` invocation, but the `setup` invocation used a different not-shown environment.
However, this also means we can actually fake #4047 already now with a trivial `Setup.hs` (which needs at most `base` and `process`) which merely re-executes an external executable imported via `build-tool-depends`
Contributor guide
Assessment
This issue has not been assessed yet.