Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/Stack/Build/ExecutePackage.hs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ import Stack.Types.ComponentUtils
( StackUnqualCompName, toCabalName, unqualCompToString
, unqualCompToText
)
import Stack.Types.Config ( Config (..), HasConfig (..) )
import Stack.Types.Config ( Config (..), HasConfig (..), buildOptsL )
import Stack.Types.ConfigureOpts
( BaseConfigOpts (..), ConfigureOpts (..) )
import Stack.Types.Curator ( Curator (..) )
Expand Down Expand Up @@ -481,6 +481,7 @@ singleBuild
case mprecompiled of
Just precompiled ->
copyPreCompiled isCInstTask ee task pkgId precompiled
<* warnImmutableCacheWithForceDirty
Nothing -> do
curator <- view $ buildConfigL . to (.curator)
realConfigAndBuild
Expand Down Expand Up @@ -512,6 +513,19 @@ singleBuild
enableBenchmarks = buildingFinals
&& componentEnableBenchmarks ck (taskComponents task)

-- Give a hint for surprisingly cached builds, https://github.com/commercialhaskell/stack/issues/1476
warnImmutableCacheWithForceDirty = do
forceDirtyFlagGiven <- view $ buildOptsL . to (.forceDirty)
targetsCLI <- view $ envConfigL . to (.buildOptsCLI.targetsCLI)
when (forceDirtyFlagGiven && fromPackageName (pkgName pkgId) `elem` targetsCLI) $ do
let pkg = fromPackageName (pkgName pkgId)
prettyNote $
fillSep [flow "Immutable snapshot package", style Current pkg, flow "picked from cached build despite --force-dirty."]
<> blankLine
<> flow "To force removal of cached build, try `stack exec -- ghc-pkg unregister --force " <+> pkg <> "`."
<> blankLine
<> flow "See Stack issue #1476 for more details."

realConfigAndBuild ::
forall env a. HasEnvConfig env
=> ActionContext
Expand Down
Loading