Skip to content

Commit 3ea8437

Browse files
committed
Have ghci load info after build
1 parent 71bf728 commit 3ea8437

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

ChangeLog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ Other enhancements:
1010

1111
Bug fixes:
1212

13+
* Previously, `stack ghci` would fail with `cannot satisfy -package-id` when the
14+
implicit build step changes the package key of some dependency.
15+
1316
## 1.0.2
1417

1518
Release notes:

src/Stack/Ghci.hs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,14 @@ ghciSetup bopts0 noBuild skipIntermediate mainIs additionalPackages = do
265265
let bopts = bopts0
266266
{ boptsTargets = boptsTargets bopts0 ++ map T.pack additionalPackages
267267
}
268+
-- Try to build, but optimistically launch GHCi anyway if it fails (#1065)
269+
unless noBuild $ do
270+
eres <- tryAny $ build (const (return ())) Nothing bopts
271+
case eres of
272+
Right () -> return ()
273+
Left err -> do
274+
$logError $ T.pack (show err)
275+
$logWarn "Warning: build failed, but optimistically launching GHCi anyway"
268276
econfig <- asks getEnvConfig
269277
(realTargets,_,_,_,sourceMap) <- loadSourceMap AllowNoTargets bopts
270278
menv <- getMinimalEnvOverride
@@ -298,14 +306,6 @@ ghciSetup bopts0 noBuild skipIntermediate mainIs additionalPackages = do
298306
, "\n(Use --skip-intermediate-deps to omit these)"
299307
]
300308
return (directlyWanted ++ intermediateDeps)
301-
-- Try to build, but optimistically launch GHCi anyway if it fails (#1065)
302-
unless noBuild $ do
303-
eres <- tryAny $ build (const (return ())) Nothing bopts
304-
case eres of
305-
Right () -> return ()
306-
Left err -> do
307-
$logError $ T.pack (show err)
308-
$logWarn "Warning: build failed, but optimistically launching GHCi anyway"
309309
-- Load the list of modules _after_ building, to catch changes in unlisted dependencies (#1180)
310310
let localLibs = [name | (name, (_, target)) <- wanted , hasLocalComp isCLib target]
311311
infos <-

0 commit comments

Comments
 (0)