This repository was archived by the owner on Oct 7, 2020. It is now read-only.
File tree 3 files changed +25
-17
lines changed
3 files changed +25
-17
lines changed Original file line number Diff line number Diff line change @@ -113,7 +113,6 @@ cabalInstallIsOldFailMsg cabalVersion =
113
113
++ versionToString requiredCabalVersion
114
114
++ " `."
115
115
116
-
117
116
requiredCabalVersion :: RequiredVersion
118
117
requiredCabalVersion | isWindowsSystem = requiredCabalVersionForWindows
119
118
| otherwise = [2 , 4 , 1 , 0 ]
Original file line number Diff line number Diff line change @@ -62,6 +62,22 @@ 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 to be able to build hie.\n "
78
+ printInStars msg
79
+ error msg
80
+
65
81
-- | Get the path to a GHC that has the version specified by `VersionNumber`
66
82
-- If no such GHC can be found, Nothing is returned.
67
83
-- First, it is checked whether there is a GHC with the name `ghc-$VersionNumber`.
Original file line number Diff line number Diff line change @@ -78,34 +78,27 @@ defaultMain = do
78
78
(\ version -> phony (" hie-" ++ version) $ do
79
79
need [" submodules" ]
80
80
need [" check" ]
81
- if isRunFromStack then do
81
+ if isRunFromStack then
82
82
stackInstallHieWithErrMsg (Just version)
83
83
else
84
84
cabalInstallHie version
85
85
)
86
-
87
- phony " latest" (need [" hie-" ++ latestVersion])
88
- phony " hie" (need [" data" , " latest" ])
86
+
87
+ unless (null versions) $ do
88
+ phony " latest" (need [" hie-" ++ latestVersion])
89
+ phony " hie" (need [" data" , " latest" ])
89
90
90
91
-- stack specific targets
91
92
-- Default `stack.yaml` uses ghc-8.8.2 and we can't build hie in windows
92
93
-- TODO: Enable for windows when it uses ghc-8.8.3
93
- when (isRunFromStack && not isWindowsSystem) $ do
94
-
94
+ when (isRunFromStack && not isWindowsSystem) $
95
95
phony " dev" $ stackInstallHieWithErrMsg Nothing
96
96
97
97
-- cabal specific targets
98
98
when isRunFromCabal $ do
99
-
100
- phony " ghcs" $ do
101
- let
102
- msg =
103
- " Found the following GHC paths: \n "
104
- ++ unlines
105
- (map (\ (version, path) -> " ghc-" ++ version ++ " : " ++ path)
106
- ghcPaths
107
- )
108
- printInStars msg
99
+ -- It throws an error if there is no ghc in $PATH
100
+ checkInstalledGhcs ghcPaths
101
+ phony " ghcs" $ showInstalledGhcs ghcPaths
109
102
110
103
-- macos specific targets
111
104
phony " icu-macos-fix"
You can’t perform that action at this time.
0 commit comments