Skip to content

Avoid building the target packages with "stack ghci" #1364

@mgsloan

Description

@mgsloan

In order to make stack ghci reliable / consistent, the cabal_macros.h and Paths_* files need to be generated. Currently, this means that we do a full build of the targets (unless --no-build is passed).

Really all that needs to happen is to run initialBuildSteps before running ghci. Running this function requires LocalBuildInfo, which gets stored in dist/setup-config. Unfortunately, we can't call it directly from stack - it uses Binary / Generic, so we can't rely on it being compatible between cabal versions (and stack may be linked with a different version).

I think a reasonable solution to this is to have a separate program which runs initialBuildSteps on the specified packages. This separate program could either be a script that gets runhaskell-ed, or something that gets build and installed to the snapshot (like the default Setup.hs).

This solution also has relevance to other issues:

  • It's also the information necessary to allow Setup.hs to modify the cabal info (see "stack ghci" doesn't honor configured cpp flags #970). Doing this would be more complicated. I think the best way to do this would be to serialize localPkgDescr as a .cabal file (I really hope this is possible). Then, we'd would parse the resulting cabal file, and use that description to generate the arguments passed to ghci.
  • This may also allow us to avoid doing full rebuilds for haddock - I noted that in cabal this function is also called by the haddock stuff.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions