File tree Expand file tree Collapse file tree 3 files changed +21
-13
lines changed Expand file tree Collapse file tree 3 files changed +21
-13
lines changed Original file line number Diff line number Diff line change @@ -114,7 +114,6 @@ cabalInstallIsOldFailMsg cabalVersion =
114114 ++ versionToString requiredCabalVersion
115115 ++ " `."
116116
117-
118117requiredCabalVersion :: RequiredVersion
119118requiredCabalVersion | isWindowsSystem = requiredCabalVersionForWindows
120119 | otherwise = [2 , 4 , 1 , 0 ]
Original file line number Diff line number Diff line change @@ -62,6 +62,23 @@ findInstalledGhcs = do
6262 -- filter out stack provided GHCs (assuming that stack programs path is the default one in linux)
6363 $ filter (not . isInfixOf " .stack" . snd ) (knownGhcs ++ availableGhcs)
6464
65+ showInstalledGhcs :: MonadIO m => [(VersionNumber , GhcPath )] -> m ()
66+ showInstalledGhcs ghcPaths = do
67+ let msg = " Found the following GHC paths: \n "
68+ ++ unlines
69+ (map (\ (version, path) -> " ghc-" ++ version ++ " : " ++ path)
70+ ghcPaths
71+ )
72+ printInStars msg
73+
74+ checkInstalledGhcs :: MonadIO m => [(VersionNumber , GhcPath )] -> m ()
75+ checkInstalledGhcs ghcPaths = when (null ghcPaths) $ do
76+ let msg = " No ghc installations found in $PATH. \n "
77+ ++ " The script requires at least one ghc in $PATH \n "
78+ ++ " to be able to build haskell-language-server.\n "
79+ printInStars msg
80+ error msg
81+
6582-- | Get the path to a GHC that has the version specified by `VersionNumber`
6683-- If no such GHC can be found, Nothing is returned.
6784-- First, it is checked whether there is a GHC with the name `ghc-$VersionNumber`.
Original file line number Diff line number Diff line change @@ -88,22 +88,14 @@ defaultMain = do
8888 phony " haskell-language-server" (need [" data" , " latest" ])
8989
9090 -- stack specific targets
91- when isRunFromStack $ do
92-
91+ when isRunFromStack $
9392 phony " dev" $ stackInstallHieWithErrMsg Nothing
9493
9594 -- cabal specific targets
9695 when isRunFromCabal $ do
97-
98- phony " ghcs" $ do
99- let
100- msg =
101- " Found the following GHC paths: \n "
102- ++ unlines
103- (map (\ (version, path) -> " ghc-" ++ version ++ " : " ++ path)
104- ghcPaths
105- )
106- printInStars msg
96+ -- It throws an error if there is no ghc in $PATH
97+ checkInstalledGhcs ghcPaths
98+ phony " ghcs" $ showInstalledGhcs ghcPaths
10799
108100 -- macos specific targets
109101 phony " icu-macos-fix"
You can’t perform that action at this time.
0 commit comments