Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

Commit fc7c220

Browse files
authored
Merge pull request #1066 from power-fungus/master
Display error message on stack-compilation errors
2 parents c4a9e7c + edc3385 commit fc7c220

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

install.hs

+17-5
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ type VersionNumber = String
3030
type GhcPath = String
3131

3232
-- |Defines all different hie versions that are buildable.
33-
-- If they are edited,
33+
-- If they are edited,
3434
hieVersions :: [VersionNumber]
3535
hieVersions =
3636
["8.2.1", "8.2.2", "8.4.2", "8.4.3", "8.4.4", "8.6.1", "8.6.2", "8.6.3"]
3737

3838
-- |Most recent version of hie.
39-
-- Important for `dist`, the `hie-wrapper` of the most recent hie
39+
-- Important for `dist`, the `hie-wrapper` of the most recent hie
4040
-- will be copied to the tar-archive.
4141
mostRecentHieVersion :: VersionNumber
4242
mostRecentHieVersion = last hieVersions
@@ -108,7 +108,7 @@ buildDist = do
108108

109109
-- if the most recent hie-* version is copied,
110110
-- copy it again as the default hie version
111-
-- Also, add its hie-wrapper to the tar archive
111+
-- Also, add its hie-wrapper to the tar archive
112112
when (hieVersion == mostRecentHieVersion) $ do
113113
copyFile' (localInstallRoot </> "bin" </> hieWrapper)
114114
(temporaryDir </> hieWrapper)
@@ -148,7 +148,19 @@ buildHie :: VersionNumber -> Action ()
148148
buildHie versionNumber = do
149149
when (versionNumber `elem` ["hie-8.2.2", "hie-8.2.1"])
150150
$ execStackWithYaml_ versionNumber ["install", "happy"]
151-
execStackWithYaml_ versionNumber ["build"]
151+
(execStackWithYaml_ versionNumber ["build"]) `actionOnException`
152+
liftIO (putStrLn buildFailMsg)
153+
154+
buildFailMsg :: String
155+
buildFailMsg =
156+
let starsLine = "\n******************************************************************\n"
157+
in
158+
starsLine
159+
++ "building failed, "
160+
++ "try running `stack clean` and restart the build\n"
161+
++ "if this does not work, open an issue at \n"
162+
++ "https://github.com/haskell/haskell-ide-engine"
163+
++ starsLine
152164

153165
installHie :: VersionNumber -> Action ()
154166
installHie versionNumber = do
@@ -233,7 +245,7 @@ getGhcPath = do
233245
return $ trim ghc'
234246

235247
-- |Read the local install root of the stack project specified by the VersionNumber
236-
-- Returns the filepath of the local install root.
248+
-- Returns the filepath of the local install root.
237249
-- Equal to the command `stack path --local-install-root`
238250
getLocalInstallRoot :: VersionNumber -> Action FilePath
239251
getLocalInstallRoot hieVersion = do

shake.yaml

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,8 @@ resolver: lts-12.25 # GHC 8.4.4
33
packages:
44
- .
55

6+
extra-packages:
7+
- shake-0.17.4
8+
69
nix:
7-
packages: [ zlib ]
10+
packages: [ zlib ]

0 commit comments

Comments
 (0)