-
Notifications
You must be signed in to change notification settings - Fork 707
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
[WIP] Add glob deps #4241
[WIP] Add glob deps #4241
Conversation
@Ericson2314, thanks for your PR! By analyzing the history of the files in this pull request, we identified @ezyang, @dcoutts and @edsko to be potential reviewers. |
There is a related issue for refactoring the dependency solver to solve for components instead of packages: #4087 |
@grayjay thanks! Yeah, I view this edit
Oh great, we are totally on the same page! :) |
CI failure is due to
|
@23Skidoo thanks! Though heh isn't quite ready to be merged anyways :) |
bd0b3de
to
484d159
Compare
The top commit seems fine to me. What happens if I depend on multiple executables from the same package; does it show up twice? |
@ezyang hmm probably? I haven't looked at the solving code in much detail---I mainly just changed the definition of @grayjay maybe this is anticipating per-componenting solving more than I thought! :/ |
@Ericson2314 My suggestion is to take a look at the output you get after the change. (Hard to get this output? Add some logging!) Having thought about this more, it may not be necessary to propagate executable dependencies from the solver; ProjectPlanning can recompute them from scratch. Take a look at how we handle exe_deps0 in elaborateSolverToComponents: the first thing we do run elaborateExeSolverId/elaborateExePath on them, which essentially looks up the package that defined the executable(s) and then adds them as deps. With the information you have from the package description, it would be a simple matter to filter this list down to the true dependencies. (BTW, I think this code is probably in need of some refactoring!) |
I added this to the 2.0 milestone, because without it build-tool-depends isn't so well implemented. |
484d159
to
42938e3
Compare
Ok, did things just in ProjectPlanning as @ezyang described (I still have my old commit in another branch for future work :)). All that's left here is https://github.com/haskell/cabal/pull/4241/files#diff-a6de9cdd16372d3e6c4ec16d4d1703a1R575, I need to route the expanded wildcard back to cabal somehow. Does this mean adding flags to Cabal? CC @hvr: the wildcard stuff was your idea so hopefully you have an idea 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.
If this isn't WIP anymore, the commits look fine but we need TESTS.
-- Second, we collect any build-tools entry we don't know how to | ||
-- desugar. We'll never have no idea how to build them, so we just | ||
-- hope they are already on the PATH. | ||
let unknownBuildTools = |
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 just realized that I may have communicated the situation here a little poorly. It is true that Setup was modified to pick up unknown build-tools from PATH, but in fact, all the testing code we have does not seem to actually exercise this case, as it is always assumed the build-tools refers to an internal dep. So a test here would be appreciated.
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.
Will do.
@ezyang Yes, definitely tests, but I do need the route the expanded wildcard back to Cabal too, right? |
I guess so (although it's not altogether clear what that looks like; I don't think Cabal has any way of conveniently finding out what the wildcard will glob). |
I think the bug-fix portion of this should at least make 2.0 if not wildcards, so I'm going to factor those apart. (And get some tests!) |
I'd like to instead change the solver to route the used components through (baby steps towards per-component solving), rather than reconstruct it post-hoc from the Package Description, but this gets the job done for now.
They look like pkg:* <optional version bound> and denote a dependency on every executable in the package. In the case of internal package dependencies, it is easy to expand the wildcard for internal dependencies, but not possible in Cabal alone for external ones, as the exact set of exe deps depends on the version resolved in cabal-install's build plan.
42938e3
to
b9cfe19
Compare
Hello @Ericson2314, what would you like to be done on this PR specifically? |
OK. Maybe this presents the case for extending the database to also include executables, or maybe teaching Cabal how to interact with the Nix store in some way. |
#4217 looks like it was resolved without this pr. can this be closed? |
closing optimistically after no feedback for the previous comment, thanks all! |
This is really really WIP, but I wanted to ask whether my top commit, adding an extra field to exe deps in the solver, will help route that information to ProjectPlanning for the plan in #4104 (comment), or whether I'm barking up the wrong tree.
#4217