Skip to content
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

new-freeze freezes the dependencies of unused components. #5136

Open
grayjay opened this issue Feb 12, 2018 · 2 comments
Open

new-freeze freezes the dependencies of unused components. #5136

grayjay opened this issue Feb 12, 2018 · 2 comments

Comments

@grayjay
Copy link
Collaborator

grayjay commented Feb 12, 2018

I reproduced this issue by adding an executable to a package that is used only as a library dependency in one of the tests in #5135: grayjay@abba0dc. The new executable has a dependency on the package exe-dependency. Since exe-dependency isn't required by any other component, new-build shouldn't need to build it. However, new-freeze adds a constraint on the package. (The commit adds an assertion checking for the constraint, and it passes.) I think that this type of constraint shouldn't be necessary in new-build, especially once we implement component-based dependency solving, and the solver doesn't need to choose dependencies for unused components.

I think this is related to the old-freeze issue #1896.

@phadej
Copy link
Collaborator

phadej commented Feb 12, 2018

By playing with cabal-plan I noticed that executables of dependencies end up in the plan. For example:

servant-server-0.13 % cabal new-build --dry-run --disable-tests --disable-benchmarks
servant-server-0.13 % cabal-plan --hide-builtin dot --tred --path-from servant-server --path-to wai-app-static | dot -Tpng -odeps.png

deps

note the exe:warp above the red line. I think it shouldn't be there.

I don't know how this works regarding store. Do we optimistically solve for exes too, so they end up in the plan?

EDIT But then it has a side-effect of executable showing in the plan:

servant-server-0.13 % cabal-plan list-bins
servant-server:exe:greet  .../mess/servant-server-0.13/dist-newstyle/build/x86_64-linux/ghc-8.2.2/servant-server-0.13/build/greet/greet
wai-app-static:exe:warp .../.cabal/store/ghc-8.2.2/wai-app-static-3.1.6.1-a95001e75ff661a67f5af490d2687020725f222047cf4c4377e2228e846ec3e9/bin/warp

† so solver is free to turn them off, if their deps get in the way

@grayjay
Copy link
Collaborator Author

grayjay commented Feb 12, 2018

The solver always solves for all components of every dependency, because it doesn't yet have a way to determine which components are needed. That is a big part of #4087. I had assumed that new-build immediately pruned the solver's install plan to remove unnecessary components, but it looks like that isn't true. I just checked plan.json for the small example, and it also contains the exe dependency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants