Skip to content

Commit

Permalink
Create setupWrapperNew for ProjectBuilding
Browse files Browse the repository at this point in the history
  • Loading branch information
andreabedini committed Jan 25, 2024
1 parent ae3c40a commit 633d081
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import Distribution.Client.Setup
, filterHaddockFlags
, filterTestFlags
)
import Distribution.Client.SetupWrapper
import Distribution.Client.SetupWrapper (SetupScriptOptions (..), setupWrapperNew)
import Distribution.Client.SourceFiles
import Distribution.Client.SrcDist (allPackageSourceFiles)
import qualified Distribution.Client.Tar as Tar
Expand Down Expand Up @@ -342,7 +342,7 @@ buildAndRegisterUnpackedPackage
-> IO ()
setup cmd flags args =
withLogging $ \mLogFileHandle ->
setupWrapper
setupWrapperNew
verbosity
scriptOptions
{ useLoggingHandle = mLogFileHandle
Expand All @@ -362,7 +362,7 @@ buildAndRegisterUnpackedPackage
-> (Version -> [String])
-> IO ()
setupInteractive cmd flags args =
setupWrapper
setupWrapperNew
verbosity
scriptOptions{isInteractive = True}
(Just (elabPkgDescription pkg))
Expand Down
21 changes: 21 additions & 0 deletions cabal-install/src/Distribution/Client/SetupWrapper.hs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ module Distribution.Client.SetupWrapper
, setupWrapper
, SetupScriptOptions (..)
, defaultSetupScriptOptions
, setupWrapperNew
) where

import Distribution.Client.Compat.Prelude
Expand Down Expand Up @@ -505,6 +506,26 @@ setupWrapper verbosity options mpkg cmd flags extraArgs = do
(flags $ setupVersion setup)
(extraArgs $ setupVersion setup)

-- | Configure a 'Setup' and run a command in one step. The command flags
-- may depend on the Cabal library version in use.
setupWrapperNew
:: Verbosity
-> SetupScriptOptions
-> Maybe PackageDescription
-> CommandUI flags
-> (Version -> flags)
-- ^ produce command flags given the Cabal library version
-> (Version -> [String])
-> IO ()
setupWrapperNew verbosity options mpkg cmd flags extraArgs = do
setup <- getSetup verbosity options mpkg
runSetupCommand
verbosity
setup
cmd
(flags $ setupVersion setup)
(extraArgs $ setupVersion setup)

-- ------------------------------------------------------------

-- * Internal SetupMethod
Expand Down

0 comments on commit 633d081

Please sign in to comment.