-
Notifications
You must be signed in to change notification settings - Fork 81
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
Handling of toolchain libraries in stack_snapshot #1685
Conversation
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.
Good work, thank you!
Thank you for the test and the changelog entry!
Only some minor comments. Feel free to merge when addressed.
WORKSPACE
Outdated
( | ||
stack_snapshot( | ||
name = "stackage_asterius", | ||
local_snapshot = "@rules_haskell//tests/asterius/stack_toolchain_libraries:snapshot.yaml", | ||
packages = [ | ||
"xhtml", | ||
], | ||
stack_snapshot_json = "@rules_haskell//tests/asterius/stack_toolchain_libraries:snapshot.json", | ||
toolchain_libraries = toolchain_libraries, | ||
) if is_linux else None | ||
) |
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.
I think the outer parenthesis are not strictly necessary.
drop-packages: | ||
- Win32 |
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.
Maybe worth a comment as to why this is being dropped.
drop-packages: | ||
- Win32 |
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.
Same here
drop-packages: | ||
- Win32 |
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.
Same here
1334139
to
49b91ce
Compare
This PR removes the hard coded list of toolchain libraries from the
bazel.bzl
file.If the stack_snapshot is to be used by ghc, we will rely on stack to decide the toolchain libraries.
With a different compiler such as asterius, this list of toolchain libraries is configurable through the new
toolchain_libraries
attribute.About the call to stack
We consider libraries without a
location
field in the result ofstack ls dependencies json --global-hint --external
to be part of the toolchain.This happens in two cases:
stack.yaml
(considered as local)So there are two kinds of mismatch to fix:
stack.yaml
file.The
toolchain_libraries
attributeIf this attribute is set, it must contain all of the toolchain libraries.
So that we can know that a library is not in the toolchain and have an error message telling the user it should be added a custom stack snapshot.
The WORKSPACE file
To avoid writing the list of toolchain libraries explicitely, the asterius toolchain writes this list to the
toolchain_libraries.bzl
file so that it can be imported in the WORKSPACE file.Since this is linux only and we cannot conditionally
load
this file, thetoolchain_libraries
workspace rule will create a file with a defaultNone
value.