Skip to content

Commit eaff251

Browse files
authored
Merge pull request #6949 from commercialhaskell/re6944
Re #6944 Warn if `--force-dirty` redundant
2 parents d40a138 + 286f642 commit eaff251

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

ChangeLog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ Behavior changes:
2727
* With Nix integration, Stack uses `nix-instantiate` before `nix-shell`,
2828
enabling Stack to catch and report when the Nix expression cannot be
2929
evaluated by Nix. The `nix-instantiate-options` option is added, accordingly.
30+
* Stack's `build` command now warns if `--force-dirty` is specified but no
31+
local packages will be built.
3032

3133
Other enhancements:
3234

src/Stack/Build.hs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,20 @@ build msetLocalFiles = do
199199
boptsCli.initialBuildSteps
200200

201201
allowLocals <- view $ configL . to (.allowLocals)
202-
unless allowLocals $ case justLocals plan of
203-
[] -> pure ()
204-
localsIdents -> throwM $ LocalPackagesPresent localsIdents
202+
case justLocals plan of
203+
[] -> when bopts.forceDirty $ prettyWarn $
204+
fillSep
205+
[ style Shell "--force-dirty"
206+
, flow "is specified but no local packages will be built."
207+
]
208+
<> blankLine
209+
<> flow "If your aim is that Stack rebuilds an installed package (one \
210+
\registered in the relevant package database) that Stack deems \
211+
\immutable, first unregister it from the database by commanding:"
212+
<> blankLine
213+
<> style Shell "stack exec -- ghc-pkg unregister --force <package>"
214+
localsIdents -> unless allowLocals $
215+
throwM $ LocalPackagesPresent localsIdents
205216

206217
checkCabalVersion
207218
haddockCompsSupported <- warnAboutHaddockComps bopts

0 commit comments

Comments
 (0)