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

Set cabal_macros.h work directory in stack ghci to something non-temporary #4038

Merged
merged 4 commits into from
May 25, 2018

Conversation

chrisdone
Copy link
Member

@chrisdone chrisdone commented May 24, 2018

Use the ghciDirL for cabal_macros.h in stack ghci command.

Example:

bash-3.2$ stack exec -- stack ghci -v 2>/dev/stdout | egrep '\-optP.*?cabal_macros.*? ' -o
-optP-include -optP/Users/chris/Work/stack/.stack-work/ghci/cb285e1e/cabal_macros.h
bash-3.2$ stack exec -- stack ghci -v 2>/dev/stdout | egrep '\-optP.*?cabal_macros.*? ' -o
-optP-include -optP/Users/chris/Work/stack/.stack-work/ghci/cb285e1e/cabal_macros.h

Here are two runs of stack ghci on the stack codebase. The first
compiles everything, the second loads the cached object files:

https://gist.github.com/chrisdone/7468e27683a5f202b6a5f4e146b2fb8e#file-ghci-output-txt-L146-L164

Ping @mgsloan @bitemyapp

chrisdone added 4 commits May 24, 2018 16:16
To reflect upcoming change, that some of these functions won't
neccessarily be writing to a temporary directory. Now, they write to
whatever output directory they are told to.
For writing files pertaining to `stack ghci`
Example:

bash-3.2$ stack exec -- stack ghci -v 2>/dev/stdout | egrep '\-optP.*?cabal_macros.*? ' -o
-optP-include -optP/Users/chris/Work/stack/.stack-work/ghci/cb285e1e/cabal_macros.h
bash-3.2$ stack exec -- stack ghci -v 2>/dev/stdout | egrep '\-optP.*?cabal_macros.*? ' -o
-optP-include -optP/Users/chris/Work/stack/.stack-work/ghci/cb285e1e/cabal_macros.h

Here are two runs of `stack ghci` on the stack codebase. The first
compiles everything, the second loads the cached object files:

https://gist.github.com/chrisdone/7468e27683a5f202b6a5f4e146b2fb8e#file-ghci-output-txt-L146-L164
@chrisdone chrisdone requested a review from mgsloan May 24, 2018 15:34
@chrisdone chrisdone changed the title Cabal macros work dir Set cabal_macros.h work directory in stack ghci to something non-temporary May 24, 2018
chrisdone added a commit to chrisdone-archive/intero that referenced this pull request May 24, 2018
stack already sets the -odir and -hidir to a place in .stack-work which
is stable and cacheable.

Removing this makes intero much faster at restarting on large projects,
because all the object files are cached.

That is, once PR #4038 lands:

commercialhaskell/stack#4038
@bitemyapp
Copy link
Contributor

This solves a long-standing confusion and problem for me, thank you!

Copy link
Contributor

@mgsloan mgsloan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -32,11 +33,18 @@ objectInterfaceDirL = to $ \env -> -- FIXME is this idomatic lens code?
root = view projectRootL env
in root </> workDir </> $(mkRelDir "odir/")

-- | GHCi files directory.
ghciDirL :: HasBuildConfig env => Getting r env (Path Abs Dir)
ghciDirL = to $ \env -> -- FIXME is this idomatic lens code?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine to me 👍

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

Successfully merging this pull request may close these issues.

3 participants