-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stack_snapshot use executable components in tools attribute #1305
Conversation
Tested on the |
7943a1d
to
07a9e1c
Compare
b511a61
to
9b3a495
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks fine, but I don't see in the PR where these executables are being called. What does their label look like?
The user facing labels are the ones generated by #1304, e.g. |
stack_snapshot now builds alex automatically as needed
This allows to distinguish library and tool dependencies in the generated packages.bzl file. Otherwise, users of that file will encounter errors when a package exports an executable component but not a library component.
Closes #1306
Uses executable components of package dependencies in the
tools
attribute in Cabal targets generated bystack_snapshot
. E.g. we no longer need to buildalex
andhappy
outside ofstack_snapshot
to then pass them in viastack_snapshot
'stools
attribute. Instead,stack_snapshot
will generate targets@stackage-exe//alex
and@stackage-exe//happy
and pass them into thetools
attribute of any generatedhaskell_cabal_*
target that depends onalex
orhappy
respectively.A use-case where this becomes very useful is the tool
c2hs
. Contrary toalex
orhappy
it does itself depend on Hackage packages, e.g.language-c
. Meaning, if someone wants to include a package that depends onc2hs
in astack_snapshot
call, saygrpc-haskell-core
, then one has to first buildc2hs
separately. To achieve that one has to define a separatestack_snapshot
for the dependencies ofc2hs
. This approach does not scale very well. With this PR the issue is avoided, asstack_snapshot
will generate@stackage-exe//c2hs
itself and pass it togrpc-haskell-core
automatically.The
tools
attribute tostack_snapshot
is still available in case users do wish to provide external tools, e.g. a Nix providedalex
binary. We keep an externally providedalex
inrules_haskell
'sstack_snapshot
as a test-case for this.This also simplifies the
start
script, as it is no longer a common use-case to have to provide an externally built tool.