Build on GHC 8.8 (#43)

This commit is contained in:
Ollie Charles 2019-09-16 14:20:48 +01:00 committed by Moritz Kiefer
parent 7133f4192f
commit 9a5ee23c01
5 changed files with 16 additions and 5 deletions

View File

@ -41,6 +41,7 @@ import GHC hiding (def)
import qualified GHC.Paths
import HIE.Bios
import HIE.Bios.Ghc.Api (initializeFlagsWithCradle)
-- Set the GHC libdir to the nix libdir if it's present.
getLibdir :: IO FilePath
@ -76,7 +77,7 @@ main = do
-- Note that this whole section needs to change once we have genuine
-- multi environment support. Needs rewriting in terms of loadEnvironment.
putStrLn "[1/6] Finding hie-bios cradle"
cradle <- findCradle (dir <> "/")
cradle <- getCradle dir
print cradle
putStrLn "\n[2/6] Converting Cradle to GHC session"
@ -138,5 +139,13 @@ newSession' cradle = getLibdir >>= \libdir -> do
loadEnvironment :: FilePath -> IO (FilePath -> Action HscEnvEq)
loadEnvironment dir = do
res <- liftIO $ newSession' =<< findCradle (dir <> "/")
res <- liftIO $ newSession' =<< getCradle dir
return $ const $ return res
getCradle :: FilePath -> IO Cradle
getCradle dir = do
dir <- pure $ addTrailingPathSeparator dir
mbYaml <- findCradle dir
case mbYaml of
Nothing -> loadImplicitCradle dir
Just yaml -> loadCradle yaml

View File

@ -40,10 +40,12 @@ import System.IO
import Foreign.ForeignPtr
#if !MIN_GHC_API_VERSION(8,8,0)
hPutStringBuffer :: Handle -> StringBuffer -> IO ()
hPutStringBuffer hdl (StringBuffer buf len cur)
= withForeignPtr (plusForeignPtr buf cur) $ \ptr ->
hPutBuf hdl ptr len
#endif
mkHieFile :: ModSummary -> TcGblEnv -> RenamedSource -> Hsc HieFile
mkHieFile _ _ _ = return (HieFile () [])

View File

@ -10,7 +10,7 @@ extra-deps:
- git: https://github.com/bubba/lsp-test.git
commit: d126623dc6895d325e3d204d74e2a22d4f515587
- git: https://github.com/mpickering/hie-bios.git
commit: 89e4ba24f87aac9909d9814b0e8c51b679a0ccd4
commit: 68c662ea1d0e7095ccf2a4e3d393fc524e769bfe
- ghc-lib-parser-8.8.1
- ghc-lib-8.8.1
nix:

View File

@ -11,6 +11,6 @@ extra-deps:
- git: https://github.com/bubba/lsp-test.git
commit: d126623dc6895d325e3d204d74e2a22d4f515587
- git: https://github.com/mpickering/hie-bios.git
commit: 89e4ba24f87aac9909d9814b0e8c51b679a0ccd4
commit: 68c662ea1d0e7095ccf2a4e3d393fc524e769bfe
nix:
packages: [zlib]

View File

@ -15,7 +15,7 @@ extra-deps:
- git: https://github.com/bubba/lsp-test.git
commit: d126623dc6895d325e3d204d74e2a22d4f515587
- git: https://github.com/mpickering/hie-bios.git
commit: 89e4ba24f87aac9909d9814b0e8c51b679a0ccd4
commit: 68c662ea1d0e7095ccf2a4e3d393fc524e769bfe
nix:
packages: [zlib]
allow-newer: true