@@ -90,11 +90,15 @@ mkBuildInfo
9090 -> PackageDescription -- ^ Mostly information from the .cabal file
9191 -> LocalBuildInfo -- ^ Configuration information
9292 -> BuildFlags -- ^ Flags that the user passed to build
93+ -> (ConfiguredProgram , Compiler )
94+ -- ^ Compiler information.
95+ -- Needs to be passed explicitly, as we can't extract that information here
96+ -- without some partial function.
9397 -> [TargetInfo ]
9498 -> ([String ], Json ) -- ^ Json representation of buildinfo alongside generated warnings
95- mkBuildInfo wdir pkg_descr lbi _flags targetsToBuild = (warnings, JsonObject buildInfoFields)
99+ mkBuildInfo wdir pkg_descr lbi _flags compilerInfo targetsToBuild = (warnings, JsonObject buildInfoFields)
96100 where
97- buildInfoFields = mkBuildInfo' (mkCompilerInfo (withPrograms lbi) (compiler lbi) ) componentInfos
101+ buildInfoFields = mkBuildInfo' (uncurry mkCompilerInfo compilerInfo ) componentInfos
98102 componentInfosWithWarnings = map (mkComponentInfo wdir pkg_descr lbi . targetCLBI) targetsToBuild
99103 componentInfos = map snd componentInfosWithWarnings
100104 warnings = concatMap fst componentInfosWithWarnings
@@ -111,23 +115,12 @@ mkBuildInfo' compilerInfo componentInfos =
111115 , " components" .= JsonArray componentInfos
112116 ]
113117
114- mkCompilerInfo :: ProgramDb -> Compiler -> Json
115- mkCompilerInfo programDb compilerInfo = JsonObject
118+ mkCompilerInfo :: ConfiguredProgram -> Compiler -> Json
119+ mkCompilerInfo compilerProgram compilerInfo = JsonObject
116120 [ " flavour" .= JsonString (prettyShow $ compilerFlavor compilerInfo)
117121 , " compiler-id" .= JsonString (showCompilerId compilerInfo)
118- , " path" .= path
122+ , " path" .= JsonString (programPath compilerProgram)
119123 ]
120- where
121- path = maybe JsonNull (JsonString . programPath)
122- $ (flavorToProgram . compilerFlavor $ compilerInfo)
123- >>= flip lookupProgram programDb
124-
125- flavorToProgram :: CompilerFlavor -> Maybe Program
126- flavorToProgram GHC = Just ghcProgram
127- flavorToProgram GHCJS = Just ghcjsProgram
128- flavorToProgram UHC = Just uhcProgram
129- flavorToProgram JHC = Just jhcProgram
130- flavorToProgram _ = Nothing
131124
132125mkComponentInfo :: FilePath -> PackageDescription -> LocalBuildInfo -> ComponentLocalBuildInfo -> ([String ], Json )
133126mkComponentInfo wdir pkg_descr lbi clbi = (warnings, JsonObject $
0 commit comments