@@ -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
@@ -114,23 +118,12 @@ mkBuildInfo' compilerInfo componentInfos =
114
118
, " components" .= JsonArray componentInfos
115
119
]
116
120
117
- mkCompilerInfo :: ProgramDb -> Compiler -> Json
118
- mkCompilerInfo programDb compilerInfo = JsonObject
121
+ mkCompilerInfo :: ConfiguredProgram -> Compiler -> Json
122
+ mkCompilerInfo compilerProgram compilerInfo = JsonObject
119
123
[ " flavour" .= JsonString (prettyShow $ compilerFlavor compilerInfo)
120
124
, " compiler-id" .= JsonString (showCompilerId compilerInfo)
121
- , " path" .= path
125
+ , " path" .= JsonString (programPath compilerProgram)
122
126
]
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
134
127
135
128
mkComponentInfo :: FilePath -> PackageDescription -> LocalBuildInfo -> ComponentLocalBuildInfo -> ([String ], Json )
136
129
mkComponentInfo wdir pkg_descr lbi clbi = (warnings, JsonObject $
0 commit comments