@@ -8,7 +8,7 @@ module Distribution.Client.CmdShowBuildInfo (
8
8
) where
9
9
10
10
import Distribution.Client.Compat.Prelude
11
- ( catMaybes )
11
+ ( catMaybes , for )
12
12
import Distribution.Client.ProjectOrchestration
13
13
import Distribution.Client.CmdErrorMessages
14
14
import Distribution.Client.TargetProblem
@@ -32,14 +32,16 @@ import Distribution.Client.ProjectPlanning.Types
32
32
import Distribution.Client.NixStyleOptions
33
33
( NixStyleFlags (.. ), nixStyleOptions , defaultNixStyleFlags )
34
34
import Distribution.Client.DistDirLayout
35
- ( distProjectRootDirectory )
35
+ ( distProjectRootDirectory , DistDirLayout ( distProjectCacheDirectory ) )
36
36
37
37
import Distribution.Simple.ShowBuildInfo
38
38
import Distribution.Utils.Json
39
39
40
40
import Data.Either
41
41
import qualified Data.Text as T
42
42
import qualified Data.Text.IO as T
43
+ import System.FilePath
44
+ import Distribution.Types.UnitId (unUnitId )
43
45
44
46
showBuildInfoCommand :: CommandUI (NixStyleFlags ShowBuildInfoFlags )
45
47
showBuildInfoCommand = CommandUI {
@@ -108,13 +110,13 @@ showBuildInfoAction flags@NixStyleFlags { extraFlags = (ShowBuildInfoFlags fileO
108
110
buildOutcomes <- runProjectBuildPhase verbosity baseCtx buildCtx
109
111
runProjectPostBuildPhase verbosity baseCtx buildCtx buildOutcomes
110
112
111
- -- We can ignore the errors here, since runProjectPostBuildPhase should
112
- -- have already died and reported them if they exist
113
- let (_errs, buildResults) = partitionEithers $ Map. elems buildOutcomes
114
-
115
- let componentBuildInfos =
116
- concatMap T. lines $ -- Component infos are returned each on a newline
117
- catMaybes (buildResultBuildInfo <$> buildResults)
113
+ let tm = targetsMap buildCtx
114
+ let units = Map. keys tm
115
+ let layout = distDirLayout baseCtx
116
+ let dir = distProjectCacheDirectory layout </> " buildinfo "
117
+ componentBuildInfos <- for units $ \ unit -> do
118
+ let fp = dir </> (unUnitId unit) <.> " json "
119
+ T. strip <$> T. readFile fp
118
120
119
121
let compilerInfo = mkCompilerInfo
120
122
(pkgConfigCompilerProgs (elaboratedShared buildCtx))
@@ -135,12 +137,12 @@ showBuildInfoAction flags@NixStyleFlags { extraFlags = (ShowBuildInfoFlags fileO
135
137
-- Default to silent verbosity otherwise it will pollute our json output
136
138
verbosity = fromFlagOrDefault silent (configVerbosity configFlags)
137
139
-- Also shut up haddock since it dumps warnings to stdout
138
- flags' = flags { haddockFlags = haddockFlags { haddockVerbosity = Flag silent }
139
- , configFlags = configFlags { Cabal. configTests = Flag True
140
- , Cabal. configBenchmarks = Flag True
141
- }
142
- }
143
- cliConfig = commandLineFlagsToProjectConfig globalFlags flags'
140
+ -- flags' = flags { haddockFlags = haddockFlags { haddockVerbosity = Flag silent }
141
+ -- , configFlags = configFlags { Cabal.configTests = Flag True
142
+ -- , Cabal.configBenchmarks = Flag True
143
+ -- }
144
+ -- }
145
+ cliConfig = commandLineFlagsToProjectConfig globalFlags flags
144
146
mempty -- ClientInstallFlags, not needed here
145
147
146
148
-- | This defines what a 'TargetSelector' means for the @show-build-info@ command.
0 commit comments