@@ -93,11 +93,15 @@ mkBuildInfo
93
93
-> PackageDescription -- ^ Mostly information from the .cabal file
94
94
-> LocalBuildInfo -- ^ Configuration information
95
95
-> 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.
96
100
-> [TargetInfo ]
97
101
-> ([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)
99
103
where
100
- buildInfoFields = mkBuildInfo' (mkCompilerInfo (withPrograms lbi) (compiler lbi) ) componentInfos
104
+ buildInfoFields = mkBuildInfo' (uncurry mkCompilerInfo compilerInfo ) componentInfos
101
105
componentInfosWithWarnings = map (mkComponentInfo wdir pkg_descr lbi . targetCLBI) targetsToBuild
102
106
componentInfos = map snd componentInfosWithWarnings
103
107
warnings = concatMap fst componentInfosWithWarnings
@@ -118,23 +122,12 @@ mkBuildInfo' compilerInfo componentInfos =
118
122
, " components" .= JsonArray componentInfos
119
123
]
120
124
121
- mkCompilerInfo :: ProgramDb -> Compiler -> Json
122
- mkCompilerInfo programDb compilerInfo = JsonObject
125
+ mkCompilerInfo :: ConfiguredProgram -> Compiler -> Json
126
+ mkCompilerInfo compilerProgram compilerInfo = JsonObject
123
127
[ " flavour" .= JsonString (prettyShow $ compilerFlavor compilerInfo)
124
128
, " compiler-id" .= JsonString (showCompilerId compilerInfo)
125
- , " path" .= path
129
+ , " path" .= JsonString (programPath compilerProgram)
126
130
]
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
138
131
139
132
mkComponentInfo :: FilePath -> PackageDescription -> LocalBuildInfo -> ComponentLocalBuildInfo -> ([String ], Json )
140
133
mkComponentInfo wdir pkg_descr lbi clbi = (warnings, JsonObject $
0 commit comments