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

Add project-plan command #6885

Open
phadej opened this issue Jun 8, 2020 · 7 comments
Open

Add project-plan command #6885

phadej opened this issue Jun 8, 2020 · 7 comments

Comments

@phadej
Copy link
Collaborator

phadej commented Jun 8, 2020

You can force project planning by using cabal build --dry. That command is however requires that you in fact have build environment set up. The project-plan should be able to take all required information as separate input (compiler information, installed package info db, pkgconfig db, ...).

project-plan would both useful for system independent testing (simulating various scenarios, where setting up environment is just too tricky for CI), and we can use it to produce plans for cabal's new bootstrap (#6700).

cc @angerman @bgamari

I suspect that this will require some non-trivial changes inside cabal-install, but I do think they will be for better, making implicits explicit.

@hasufell
Copy link
Member

Another use case might be ghcup using this to figure out a suitable GHC version for a project: https://gitlab.haskell.org/haskell/ghcup-hs/-/issues/99

@jneira
Copy link
Member

jneira commented Nov 6, 2021

  • for hie-bios to get as well the ghc of a project and gives it to tooling using the lib (like haskell-language-server)
  • it think this should be part of cabal info (Add status command to cabal #7500)

@andreabedini
Copy link
Collaborator

Late to the party but it turns out I had a go a this. I requires moving few things around but IIRC no roadblocks. I had a version of ProjectPlanning.hs that takes compiler, platform and arch as parameters.

The only issue was with pkg-config, as we cannot know in advance which packages might be relevant for the plan. Perhaps we could overapproximate the set of relevant pkgconfig entries and report that to the user? I am not sure how this would work.

Let me know if there's still interest.

@phadej
Copy link
Collaborator Author

phadej commented Jun 25, 2023

@andreabedini

relevant pkgconfig entries and report that to the user?

cabal-installs solver takes the whole pkgconfig database as the input.


EDIT: Note that my original request was asking to take the whole global package db as an input as well. E.g. on linux you don't have Win32, but on Windows you do (but don't have unix). Nor you cannot really predict their versions either.

@andreabedini
Copy link
Collaborator

cabal-installs solver takes the whole pkgconfig database as the input.

That might be the only solution.

Note that my original request was asking to take the whole global package db as an input as well.

Good point.

Now I remember another thing that wasn't entirely trivial: cabal-install wants to know a lot about the compiler (it calls --info). I think it mostly end up using the list of supported extensions and languages; but I am not sure to what purpose.

@phadej
Copy link
Collaborator Author

phadej commented Jun 26, 2023

but I am not sure to what purpose.

If you say

other-extensions: SomethingFancy

and the compiler doesn't know it, solver will take that into account. (E.g. say you want QuantifiedConstraints, or OverloadedRecordDot...)

i.e. a capability based compiler support. (It would been better if extensions didn't change, but that works well for things like QuantifiedConstraints or TypeApplications, which are more-or-less perfect in the first GHC they were added).

@andreabedini
Copy link
Collaborator

I have made a poc https://github.com/andreabedini/cabal-solver-plan
Note that this is only the (per-package) solver plan and not the (per-component) elaborated plan.

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

6 participants