-
Notifications
You must be signed in to change notification settings - Fork 247
Fix: shellFor doesn't filter based on transitive dependencies #1145
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
Fix: shellFor doesn't filter based on transitive dependencies #1145
Conversation
1293306
to
0c0d3f4
Compare
ensure that the following invariant is enforced: `shellFor` never adds the selected packages to its environment
0c0d3f4
to
85a5b4a
Compare
This seems to work great! I have had exactly this issue with leksah recently. There is a patched version of I added
I also did a quick sanity check on the performance and could see no noticeable difference in the shell startup time. |
bors try |
tryBuild succeeded: |
Unfortunately, this seems to ~double the evaluation time for our |
I can take a look at optimising this. Doubling evaluation time does sound quite bad. I have two ideas:
|
I haven't looked at it in detail, but I suspect we're doing something quadratic. Given it's a graph algorithm and we're implementing it with lists, we might not be able to avoid that! But reducing the size would be good. Especially if it's |
Yeah, we are definitely doing something I've opened #1146 , which implements the local packages optimisation. Hopefully that mitigates the performance regression |
…output-hk#1145) * Fix shellFor not accounting for transitive dependencies ensure that the following invariant is enforced: `shellFor` never adds the selected packages to its environment * Fix missing selectedComponentsBitmap attribute Co-authored-by: Hamish Mackenzie <Hamish.K.Mackenzie@gmail.com>
Closes #1143
This works by taking the components specified for a
shellFor
as a seed and grow it to be the minimum set such that:This larger set is then used with the existing logic to include dependencies and filter out our selected components.
I've tested this on a trivial reproducer, but haven't done much more testing yet.
Does this work with the
source-repository-package
case you encountered @michaelpj ?Hopefully the comments are still understandable. Let me know if I can change anything to make it clearer.
This should solve the specific performance problems pointed out in #952 .
But it requires the transitive closure of the selected components dependencies to be traversed once. So, really this might be a performance regression.
A way to mitigate this might be to only look at transitive dependencies that are local or project packages, but I'm not sure if that would break correctness, and would require a new version of the
flatLibDepends
.