From 11de41cd8379ea730a80840d93ed234e3372f885 Mon Sep 17 00:00:00 2001 From: Luke Lau Date: Mon, 8 Jun 2020 21:17:32 +0100 Subject: [PATCH] Generate autogen files These are needed by tooling to setup GHC sessions. --- .../Distribution/Client/CmdShowBuildInfo.hs | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/cabal-install/Distribution/Client/CmdShowBuildInfo.hs b/cabal-install/Distribution/Client/CmdShowBuildInfo.hs index 9a5a1505dfe..52dd6e5d957 100644 --- a/cabal-install/Distribution/Client/CmdShowBuildInfo.hs +++ b/cabal-install/Distribution/Client/CmdShowBuildInfo.hs @@ -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 { @@ -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