Update to hie-bios 0.5.0 (#552)

* Update to hie-bios 0.5.0

* Fix test-cases due to changes in the direct cradle

* Update test/exe/Main.hs comment

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
This commit is contained in:
fendor 2020-05-23 09:54:25 +02:00 committed by GitHub
parent ec0bbd1b1d
commit 9129475b87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 21 additions and 21 deletions

View File

@ -14,6 +14,7 @@ type instance RuleResult GetHscEnv = HscEnvEq
data GetHscEnv = GetHscEnv
{ hscenvOptions :: [String] -- componentOptions from hie-bios
, hscenvRoot :: FilePath -- componentRoot from hie-bios
, hscenvDependencies :: [FilePath] -- componentDependencies from hie-bios
}
deriving (Eq, Show, Typeable, Generic)

View File

@ -26,7 +26,7 @@ import GHC
import GHC.Check (VersionCheck(..), makeGhcVersionChecker)
import HIE.Bios
import HIE.Bios.Cradle
import HIE.Bios.Environment (addCmdOpts)
import HIE.Bios.Environment (addCmdOpts, makeDynFlagsAbsolute)
import HIE.Bios.Types
import Linker (initDynLinker)
import RuleTypes
@ -55,8 +55,8 @@ loadGhcSession =
-- This rule is for caching the GHC session. E.g., even when the cabal file
-- changed, if the resulting flags did not change, we would continue to use
-- the existing session.
defineNoFile $ \(GetHscEnv opts deps) ->
liftIO $ createSession $ ComponentOptions opts deps
defineNoFile $ \(GetHscEnv opts optRoot deps) ->
liftIO $ createSession $ ComponentOptions opts optRoot deps
cradleToSession :: Rules ()
cradleToSession = define $ \LoadCradle nfp -> do
@ -79,13 +79,14 @@ cradleToSession = define $ \LoadCradle nfp -> do
cmpOpts <- liftIO $ mask $ \_ -> getComponentOptions cradle
let opts = componentOptions cmpOpts
deps = componentDependencies cmpOpts
root = componentRoot cmpOpts
deps' = case mbYaml of
-- For direct cradles, the hie.yaml file itself must be watched.
Just yaml | isDirectCradle cradle -> yaml : deps
_ -> deps
existingDeps <- filterM doesFileExist deps'
need existingDeps
([],) . pure <$> useNoFile_ (GetHscEnv opts deps)
([],) . pure <$> useNoFile_ (GetHscEnv opts root deps)
cradleLoadedMethod :: Text
cradleLoadedMethod = "ghcide/cradle/loaded"
@ -118,7 +119,7 @@ checkGhcVersion = do
return Nothing
createSession :: ComponentOptions -> IO HscEnvEq
createSession (ComponentOptions theOpts _) = do
createSession (ComponentOptions theOpts compRoot _) = do
libdir <- getLibdir
cacheDir <- getCacheDir theOpts
@ -127,7 +128,8 @@ createSession (ComponentOptions theOpts _) = do
runGhc (Just libdir) $ do
dflags <- getSessionDynFlags
(dflags', _targets) <- addCmdOpts theOpts dflags
(dflags_, _targets) <- addCmdOpts theOpts dflags
let dflags' = makeDynFlagsAbsolute compRoot dflags_
setupDynFlags cacheDir dflags'
versionMismatch <- liftIO checkGhcVersion
case versionMismatch of

View File

@ -204,7 +204,7 @@ executable ghcide
hashable,
haskell-lsp,
haskell-lsp-types,
hie-bios >= 0.4.0 && < 0.5,
hie-bios >= 0.5.0 && < 0.6,
ghcide,
optparse-applicative,
shake,

View File

@ -5,7 +5,7 @@ extra-deps:
- haskell-lsp-0.22.0.0
- haskell-lsp-types-0.22.0.0
- lsp-test-0.10.3.0
- hie-bios-0.4.0
- hie-bios-0.5.0
- ghc-lib-parser-8.8.1
- ghc-lib-8.8.1
- fuzzy-0.1.0.0

View File

@ -5,7 +5,7 @@ extra-deps:
- haskell-lsp-0.22.0.0
- haskell-lsp-types-0.22.0.0
- lsp-test-0.11.0.1
- hie-bios-0.4.0
- hie-bios-0.5.0
- fuzzy-0.1.0.0
- regex-pcre-builtin-0.95.1.1.8.43
- regex-base-0.94.0.0

View File

@ -8,6 +8,7 @@ extra-deps:
- haskell-lsp-types-0.22.0.0
- lsp-test-0.11.0.1
- ghc-check-0.3.0.1
- hie-bios-0.5.0
# for ghc-8.10
- Cabal-3.2.0.0

View File

@ -11,7 +11,7 @@ extra-deps:
- rope-utf16-splay-0.3.1.0
- filepattern-0.1.1
- js-dgtable-0.5.2
- hie-bios-0.4.0
- hie-bios-0.5.0
- fuzzy-0.1.0.0
- shake-0.18.5
- time-compat-1.9.2.2

View File

@ -6,6 +6,6 @@ extra-deps:
- haskell-lsp-types-0.22.0.0
- lsp-test-0.11.0.1
- ghc-check-0.3.0.1
- hie-bios-0.5.0
nix:
packages: [zlib]

View File

@ -482,26 +482,22 @@ watchedFilesTests = testGroup "watched files"
_doc <- createDoc "A.hs" "haskell" "{-#LANGUAGE NoImplicitPrelude #-}\nmodule A where\nimport WatchedFilesMissingModule"
watchedFileRegs <- getWatchedFilesSubscriptionsUntil @PublishDiagnosticsNotification
-- Expect 6 subscriptions (A does not get any because it's VFS):
-- Expect 4 subscriptions (A does not get any because it's VFS):
-- - /path-to-workspace/WatchedFilesMissingModule.hs
-- - /path-to-workspace/WatchedFilesMissingModule.lhs
-- - WatchedFilesMissingModule.hs
-- - WatchedFilesMissingModule.lhs
-- - src/WatchedFilesMissingModule.hs
-- - src/WatchedFilesMissingModule.lhs
liftIO $ length watchedFileRegs @?= 6
-- - /path-to-workspace/src/WatchedFilesMissingModule.hs
-- - /path-to-workspace/src/WatchedFilesMissingModule.lhs
liftIO $ length watchedFileRegs @?= 4
, testSession' "non workspace file" $ \sessionDir -> do
liftIO $ writeFile (sessionDir </> "hie.yaml") "cradle: {direct: {arguments: [\"-i/tmp\"]}}"
_doc <- createDoc "A.hs" "haskell" "{-# LANGUAGE NoImplicitPrelude#-}\nmodule A where\nimport WatchedFilesMissingModule"
watchedFileRegs <- getWatchedFilesSubscriptionsUntil @PublishDiagnosticsNotification
-- Expect 4 subscriptions (/tmp does not get any as it is out of the workspace):
-- Expect 2 subscriptions (/tmp does not get any as it is out of the workspace):
-- - /path-to-workspace/WatchedFilesMissingModule.hs
-- - /path-to-workspace/WatchedFilesMissingModule.lhs
-- - WatchedFilesMissingModule.hs
-- - WatchedFilesMissingModule.lhs
liftIO $ length watchedFileRegs @?= 4
liftIO $ length watchedFileRegs @?= 2
-- TODO add a test for didChangeWorkspaceFolder
]