-
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
Implement haskell_repl support for targets that have modules in them #1733
Conversation
TODO: tests EDIT: I added one..? |
@@ -548,6 +569,7 @@ def build_haskell_modules( | |||
object files and the object files of their transitive module | |||
dependencies. See Note [Narrowed Dependencies]. | |||
per_module_transitive_dyn_objects: like per_module_transitive_objects but for dyn_o files | |||
repl_info: struct(source_files, boot_files, import_dirs, user_compile_flags) |
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.
Is this enough documentation? If not, how should I document the fields of the returned struct?
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 would add some, to match the style of the doc for the other arguments. It looks you can indent it as it is done here.
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.
Added some docs here.
@@ -7,6 +7,7 @@ load( | |||
) | |||
load("//haskell:private/cc_libraries.bzl", "haskell_cc_libraries_aspect") | |||
|
|||
# TODO[GL] should we have repl_ghci_args here? |
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.
Not sure about this one.
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.
Probably not for now. Seems like something we can try to add later if a user wants it.
205cb61
to
87ccbdf
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.
Overall looks good to me
Now that #1731 is merged, I should take care of the import_dirs situation here (after rebasing). |
4e5b498
to
5dedb95
Compare
5dedb95
to
4cc50a1
Compare
I just tested this PR on a local workspace with multiple packages, the repl target doesn't seem to build / include its dependencies.
I guess this is still WIP, but this workspace could be useful for testing I suppose |
Thanks a lot @pranaysashank. I'll look into it. |
I just tried out your example repo and the repl starts up fine for me and loads modules, at least for How are you running your repl? Both |
Derp, I see. I'll look into why it doesn't work cross package. |
Including your cross-library dependencies from So this is either
Seeing as how the library builds without them included in there I assume it's the first one. |
For the repl target, is it better to have behaviour similar to the normal build without modules attribute i.e. we build the cross package libraries that we depend on, instead of creating a repl with all the modules across packages. Perhaps you're missing building |
After a lot of struggling with the "empty libs" mechanism, I managed to get your example working in my latest commit, 346cdd7, by propagating the repl aspect along I don't think this is the proper solution however, since this causes the repl target to rebuild all the modules in libraries specified in @facundominguez can you offer some help here? |
TODO: I should also add your example as a test to the repo EDIT: done |
After a short discussion with @facundominguez, it turns out it might not be possible or it might be rather complicated. I think it would be better to leave it as an open question for another issue, as something working slowly is better than not working at all. |
haskell/repl.bzl
Outdated
@@ -182,6 +182,7 @@ def _create_HaskellReplCollectInfo(target, ctx): | |||
|
|||
hs_info = target[HaskellInfo] | |||
|
|||
# TODO[GL]: do we need to also take into account narrowed_deps here, everywhere "deps" is checked? |
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.
?
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 would imagine it is necessary. To rehearse that we would need to add java dependencies to dependencies of Haskell libraries using modules
.
e5c2025
to
90152f1
Compare
Re the run failures - one of them seems to be a flaky error the other one I'm not sure about - it passes locally 😿 |
e581c48
to
3f03379
Compare
The changes look good to me in intent, and given that the tests that have been added pass, the PR looks like a net improvement. I'm not versed in the aspects that get the repl working to foresee unknown issues. The code that manages java and CC dependencies in libraries of narrowed_deps doesn't have a test yet. If you still have steam, it would be necessary to add such tests. Otherwise, just make a new issue to add them later. |
Apart from the CC and java dependencies, it would also be nice to have tests for hie bios output. I'll try to add all three next week. |
Actually, I can't seem to find tests for the normal repl usage with cc/java deps 😅 If they exist, can you point me to them? If not, I think we should leave this as a separate issue (add tests for both "normal" and module usage). |
@aherrmann is this good to merge? |
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.
Yes, that looks great. Thank you @googleson78!
Fixes #1732