Skip to content

Commit

Permalink
Do build of upstream targets for ghci and --only-configure #2787
Browse files Browse the repository at this point in the history
  • Loading branch information
mgsloan committed Nov 19, 2016
1 parent 3541d38 commit 89c699b
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 10 deletions.
7 changes: 6 additions & 1 deletion src/Control/Concurrent/Execute.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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
Expand All @@ -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)
11 changes: 8 additions & 3 deletions src/Stack/Build/Execute.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions src/Stack/Ghci.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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'.
Expand Down
2 changes: 1 addition & 1 deletion src/Stack/Options/GhciParser.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion src/Stack/SDist.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 89c699b

Please sign in to comment.