Skip to content

Commit 89c699b

Browse files
committed
Do build of upstream targets for ghci and --only-configure commercialhaskell#2787
1 parent 3541d38 commit 89c699b

5 files changed

Lines changed: 16 additions & 10 deletions

File tree

src/Control/Concurrent/Execute.hs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ data Action = Action
3838
data ActionContext = ActionContext
3939
{ acRemaining :: !(Set ActionId)
4040
-- ^ Does not include the current action
41+
, acDownstream :: [Action]
42+
-- ^ Actions which depend on the current action
4143
}
42-
deriving Show
4344

4445
data ExecuteState = ExecuteState
4546
{ esActions :: TVar [Action]
@@ -123,6 +124,7 @@ runActions' ExecuteState {..} =
123124
return $ mask $ \restore -> do
124125
eres <- try $ restore $ actionDo action ActionContext
125126
{ acRemaining = remaining
127+
, acDownstream = downstreamActions (actionId action) as'
126128
}
127129
atomically $ do
128130
unlock
@@ -134,3 +136,6 @@ runActions' ExecuteState {..} =
134136
let dropDep a = a { actionDeps = Set.delete (actionId action) $ actionDeps a }
135137
in modifyTVar esActions $ map dropDep
136138
restore loop
139+
140+
downstreamActions :: ActionId -> [Action] -> [Action]
141+
downstreamActions aid = filter (\a -> aid `Set.member` actionDeps a)

src/Stack/Build/Execute.hs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,9 +1181,14 @@ singleBuild runInBase ac@ActionContext {..} ee@ExecuteEnv {..} task@Task {..} in
11811181
_neededConfig <- ensureConfig cache pkgDir ee (announce ("configure" <> annSuffix)) cabal cabalfp
11821182

11831183
case ( boptsCLIOnlyConfigure eeBuildOptsCLI
1184-
, boptsCLIInitialBuildSteps eeBuildOptsCLI && isTarget) of
1185-
(True, _) -> return Nothing
1186-
(_, True) -> do
1184+
, boptsCLIInitialBuildSteps eeBuildOptsCLI && isTarget
1185+
, acDownstream) of
1186+
-- A full build is done if there are downstream actions,
1187+
-- because their configure step will require that this
1188+
-- package is built. See
1189+
-- https://github.com/commercialhaskell/stack/issues/2787
1190+
(True, _, []) -> return Nothing
1191+
(_, True, []) -> do
11871192
initialBuildSteps cabal announce
11881193
return Nothing
11891194
_ -> liftM Just $ realBuild cache package pkgDir cabal announce

src/Stack/Ghci.hs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -292,10 +292,6 @@ getAllLocalTargets GhciOpts{..} targets0 mainIsTargets sourceMap = do
292292

293293
buildDepsAndInitialSteps :: (StackM r m, HasEnvConfig r, MonadBaseUnlift IO m) => GhciOpts -> [Text] -> m ()
294294
buildDepsAndInitialSteps GhciOpts{..} targets0 = do
295-
-- Deprecation notice about --no-build
296-
when ghciNoBuild $ $prettyWarn $
297-
"The --no-build flag should no longer be needed, and is now deprecated." <> line <>
298-
"See this resolved issue: https://github.com/commercialhaskell/stack/issues/1364"
299295
let targets = targets0 ++ map T.pack ghciAdditionalPackages
300296
-- If necessary, do the build, for local packagee targets, only do
301297
-- 'initialBuildSteps'.

src/Stack/Options/GhciParser.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ ghciOptsParser = GhciOpts
4040
-- TODO: deprecate this? probably useless.
4141
<*> switch (long "skip-intermediate-deps" <> help "Skip loading intermediate target dependencies" <> internal)
4242
<*> boolFlags True "package-hiding" "package hiding" idm
43-
<*> switch (long "no-build" <> help "Don't build before launching GHCi (deprecated, should be unneeded)" <> internal)
43+
<*> switch (long "no-build" <> help "Don't build before launching GHCi" <> internal)

src/Stack/SDist.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ getSDistFileList lp =
226226
return (contents, cabalfp)
227227
where
228228
package = lpPackage lp
229-
ac = ActionContext Set.empty
229+
ac = ActionContext Set.empty []
230230
task = Task
231231
{ taskProvides = PackageIdentifier (packageName package) (packageVersion package)
232232
, taskType = TTLocal lp

0 commit comments

Comments
 (0)