on master help sign in
Make sure all interfaces are loaded for --debug metadata
5673195Evan Czaplicki
builder/src/Generate/Output.hs+23−7
@@ -61,7 +61,7 @@ generate
61 -> Crawl.Result
61 -> Crawl.Result
62 -> Map.Map Module.Raw Compiler.Artifacts
62 -> Map.Map Module.Raw Compiler.Artifacts
63 -> Task.Task ()
63 -> Task.Task ()
64−generate mode target maybeOutput summary graph@(Crawl.Graph args _ _ _ _) artifacts =
64+generate mode target maybeOutput summary graph@(Crawl.Graph args locals _ _ _) artifacts =
65 case args of
65 case args of
66 Args.Pkg _ ->
66 Args.Pkg _ ->
67 return ()
67 return ()
@@ -72,7 +72,8 @@ generate mode target maybeOutput summary graph@(Crawl.Graph args _ _ _ _) artifa
72 realMode <-
72 realMode <-
73 case mode of
73 case mode of
74 Debug ->
74 Debug ->
75+ do interfaces <- getInterfaces summary locals artifacts
75− return $ Mode.debug target (getInterfaces summary artifacts)
76+ return $ Mode.debug target interfaces
76
77
77 Dev ->
78 Dev ->
78 return $ Mode.dev target
79 return $ Mode.dev target
@@ -84,14 +85,29 @@ generate mode target maybeOutput summary graph@(Crawl.Graph args _ _ _ _) artifa
84 generateMonolith realMode maybeOutput summary objectGraph (name:names)
85 generateMonolith realMode maybeOutput summary objectGraph (name:names)
85
86
86
87
88+getInterfaces
89+ :: Summary.Summary
90+ -> Map.Map Module.Raw a
87−getInterfaces :: Summary.Summary -> Map.Map Module.Raw Compiler.Artifacts -> I.Interfaces
91+ -> Map.Map Module.Raw Compiler.Artifacts
92+ -> Task.Task I.Interfaces
88−getInterfaces (Summary.Summary _ project _ interfaces _) artifacts =
93+getInterfaces (Summary.Summary root project _ interfaces _) locals artifacts =
89 let
94 let
95+ pkg =
90− pkg = Project.getName project
96+ Project.getName project
97+
91 addArtifact home (Compiler.Artifacts elmi _ _) ifaces =
98 addArtifact home (Compiler.Artifacts elmi _ _) ifaces =
99+ (ModuleName.Canonical pkg home, elmi) : ifaces
100+
101+ addInterface home iface ifaces =
92− Map.insert (ModuleName.Canonical pkg home) elmi ifaces
102+ (ModuleName.Canonical pkg home, iface) : ifaces
103+
104+ readInterface home _ =
105+ IO.readBinary (Paths.elmi root home)
93 in
106 in
107+ do cached <- Map.traverseWithKey readInterface (Map.difference locals artifacts)
108+ return $
109+ Map.union interfaces $ Map.fromList $
94− Map.foldrWithKey addArtifact interfaces artifacts
110+ Map.foldrWithKey addInterface (Map.foldrWithKey addArtifact [] artifacts) cached
95
111
96
112
97
113