From ebe43052481d9c7bb73f9b9f1f78dfff93ff1a81 Mon Sep 17 00:00:00 2001 From: Michael Sloan Date: Fri, 19 Feb 2016 02:50:29 -0800 Subject: [PATCH] Clarify --force-dirty reason for rebuild --- src/Stack/Build/ConstructPlan.hs | 5 +++++ src/Stack/Build/Source.hs | 3 ++- src/Stack/SDist.hs | 3 ++- src/Stack/Types/Package.hs | 1 + 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Stack/Build/ConstructPlan.hs b/src/Stack/Build/ConstructPlan.hs index f7b9c94efa..b122ae5b46 100644 --- a/src/Stack/Build/ConstructPlan.hs +++ b/src/Stack/Build/ConstructPlan.hs @@ -522,6 +522,7 @@ checkDirtiness ps installed package present wanted = do Nothing -> Just "old configure information not found" Just oldOpts | Just reason <- describeConfigDiff config oldOpts wantConfigCache -> Just reason + | True <- psForceDirty ps -> Just "--force-dirty specified" | Just files <- psDirty ps -> Just $ "local file changes: " <> addEllipsis (T.pack $ unwords $ Set.toList files) | otherwise -> Nothing @@ -606,6 +607,10 @@ describeConfigDiff config old new newComponents = configCacheComponents new `Set.difference` configCacheComponents old +psForceDirty :: PackageSource -> Bool +psForceDirty (PSLocal lp) = lpForceDirty lp +psForceDirty (PSUpstream {}) = False + psDirty :: PackageSource -> Maybe (Set FilePath) psDirty (PSLocal lp) = lpDirtyFiles lp psDirty (PSUpstream {}) = Nothing -- files never change in an upstream package diff --git a/src/Stack/Build/Source.hs b/src/Stack/Build/Source.hs index 359dea6946..5ed27441ed 100644 --- a/src/Stack/Build/Source.hs +++ b/src/Stack/Build/Source.hs @@ -347,8 +347,9 @@ loadLocalPackage bopts targets (name, (lpv, gpkg)) = do , lpBenchDeps = packageDeps benchpkg , lpTestBench = btpkg , lpFiles = files + , lpForceDirty = boptsForceDirty bopts , lpDirtyFiles = - if not (Set.null dirtyFiles) || boptsForceDirty bopts + if not (Set.null dirtyFiles) then let tryStripPrefix y = fromMaybe y (stripPrefix (toFilePath $ lpvRoot lpv) y) in Just $ Set.map tryStripPrefix dirtyFiles diff --git a/src/Stack/SDist.hs b/src/Stack/SDist.hs index 4a84f63421..26280ccfdc 100644 --- a/src/Stack/SDist.hs +++ b/src/Stack/SDist.hs @@ -189,7 +189,8 @@ readLocalPackage pkgDir = do , lpTestDeps = Map.empty , lpBenchDeps = Map.empty , lpTestBench = Nothing - , lpDirtyFiles = Just Set.empty + , lpForceDirty = False + , lpDirtyFiles = Nothing , lpNewBuildCache = Map.empty , lpFiles = Set.empty , lpComponents = Set.empty diff --git a/src/Stack/Types/Package.hs b/src/Stack/Types/Package.hs index 2f6d4fb568..f8696f8b7f 100644 --- a/src/Stack/Types/Package.hs +++ b/src/Stack/Types/Package.hs @@ -236,6 +236,7 @@ data LocalPackage = LocalPackage -- ^ Directory of the package. , lpCabalFile :: !(Path Abs File) -- ^ The .cabal file + , lpForceDirty :: !Bool , lpDirtyFiles :: !(Maybe (Set FilePath)) -- ^ Nothing == not dirty, Just == dirty. Note that the Set may be empty if -- we forced the build to treat packages as dirty. Also, the Set may not