Skip to content

Commit

Permalink
Generate autogen files
Browse files Browse the repository at this point in the history
These are needed by tooling to setup GHC sessions.
  • Loading branch information
lukel97 committed Jun 8, 2020
1 parent 36d8e1d commit 11de41c
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions cabal-install/Distribution/Client/CmdShowBuildInfo.hs
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,18 @@ import Distribution.Simple.Configure
import Distribution.Simple.ShowBuildInfo
import Distribution.Utils.Json

import Distribution.Simple.BuildTarget (readTargetInfos)
import Distribution.Types.LocalBuildInfo (neededTargetsInBuildOrder')
import Distribution.Compat.Graph (IsNode(nodeKey))
import Distribution.Simple.Setup (BuildFlags(buildArgs))
import Distribution.Types.TargetInfo (TargetInfo(targetCLBI))
import Distribution.Simple.BuildTarget
( readTargetInfos )
import Distribution.Types.LocalBuildInfo
( neededTargetsInBuildOrder' )
import Distribution.Compat.Graph
( IsNode(nodeKey) )
import Distribution.Simple.Setup
( BuildFlags(..) )
import Distribution.Types.TargetInfo
( TargetInfo(..) )
import Distribution.Simple.Build
( componentInitialBuildSteps )

showBuildInfoCommand :: CommandUI (NixStyleFlags ShowBuildInfoFlags)
showBuildInfoCommand = CommandUI {
Expand Down Expand Up @@ -225,6 +232,12 @@ getComponentInfo verbosity baseCtx buildCtx lock pkgs targetUnitId =
let pkgDesc = elabPkgDescription pkg
targets <- readTargetInfos verbosity pkgDesc lbi (buildArgs flags)
let targetsToBuild = neededTargetsInBuildOrder' pkgDesc lbi (map nodeKey targets)

-- generate autogen files which will be needed by tooling
flip mapM_ targetsToBuild $ \target ->
componentInitialBuildSteps (Cabal.fromFlag (buildDistPref flags))
pkgDesc lbi (targetCLBI target) verbosity

return $ map (mkComponentInfo pkgDesc lbi . targetCLBI) targetsToBuild

where
Expand Down

0 comments on commit 11de41c

Please sign in to comment.