Skip to content

Commit 1a5bede

Browse files
authored
Merge pull request #276 from harendra-kumar/solver
Use default resolver to solve for and install helper bins
2 parents 81882bf + bc30da4 commit 1a5bede

File tree

1 file changed

+17
-18
lines changed

1 file changed

+17
-18
lines changed

scripts/setup_haskell.hs

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,13 @@ setupHaskell = do
144144
"dependencies.cabal"
145145
(toStrict helperDependenciesCabalText)
146146
Turtle.stdout (Turtle.input "dependencies.cabal")
147-
let solverCommand = "stack init --solver --install-ghc"
147+
let solverCommand = "stack init --solver --resolver "
148+
<> stackResolver
149+
<> " --install-ghc"
150+
-- XXX for best results we should solve and install each one of them
151+
-- independently rather than solving them together. It becomes more
152+
-- difficult for the solver to find a workable build plan when we
153+
-- solve them together.
148154
-- Solve the versions of all helper binaries listed in
149155
-- dependencies.cabal.
150156
solverResult <- Turtle.shell solverCommand empty
@@ -164,18 +170,14 @@ setupHaskell = do
164170
(Turtle.begins ("#" <|> "user-message" <|> " ") *>
165171
pure "")
166172
(Turtle.input "stack.yaml.bak")))
167-
versionedHelperDeps <-
168-
fmap Turtle.lineToText <$>
169-
Turtle.fold
170-
(mfilter
171-
(filterHelperDeps . Turtle.lineToText)
172-
(Turtle.inshell "stack list-dependencies --separator -"
173-
empty))
174-
Foldl.list
175-
helperDepStackResolver <- stackResolverText $
176-
hvnHelperBinDir </> "stack.yaml"
177-
forM_ versionedHelperDeps $ \dep ->
178-
stackInstall helperDepStackResolver dep
173+
-- XXX I could not figure out how to keep the ">" sign unescaped in
174+
-- mustache, so had to treat this especially. If we can do that then
175+
-- we can push this as well in helperDependencies.
176+
stackInstall stackResolver "hscope"
177+
forM_ (map (head . Text.words) helperDependencies) $
178+
\dep -> stackInstall stackResolver dep
179+
-- XXX we should remove the temporary dir after installing to reclaim
180+
-- unnecessary space.
179181
msg "Installing git-hscope..."
180182
-- TODO: The 'git-hscope' file won't do much good on Windows as it
181183
-- is a bash script.
@@ -245,15 +247,10 @@ helperDependencies =
245247
, "hasktags"
246248
, "hlint"
247249
, "hoogle"
248-
, "hscope"
249250
, "pointfree"
250251
, "pointful"
251252
]
252253

253-
filterHelperDeps :: Text -> Bool
254-
filterHelperDeps dep =
255-
any ($ dep) (fmap Text.isPrefixOf helperDependencies)
256-
257254
helperDependenciesCabalTemplate :: Template
258255
helperDependenciesCabalTemplate = [mustache|name: dependencies
259256
version: 0.1.0.0
@@ -267,7 +264,9 @@ build-type: Simple
267264
cabal-version: >=1.10
268265

269266
library
267+
-- hscope 0.4 does not compile with most resolvers so use newer
270268
build-depends: base >=4.9 && <4.10
269+
, hscope > 0.4
271270
{{#dependencies}}
272271
, {{.}}
273272
{{/dependencies}}

0 commit comments

Comments
 (0)