Commit 4856dbb1 authored by Edward Z. Yang's avatar Edward Z. Yang Committed by Edward Z. Yang
Browse files

Don't write to targetBuildDepends when flattening.



The recorded build-depends should be consistent with the
extra metadata we created when dep-solving. No need to
overwrite.
Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
parent b4fb3baa
......@@ -389,25 +389,12 @@ flattenTaggedTargets :: TargetSet PDTagged -> (Maybe Library, [(UnqualComponentN
flattenTaggedTargets (TargetSet targets) = foldr untag (Nothing, []) targets
where
untag (_, Lib _) (Just _, _) = userBug "Only one library expected"
untag (deps, Lib l) (Nothing, comps) =
(Just l', comps)
where
l' = l {
libBuildInfo = (libBuildInfo l) { targetBuildDepends = fromDepMap deps }
}
untag (deps, SubComp n c) (mb_lib, comps)
untag (_, Lib l) (Nothing, comps) = (Just l, comps)
untag (_, SubComp n c) (mb_lib, comps)
| any ((== n) . fst) comps =
userBug $ "There exist several components with the same name: '" ++ unUnqualComponentName n ++ "'"
| otherwise = (mb_lib, (n, c') : comps)
where
updBI bi = bi { targetBuildDepends = fromDepMap deps }
c' = case c of
CLib x -> CLib x { libBuildInfo = updBI (libBuildInfo x) }
CFLib x -> CFLib x { foreignLibBuildInfo = updBI (foreignLibBuildInfo x) }
CExe x -> CExe x { buildInfo = updBI (buildInfo x) }
CTest x -> CTest x { testBuildInfo = updBI (testBuildInfo x) }
CBench x -> CBench x { benchmarkBuildInfo = updBI (benchmarkBuildInfo x) }
| otherwise = (mb_lib, (n, c) : comps)
untag (_, PDNull) x = x -- actually this should not happen, but let's be liberal
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment