Refactor code around isolateDirs, so we have proper knowledge

This commit is contained in:
2022-05-11 15:47:08 +02:00
parent a34d9b7b89
commit 991e540c11
7 changed files with 188 additions and 157 deletions

View File

@@ -469,7 +469,7 @@ compile compileCommand settings Dirs{..} runAppState runLogger = do
ghcs
jobs
ovewrwiteVer
isolateDir
(maybe GHCupInternal IsolateDir isolateDir)
cabalProject
cabalProjectLocal
patches
@@ -524,7 +524,7 @@ compile compileCommand settings Dirs{..} runAppState runLogger = do
addConfArgs
buildFlavour
hadrian
isolateDir
(maybe GHCupInternal IsolateDir isolateDir)
GHCupInfo { _ghcupDownloads = dls } <- lift getGHCupInfo
let vi = getVersionInfo (_tvVersion targetVer) GHC dls
when setCompile $ void $ liftE $

View File

@@ -216,7 +216,7 @@ installOpts tool =
Nothing -> False
Just GHC -> False
Just _ -> True
@@ -395,7 +395,7 @@ install installCommand settings getAppState' runLogger = case installCommand of
(v, vi) <- liftE $ fromVersion instVer GHC
void $ liftE $ sequenceE (installGHCBin
(_tvVersion v)
isolateDir
(maybe GHCupInternal IsolateDir isolateDir)
forceInstall
)
$ when instSet $ when (isNothing isolateDir) $ void $ setGHC v SetGHCOnly Nothing
@@ -406,7 +406,7 @@ install installCommand settings getAppState' runLogger = case installCommand of
void $ liftE $ sequenceE (installGHCBindist
(DownloadInfo uri (Just $ RegexDir "ghc-.*") "")
(_tvVersion v)
isolateDir
(maybe GHCupInternal IsolateDir isolateDir)
forceInstall
)
$ when instSet $ when (isNothing isolateDir) $ void $ setGHC v SetGHCOnly Nothing
@@ -467,7 +467,7 @@ install installCommand settings getAppState' runLogger = case installCommand of
(_tvVersion -> v, vi) <- liftE $ fromVersion instVer Cabal
void $ liftE $ sequenceE (installCabalBin
v
isolateDir
(maybe GHCupInternal IsolateDir isolateDir)
forceInstall
) $ when instSet $ when (isNothing isolateDir) $ void $ setCabal v
pure vi
@@ -477,7 +477,7 @@ install installCommand settings getAppState' runLogger = case installCommand of
void $ liftE $ sequenceE (installCabalBindist
(DownloadInfo uri Nothing "")
v
isolateDir
(maybe GHCupInternal IsolateDir isolateDir)
forceInstall
) $ when instSet $ when (isNothing isolateDir) $ void $ setCabal v
pure vi
@@ -518,7 +518,7 @@ install installCommand settings getAppState' runLogger = case installCommand of
(_tvVersion -> v, vi) <- liftE $ fromVersion instVer HLS
void $ liftE $ sequenceE (installHLSBin
v
isolateDir
(maybe GHCupInternal IsolateDir isolateDir)
forceInstall
) $ when instSet $ when (isNothing isolateDir) $ void $ setHLS v SetHLSOnly Nothing
pure vi
@@ -529,7 +529,7 @@ install installCommand settings getAppState' runLogger = case installCommand of
void $ liftE $ sequenceE (installHLSBindist
(DownloadInfo uri (Just $ RegexDir "haskell-language-server-*") "")
v
isolateDir
(maybe GHCupInternal IsolateDir isolateDir)
forceInstall
) $ when instSet $ when (isNothing isolateDir) $ void $ setHLS v SetHLSOnly Nothing
pure vi
@@ -578,7 +578,7 @@ install installCommand settings getAppState' runLogger = case installCommand of
(_tvVersion -> v, vi) <- liftE $ fromVersion instVer Stack
void $ liftE $ sequenceE (installStackBin
v
isolateDir
(maybe GHCupInternal IsolateDir isolateDir)
forceInstall
) $ when instSet $ when (isNothing isolateDir) $ void $ setStack v
pure vi
@@ -588,7 +588,7 @@ install installCommand settings getAppState' runLogger = case installCommand of
void $ liftE $ sequenceE (installStackBindist
(DownloadInfo uri Nothing "")
v
isolateDir
(maybe GHCupInternal IsolateDir isolateDir)
forceInstall
) $ when instSet $ when (isNothing isolateDir) $ void $ setStack v
pure vi

View File

@@ -351,25 +351,25 @@ run RunOptions{..} runAppState leanAppstate runLogger = do
Just (GHC, v) -> do
unless isInstalled $ when (runInstTool' && isNothing (_tvTarget v)) $ void $ liftE $ installGHCBin
(_tvVersion v)
Nothing
GHCupInternal
False
setTool GHC v tmp
Just (Cabal, v) -> do
unless isInstalled $ when runInstTool' $ void $ liftE $ installCabalBin
(_tvVersion v)
Nothing
GHCupInternal
False
setTool Cabal v tmp
Just (Stack, v) -> do
unless isInstalled $ when runInstTool' $ void $ liftE $ installStackBin
(_tvVersion v)
Nothing
GHCupInternal
False
setTool Stack v tmp
Just (HLS, v) -> do
unless isInstalled $ when runInstTool' $ void $ liftE $ installHLSBin
(_tvVersion v)
Nothing
GHCupInternal
False
setTool HLS v tmp
_ -> pure ()