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 =
114
114
++ versionToString requiredCabalVersion
115
115
++ " `."
116
116
117
-
118
117
requiredCabalVersion :: RequiredVersion
119
118
requiredCabalVersion | isWindowsSystem = requiredCabalVersionForWindows
120
119
| otherwise = [2 , 4 , 1 , 0 ]
Original file line number Diff line number Diff line change @@ -62,6 +62,23 @@ findInstalledGhcs = do
62
62
-- filter out stack provided GHCs (assuming that stack programs path is the default one in linux)
63
63
$ filter (not . isInfixOf " .stack" . snd ) (knownGhcs ++ availableGhcs)
64
64
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
+
65
82
-- | Get the path to a GHC that has the version specified by `VersionNumber`
66
83
-- If no such GHC can be found, Nothing is returned.
67
84
-- 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
88
88
phony " haskell-language-server" (need [" data" , " latest" ])
89
89
90
90
-- stack specific targets
91
- when isRunFromStack $ do
92
-
91
+ when isRunFromStack $
93
92
phony " dev" $ stackInstallHieWithErrMsg Nothing
94
93
95
94
-- cabal specific targets
96
95
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
107
99
108
100
-- macos specific targets
109
101
phony " icu-macos-fix"
You can’t perform that action at this time.
0 commit comments