@@ -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
@@ -118,23 +122,12 @@ mkBuildInfo' compilerInfo componentInfos =
118122 , " components" .= JsonArray componentInfos
119123 ]
120124
121- mkCompilerInfo :: ProgramDb -> Compiler -> Json
122- mkCompilerInfo programDb compilerInfo = JsonObject
125+ mkCompilerInfo :: ConfiguredProgram -> Compiler -> Json
126+ mkCompilerInfo compilerProgram compilerInfo = JsonObject
123127 [ " flavour" .= JsonString (prettyShow $ compilerFlavor compilerInfo)
124128 , " compiler-id" .= JsonString (showCompilerId compilerInfo)
125- , " path" .= path
129+ , " path" .= JsonString (programPath compilerProgram)
126130 ]
127- where
128- path = maybe JsonNull (JsonString . programPath)
129- $ (flavorToProgram . compilerFlavor $ compilerInfo)
130- >>= flip lookupProgram programDb
131-
132- flavorToProgram :: CompilerFlavor -> Maybe Program
133- flavorToProgram GHC = Just ghcProgram
134- flavorToProgram GHCJS = Just ghcjsProgram
135- flavorToProgram UHC = Just uhcProgram
136- flavorToProgram JHC = Just jhcProgram
137- flavorToProgram _ = Nothing
138131
139132mkComponentInfo :: FilePath -> PackageDescription -> LocalBuildInfo -> ComponentLocalBuildInfo -> ([String ], Json )
140133mkComponentInfo wdir pkg_descr lbi clbi = (warnings, JsonObject $
0 commit comments