diff --git a/src/Control/Concurrent/Execute.hs b/src/Control/Concurrent/Execute.hs index 8ba3a7d182..55d0828c57 100644 --- a/src/Control/Concurrent/Execute.hs +++ b/src/Control/Concurrent/Execute.hs @@ -38,8 +38,9 @@ data Action = Action data ActionContext = ActionContext { acRemaining :: !(Set ActionId) -- ^ Does not include the current action + , acDownstream :: [Action] + -- ^ Actions which depend on the current action } - deriving Show data ExecuteState = ExecuteState { esActions :: TVar [Action] @@ -123,6 +124,7 @@ runActions' ExecuteState {..} = return $ mask $ \restore -> do eres <- try $ restore $ actionDo action ActionContext { acRemaining = remaining + , acDownstream = downstreamActions (actionId action) as' } atomically $ do unlock @@ -134,3 +136,6 @@ runActions' ExecuteState {..} = let dropDep a = a { actionDeps = Set.delete (actionId action) $ actionDeps a } in modifyTVar esActions $ map dropDep restore loop + +downstreamActions :: ActionId -> [Action] -> [Action] +downstreamActions aid = filter (\a -> aid `Set.member` actionDeps a) diff --git a/src/Stack/Build/Execute.hs b/src/Stack/Build/Execute.hs index a4c396cecf..8c3ab2f7b4 100644 --- a/src/Stack/Build/Execute.hs +++ b/src/Stack/Build/Execute.hs @@ -1181,9 +1181,14 @@ singleBuild runInBase ac@ActionContext {..} ee@ExecuteEnv {..} task@Task {..} in _neededConfig <- ensureConfig cache pkgDir ee (announce ("configure" <> annSuffix)) cabal cabalfp case ( boptsCLIOnlyConfigure eeBuildOptsCLI - , boptsCLIInitialBuildSteps eeBuildOptsCLI && isTarget) of - (True, _) -> return Nothing - (_, True) -> do + , boptsCLIInitialBuildSteps eeBuildOptsCLI && isTarget + , acDownstream) of + -- A full build is done if there are downstream actions, + -- because their configure step will require that this + -- package is built. See + -- https://github.com/commercialhaskell/stack/issues/2787 + (True, _, []) -> return Nothing + (_, True, []) -> do initialBuildSteps cabal announce return Nothing _ -> liftM Just $ realBuild cache package pkgDir cabal announce diff --git a/src/Stack/Ghci.hs b/src/Stack/Ghci.hs index a62551e871..203a8d51d5 100644 --- a/src/Stack/Ghci.hs +++ b/src/Stack/Ghci.hs @@ -292,10 +292,6 @@ getAllLocalTargets GhciOpts{..} targets0 mainIsTargets sourceMap = do buildDepsAndInitialSteps :: (StackM r m, HasEnvConfig r, MonadBaseUnlift IO m) => GhciOpts -> [Text] -> m () buildDepsAndInitialSteps GhciOpts{..} targets0 = do - -- Deprecation notice about --no-build - when ghciNoBuild $ $prettyWarn $ - "The --no-build flag should no longer be needed, and is now deprecated." <> line <> - "See this resolved issue: https://github.com/commercialhaskell/stack/issues/1364" let targets = targets0 ++ map T.pack ghciAdditionalPackages -- If necessary, do the build, for local packagee targets, only do -- 'initialBuildSteps'. diff --git a/src/Stack/Options/GhciParser.hs b/src/Stack/Options/GhciParser.hs index 2d6f79312b..0110f1bc46 100644 --- a/src/Stack/Options/GhciParser.hs +++ b/src/Stack/Options/GhciParser.hs @@ -40,4 +40,4 @@ ghciOptsParser = GhciOpts -- TODO: deprecate this? probably useless. <*> switch (long "skip-intermediate-deps" <> help "Skip loading intermediate target dependencies" <> internal) <*> boolFlags True "package-hiding" "package hiding" idm - <*> switch (long "no-build" <> help "Don't build before launching GHCi (deprecated, should be unneeded)" <> internal) + <*> switch (long "no-build" <> help "Don't build before launching GHCi" <> internal) diff --git a/src/Stack/SDist.hs b/src/Stack/SDist.hs index 1097d09e78..d4cd660f12 100644 --- a/src/Stack/SDist.hs +++ b/src/Stack/SDist.hs @@ -226,7 +226,7 @@ getSDistFileList lp = return (contents, cabalfp) where package = lpPackage lp - ac = ActionContext Set.empty + ac = ActionContext Set.empty [] task = Task { taskProvides = PackageIdentifier (packageName package) (packageVersion package) , taskType = TTLocal lp