From b763b0efaa10cfafff51c0e01bc5157b6f063368 Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Wed, 19 Aug 2015 14:11:27 +0300 Subject: [PATCH] Properly set flags for implicit extra-deps #807 --- src/Stack/Build/Source.hs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/Stack/Build/Source.hs b/src/Stack/Build/Source.hs index 6c43711b29..d8b1cf10a1 100644 --- a/src/Stack/Build/Source.hs +++ b/src/Stack/Build/Source.hs @@ -119,7 +119,22 @@ loadSourceMap needTargets bopts = do -- Overwrite any flag settings with those from the config file extraDeps3 = Map.mapWithKey - (\n (v, f) -> PSUpstream v Local $ fromMaybe f $ Map.lookup n $ bcFlags bconfig) + (\n (v, f) -> PSUpstream v Local $ + case ( Map.lookup (Just n) $ boptsFlags bopts + , Map.lookup Nothing $ boptsFlags bopts + , Map.lookup n $ bcFlags bconfig + ) of + -- Didn't have any flag overrides, fall back to the flags + -- defined in the snapshot. + (Nothing, Nothing, Nothing) -> f + -- Either command line flag for this package, general + -- command line flag, or flag in stack.yaml is defined. + -- Take all of those and ignore the snapshot flags. + (x, y, z) -> Map.unions + [ fromMaybe Map.empty x + , fromMaybe Map.empty y + , fromMaybe Map.empty z + ]) extraDeps2 let sourceMap = Map.unions