diff --git a/ChangeLog.md b/ChangeLog.md index 48082a3a8c..eaca9a2a9d 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -16,6 +16,9 @@ Other enhancements: Bug fixes: * When using the `STACK_YAML` env var with Docker, make the path absolute. +* Fix the problem of `stack repl foo:test:bar` failing without a project + build before that. See + [#5213](https://github.com/commercialhaskell/stack/issues/5213) * Fix `stack sdist` introducing unneded sublibrary syntax when using pvp-bounds. See diff --git a/src/Stack/Ghci.hs b/src/Stack/Ghci.hs index 34418d4cd2..3e40d46c92 100644 --- a/src/Stack/Ghci.hs +++ b/src/Stack/Ghci.hs @@ -183,8 +183,13 @@ ghci opts@GhciOpts{..} = do -- need is the location of main modules, not the rest. pkgs0 <- getGhciPkgInfos installMap addPkgs (fmap fst mfileTargets) pkgDescs figureOutMainFile bopts mainIsTargets localTargets pkgs0 + let pkgTargets pn targets = + case targets of + TargetAll _ -> [T.pack (packageNameString pn)] + TargetComps comps -> [renderPkgComponent (pn, c) | c <- toList comps] -- Build required dependencies and setup local packages. - buildDepsAndInitialSteps opts (map (T.pack . packageNameString . fst) localTargets) + buildDepsAndInitialSteps opts $ + concatMap (\(pn, (_, t)) -> pkgTargets pn t) localTargets targetWarnings localTargets nonLocalTargets mfileTargets -- Load the list of modules _after_ building, to catch changes in -- unlisted dependencies (#1180)