@@ -93,11 +93,15 @@ mkBuildInfo
9393 -> PackageDescription -- ^ Mostly information from the .cabal file
9494 -> LocalBuildInfo -- ^ Configuration information
9595 -> BuildFlags -- ^ Flags that the user passed to build
96+ -> (ConfiguredProgram , Compiler )
97+ -- ^ Compiler information.
98+ -- Needs to be passed explicitly, as we can't extract that information here
99+ -- without some partial function.
96100 -> [TargetInfo ]
97101 -> ([String ], Json ) -- ^ Json representation of buildinfo alongside generated warnings
98- mkBuildInfo wdir pkg_descr lbi _flags targetsToBuild = (warnings, JsonObject buildInfoFields)
102+ mkBuildInfo wdir pkg_descr lbi _flags compilerInfo targetsToBuild = (warnings, JsonObject buildInfoFields)
99103 where
100- buildInfoFields = mkBuildInfo' (mkCompilerInfo (withPrograms lbi) (compiler lbi) ) componentInfos
104+ buildInfoFields = mkBuildInfo' (uncurry mkCompilerInfo compilerInfo ) componentInfos
101105 componentInfosWithWarnings = map (mkComponentInfo wdir pkg_descr lbi . targetCLBI) targetsToBuild
102106 componentInfos = map snd componentInfosWithWarnings
103107 warnings = concatMap fst componentInfosWithWarnings
@@ -114,23 +118,12 @@ mkBuildInfo' compilerInfo componentInfos =
114118 , " components" .= JsonArray componentInfos
115119 ]
116120
117- mkCompilerInfo :: ProgramDb -> Compiler -> Json
118- mkCompilerInfo programDb compilerInfo = JsonObject
121+ mkCompilerInfo :: ConfiguredProgram -> Compiler -> Json
122+ mkCompilerInfo compilerProgram compilerInfo = JsonObject
119123 [ " flavour" .= JsonString (prettyShow $ compilerFlavor compilerInfo)
120124 , " compiler-id" .= JsonString (showCompilerId compilerInfo)
121- , " path" .= path
125+ , " path" .= JsonString (programPath compilerProgram)
122126 ]
123- where
124- path = maybe JsonNull (JsonString . programPath)
125- $ (flavorToProgram . compilerFlavor $ compilerInfo)
126- >>= flip lookupProgram programDb
127-
128- flavorToProgram :: CompilerFlavor -> Maybe Program
129- flavorToProgram GHC = Just ghcProgram
130- flavorToProgram GHCJS = Just ghcjsProgram
131- flavorToProgram UHC = Just uhcProgram
132- flavorToProgram JHC = Just jhcProgram
133- flavorToProgram _ = Nothing
134127
135128mkComponentInfo :: FilePath -> PackageDescription -> LocalBuildInfo -> ComponentLocalBuildInfo -> ([String ], Json )
136129mkComponentInfo wdir pkg_descr lbi clbi = (warnings, JsonObject $
0 commit comments