From 09a9fa46fd1d8174ececf4a53774a05b36641457 Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Sat, 18 Jul 2015 02:46:35 +0300 Subject: [PATCH] --force-dirty flag --- ChangeLog.md | 1 + src/Stack/Build/Source.hs | 2 +- src/Stack/Build/Types.hs | 3 +++ src/Stack/Options.hs | 6 +++++- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 40a9549b71..ee406ff64a 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -7,6 +7,7 @@ * Upper limit on number of flag combinations to test [#543](https://github.com/commercialhaskell/stack/issues/543) * Fuzzy matching support to give better error messages for close version numbers [#504](https://github.com/commercialhaskell/stack/issues/504) * --local-bin-path global option. Use to change where binaries get placed on an `stack install` [#342](https://github.com/commercialhaskell/stack/issues/342) +* --force-dirty flag: Force treating all local packages as having dirty files (useful for cases where stack can't detect a file change) ## 0.1.2.0 diff --git a/src/Stack/Build/Source.hs b/src/Stack/Build/Source.hs index e31210480c..42c17c19be 100644 --- a/src/Stack/Build/Source.hs +++ b/src/Stack/Build/Source.hs @@ -233,7 +233,7 @@ loadLocals bopts latestVersion = do , lpPackageFinal = pkgFinal , lpWanted = wanted , lpFiles = files - , lpDirtyFiles = isDirty + , lpDirtyFiles = isDirty || boptsForceDirty bopts , lpNewBuildCache = newBuildCache , lpCabalFile = cabalfp , lpDir = dir diff --git a/src/Stack/Build/Types.hs b/src/Stack/Build/Types.hs index a4f601df7a..4606c55702 100644 --- a/src/Stack/Build/Types.hs +++ b/src/Stack/Build/Types.hs @@ -311,6 +311,8 @@ data BuildOpts = -- ^ Watch files for changes and automatically rebuild ,boptsKeepGoing :: !(Maybe Bool) -- ^ Keep building/running after failure + ,boptsForceDirty :: !Bool + -- ^ Force treating all local packages as having dirty files } deriving (Show) @@ -331,6 +333,7 @@ defaultBuildOpts = BuildOpts , boptsOnlySnapshot = False , boptsFileWatch = False , boptsKeepGoing = Nothing + , boptsForceDirty = False } -- | Options for the 'FinalAction' 'DoTests' diff --git a/src/Stack/Options.hs b/src/Stack/Options.hs index 5eefb53e1f..7f274f71de 100644 --- a/src/Stack/Options.hs +++ b/src/Stack/Options.hs @@ -62,7 +62,7 @@ buildOptsParser cmd = BuildOpts <$> target <*> libProfiling <*> exeProfiling <*> optimize <*> haddock <*> haddockDeps <*> finalAction <*> dryRun <*> ghcOpts <*> flags <*> installExes <*> preFetch <*> onlySnapshot <*> - fileWatch' <*> keepGoing + fileWatch' <*> keepGoing <*> forceDirty where optimize = maybeBoolFlags "optimizations" "optimizations for TARGETs and all its dependencies" idm target = @@ -130,6 +130,10 @@ buildOptsParser cmd = "continue running after a step fails (default: false for build, true for test/bench)" idm + forceDirty = flag False True + (long "force-dirty" <> + help "Force treating all local packages as having dirty files (useful for cases where stack can't detect a file change)") + -- | Parser for package:[-]flag readFlag :: ReadM (Map (Maybe PackageName) (Map FlagName Bool)) readFlag = do