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