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

Projects
None yet
3 participants
@chrisdone
Member

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 some commits May 24, 2018

Rename tmpDirectory to outputDirectory
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.
Add ghciDirL lens
For writing files pertaining to `stack ghci`
Use the ghciDirL for cabal_macros.h in ghci cmd
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

@chrisdone chrisdone changed the title from Cabal macros work dir to Set cabal_macros.h work directory in stack ghci to something non-temporary May 24, 2018

chrisdone added a commit to commercialhaskell/intero that referenced this pull request May 24, 2018

Remove -odir/-hidir, trust stack ghci to set them
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

This comment has been minimized.

Contributor

bitemyapp commented May 24, 2018

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

@mgsloan

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?

This comment has been minimized.

@mgsloan

mgsloan May 24, 2018

Collaborator

Seems fine to me 👍

@chrisdone chrisdone merged commit eeec8df into master May 25, 2018

4 checks passed

continuous-integration/appveyor/branch AppVeyor build succeeded
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@chrisdone chrisdone deleted the cabal-macros-work-dir branch May 25, 2018

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