-
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
sublibraries in stack_snapshot
rule
#1636
Conversation
c05850d
to
e0e363b
Compare
An idea that was discussed here in the past is to have That said, I'd consider this orthogonal to this PR. Let's go with
IIUC this means that all executables go into
That's fair. Once we have bazel-in-bazel integration tests available, it would be good to have a dedicated one in there.
Good catch, that looks like an oversight. |
Yes that's it, from what I tested it does not seem to cause any problems, and the |
🎉 All dependencies have been resolved ! |
It should be good to go, I have updated the url of the |
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.
Thank you!
159137e
to
aa77ffc
Compare
Depends on #1641.
This PR adds support for sublibraries in
stack_snapshot
.components
attribute aslib:<sublib-name>
.stack ls snapshot json
are also added to those of the sublibraries. These dependencies seem to be the union of the dependencies of the components, so there may be to many of them.The
components_dependencies
attribute.This new attribute enables declaring internal dependencies between components.
This is most often needed when the main library depends on a sublibrary, as in the example.
Since the types of bazel's attributes are is a bit limited, I went for a dict of json strings, but maybe there is a better interface for this.
Aliases
The sublibraries are named
@<stack_snapshot_name>//:_<package_name>_lib_<sublib_name>
and aliases are created (in the same repository) so that they can be referenced from BUILD files as@<stack_snapshot_name>//<package_name>:<sublib_name>
.For now there is also a new alias for the main library:
@<stack_snapshot_name>//<package_name>
.But if I believe the conclusion of Build executables in stack_snapshot and use them as tools #1306 maybe it's not a good idea.
Maybe these aliases could be in an other repository (
@<stack_snapshot_name>-libs
or@<stack_snapshot_name>-sublibs
) to mimic what is done with the executables. But, as @kczulko pointed out, it is natural to have them in the same repository as the main library, and I don't see any possible naming conflict.Tests
An archive made from the
tests/haskell_cabal_library_sublibrary_name
test is imported in a custom stack snapshot. Since stack resolves local archives to absolute paths, this archive is downloaded from an ealier commit of therules_haskell
repository.The new
tests/stackage_sublibrary
test adds a binary that directly depends on the sublibrary of this package via the stackage repository.I was not sure in which
stack_snapshot
rule to add the test, or if it's better to create a new one ?So I added this to the
@stackage-pinning-test
workspace for now.Setup_deps attribute
I noticed that
setup_deps
was present in the parameters toformat
but not used in the generatedhaskell_cabal_binary
rules. It looks like it may also concern the binary rules so I added it.