From e20ea864fefdb89f1a2f6af9588135c173d58b5d Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Tue, 18 Aug 2015 20:09:37 +0300 Subject: [PATCH 1/2] Fix haddock executable name --- src/Stack/Build/Haddock.hs | 2 +- src/Stack/Types/Compiler.hs | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Stack/Build/Haddock.hs b/src/Stack/Build/Haddock.hs index 7c2e67eb58..b8418f202e 100644 --- a/src/Stack/Build/Haddock.hs +++ b/src/Stack/Build/Haddock.hs @@ -203,7 +203,7 @@ generateHaddockIndex descr envOverride wc packageIDs docRelDir destDir = do readProcessNull (Just destDir) envOverride - (compilerExeName wc) + (haddockExeName wc) (["--gen-contents", "--gen-index"] ++ concatMap fst interfaceOpts) where toInterfaceOpt pid@(PackageIdentifier name _) = do diff --git a/src/Stack/Types/Compiler.hs b/src/Stack/Types/Compiler.hs index 9e76fbc1ac..51101c8cd0 100644 --- a/src/Stack/Types/Compiler.hs +++ b/src/Stack/Types/Compiler.hs @@ -75,3 +75,7 @@ isWantedCompiler _ _ _ = False compilerExeName :: WhichCompiler -> String compilerExeName Ghc = "ghc" compilerExeName Ghcjs = "ghcjs" + +haddockExeName :: WhichCompiler -> String +haddockExeName Ghc = "haddock" +haddockExeName Ghcjs = "haddock-ghcjs" From 4cbca17246a457e740c937522b40382b20422cc5 Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Wed, 19 Aug 2015 08:18:45 +0300 Subject: [PATCH 2/2] More fine grained recompile checking --- src/Stack/Build/ConstructPlan.hs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/Stack/Build/ConstructPlan.hs b/src/Stack/Build/ConstructPlan.hs index 5b3b2f3e4d..5fcdf0738d 100644 --- a/src/Stack/Build/ConstructPlan.hs +++ b/src/Stack/Build/ConstructPlan.hs @@ -445,7 +445,7 @@ checkDirtiness ps installed package present wanted = do case moldOpts of Nothing -> Just "old configure information not found" Just oldOpts - | oldOpts /= wantConfigCache -> Just $ describeConfigDiff oldOpts wantConfigCache + | Just reason <- describeConfigDiff oldOpts wantConfigCache -> Just reason | psDirty ps -> Just "local file changes" | otherwise -> Nothing case mreason of @@ -454,19 +454,20 @@ checkDirtiness ps installed package present wanted = do tell mempty { wDirty = Map.singleton (packageName package) reason } return True -describeConfigDiff :: ConfigCache -> ConfigCache -> Text +describeConfigDiff :: ConfigCache -> ConfigCache -> Maybe Text describeConfigDiff old new - | configCacheDeps old /= configCacheDeps new = "dependencies changed" - | configCacheComponents old /= configCacheComponents new = "components changed" - | configCacheHaddock old && not (configCacheHaddock new) = "no longer building haddocks" - | not (configCacheHaddock old) && configCacheHaddock new = "building haddocks" - | oldOpts /= newOpts = T.pack $ concat + | configCacheDeps old /= configCacheDeps new = Just "dependencies changed" + | not $ Set.null newComponents = + Just $ "components added: " `T.append` T.intercalate ", " + (map (decodeUtf8With lenientDecode) (Set.toList newComponents)) + | not (configCacheHaddock old) && configCacheHaddock new = Just "rebuilding with haddocks" + | oldOpts /= newOpts = Just $ T.pack $ concat [ "flags changed from " , show oldOpts , " to " , show newOpts ] - | otherwise = "unknown config cache difference" + | otherwise = Nothing where -- options set by stack isStackOpt t = any (`T.isPrefixOf` t) @@ -487,6 +488,8 @@ describeConfigDiff old new | x == y = removeMatching xs ys removeMatching xs ys = (xs, ys) + newComponents = configCacheComponents new `Set.difference` configCacheComponents old + psDirty :: PackageSource -> Bool psDirty (PSLocal lp) = lpDirtyFiles lp psDirty (PSUpstream _ _ _) = False -- files never change in an upstream package