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

Ignore .ghci files while querying project GHC #337

Merged
merged 1 commit into from
Mar 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/HIE/Bios/Cradle.hs
Original file line number Diff line number Diff line change
Expand Up @@ -646,9 +646,15 @@ cabalBuildDir workDir = do
-- If cabal can not figure it out, a 'CradleError' is returned.
cabalGhcDirs :: FilePath -> CradleLoadResultT IO (FilePath, FilePath)
cabalGhcDirs workDir = do
libdir <- readProcessWithCwd_ workDir "cabal" ["exec", "-v0", "--", "ghc", "--print-libdir"] ""
exe <- readProcessWithCwd_ workDir "cabal"
["exec", "-v0", "--", "ghc", "-package-env=-", "-e", "do e <- System.Environment.getExecutablePath ; System.IO.putStr e"] ""
libdir <- readProcessWithCwd_ workDir "cabal" ["exec", "-v0", "--", "ghc", "--print-libdir"] ""
exe <- readProcessWithCwd_ workDir "cabal"
-- DON'T TOUCH THIS CODE
-- This works with 'NoImplicitPrelude', with 'RebindableSyntax' and other shenanigans.
-- @-package-env=-@ doesn't work with ghc prior 8.4.x
[ "exec", "-v0", "--" , "ghc", "-package-env=-", "-ignore-dot-ghci", "-e"
fendor marked this conversation as resolved.
Show resolved Hide resolved
, "Control.Monad.join (Control.Monad.fmap System.IO.putStr System.Environment.getExecutablePath)"
]
""
pure (trimEnd exe, trimEnd libdir)

cabalAction :: FilePath -> Maybe String -> LoggingFunction -> FilePath -> CradleLoadResultT IO ComponentOptions
Expand Down
5 changes: 5 additions & 0 deletions tests/projects/simple-cabal/.ghci
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-- This file is intentional
--
-- Issue: https://github.com/haskell/hie-bios/issues/336
--
:set +t