{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
module Stack.Upgrade
( UpgradeOpts (..)
, BinaryOpts (..)
, SourceOpts (..)
, upgradeCmd
, upgrade
) where
import qualified Data.Text as T
import Path ( (</>), parseRelDir )
import RIO.Process ( proc, runProcess_, withWorkingDir )
import Stack.Build ( build )
import Stack.Build.Target ( NeedTargets (..) )
import Stack.Constants ( relDirStackProgName, stackDotYaml )
import Stack.Internal.BuildInfo ( maybeGitHash )
import Stack.Prelude hiding ( force, Display (..) )
import Stack.Runners
( ShouldReexec (..), withConfig, withEnvConfig
, withGlobalProject )
import Stack.Setup
( downloadStackExe, downloadStackReleaseInfo
, getDownloadVersion, preferredPlatforms, stackVersion
)
import Stack.Types.BuildOpts
( BuildOptsCLI (..), buildOptsInstallExesL
, defaultBuildOptsCLI
)
import Stack.Types.Config ( Config (..), HasConfig (..), buildOptsL )
import Stack.Types.GlobalOpts ( GlobalOpts (..) )
import Stack.Types.Runner ( Runner, globalOptsL )
import Stack.Types.StackYamlLoc ( StackYamlLoc (..) )
import System.Process ( rawSystem, readProcess )
data UpgradePrettyException
= ResolverOptionInvalid
| NeitherBinaryOrSourceSpecified
| ExecutableFailure
| CommitsNotFound String String
| StackInPackageIndexNotFound
| VersionWithNoRevision
deriving (Int -> UpgradePrettyException -> ShowS
[UpgradePrettyException] -> ShowS
UpgradePrettyException -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpgradePrettyException] -> ShowS
$cshowList :: [UpgradePrettyException] -> ShowS
show :: UpgradePrettyException -> String
$cshow :: UpgradePrettyException -> String
showsPrec :: Int -> UpgradePrettyException -> ShowS
$cshowsPrec :: Int -> UpgradePrettyException -> ShowS
Show, Typeable)
instance Pretty UpgradePrettyException where
pretty :: UpgradePrettyException -> StyleDoc
pretty UpgradePrettyException
ResolverOptionInvalid =
StyleDoc
"[S-8761]"
forall a. Semigroup a => a -> a -> a
<> StyleDoc
line
forall a. Semigroup a => a -> a -> a
<> [StyleDoc] -> StyleDoc
fillSep
[ StyleDoc
"The"
, Style -> StyleDoc -> StyleDoc
style Style
Shell StyleDoc
"--resolver"
, String -> StyleDoc
flow String
"option cannot be used with Stack's"
, Style -> StyleDoc -> StyleDoc
style Style
Shell StyleDoc
"upgrade"
, StyleDoc
"command."
]
pretty UpgradePrettyException
NeitherBinaryOrSourceSpecified =
StyleDoc
"[S-3642]"
forall a. Semigroup a => a -> a -> a
<> StyleDoc
line
forall a. Semigroup a => a -> a -> a
<> String -> StyleDoc
flow String
"You must allow either binary or source upgrade paths."
pretty UpgradePrettyException
ExecutableFailure =
StyleDoc
"[S-8716]"
forall a. Semigroup a => a -> a -> a
<> StyleDoc
line
forall a. Semigroup a => a -> a -> a
<> String -> StyleDoc
flow String
"Non-success exit code from running newly downloaded executable."
pretty (CommitsNotFound String
branch String
repo) =
StyleDoc
"[S-7114]"
forall a. Semigroup a => a -> a -> a
<> StyleDoc
line
forall a. Semigroup a => a -> a -> a
<> [StyleDoc] -> StyleDoc
fillSep
[ String -> StyleDoc
flow String
"No commits found for branch"
, Style -> StyleDoc -> StyleDoc
style Style
Current (forall a. IsString a => String -> a
fromString String
branch)
, String -> StyleDoc
flow String
"on repo"
, Style -> StyleDoc -> StyleDoc
style Style
Url (forall a. IsString a => String -> a
fromString String
repo) forall a. Semigroup a => a -> a -> a
<> StyleDoc
"."
]
pretty UpgradePrettyException
StackInPackageIndexNotFound =
StyleDoc
"[S-9668]"
forall a. Semigroup a => a -> a -> a
<> StyleDoc
line
forall a. Semigroup a => a -> a -> a
<> String -> StyleDoc
flow String
"No Stack version found in package indices."
pretty UpgradePrettyException
VersionWithNoRevision =
StyleDoc
"[S-6648]"
forall a. Semigroup a => a -> a -> a
<> StyleDoc
line
forall a. Semigroup a => a -> a -> a
<> String -> StyleDoc
flow String
"Latest version with no revision."
instance Exception UpgradePrettyException
data BinaryOpts = BinaryOpts
{ BinaryOpts -> Maybe String
_boPlatform :: !(Maybe String)
, BinaryOpts -> Bool
_boForce :: !Bool
, BinaryOpts -> Bool
_boOnlyLocalBin :: !Bool
, BinaryOpts -> Maybe String
_boVersion :: !(Maybe String)
, BinaryOpts -> Maybe String
_boGitHubOrg :: !(Maybe String)
, BinaryOpts -> Maybe String
_boGitHubRepo :: !(Maybe String)
}
deriving Int -> BinaryOpts -> ShowS
[BinaryOpts] -> ShowS
BinaryOpts -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BinaryOpts] -> ShowS
$cshowList :: [BinaryOpts] -> ShowS
show :: BinaryOpts -> String
$cshow :: BinaryOpts -> String
showsPrec :: Int -> BinaryOpts -> ShowS
$cshowsPrec :: Int -> BinaryOpts -> ShowS
Show
newtype SourceOpts
= SourceOpts (Maybe (String, String))
deriving Int -> SourceOpts -> ShowS
[SourceOpts] -> ShowS
SourceOpts -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SourceOpts] -> ShowS
$cshowList :: [SourceOpts] -> ShowS
show :: SourceOpts -> String
$cshow :: SourceOpts -> String
showsPrec :: Int -> SourceOpts -> ShowS
$cshowsPrec :: Int -> SourceOpts -> ShowS
Show
data UpgradeOpts = UpgradeOpts
{ UpgradeOpts -> Maybe BinaryOpts
_uoBinary :: !(Maybe BinaryOpts)
, UpgradeOpts -> Maybe SourceOpts
_uoSource :: !(Maybe SourceOpts)
}
deriving Int -> UpgradeOpts -> ShowS
[UpgradeOpts] -> ShowS
UpgradeOpts -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpgradeOpts] -> ShowS
$cshowList :: [UpgradeOpts] -> ShowS
show :: UpgradeOpts -> String
$cshow :: UpgradeOpts -> String
showsPrec :: Int -> UpgradeOpts -> ShowS
$cshowsPrec :: Int -> UpgradeOpts -> ShowS
Show
upgradeCmd :: UpgradeOpts -> RIO Runner ()
upgradeCmd :: UpgradeOpts -> RIO Runner ()
upgradeCmd UpgradeOpts
upgradeOpts = do
GlobalOpts
go <- forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view forall env. HasRunner env => Lens' env GlobalOpts
globalOptsL
case GlobalOpts -> Maybe AbstractResolver
globalResolver GlobalOpts
go of
Just AbstractResolver
_ -> forall e (m :: * -> *) a.
(Exception e, MonadIO m, Pretty e) =>
e -> m a
prettyThrowIO UpgradePrettyException
ResolverOptionInvalid
Maybe AbstractResolver
Nothing -> forall a. RIO Runner a -> RIO Runner a
withGlobalProject forall a b. (a -> b) -> a -> b
$ Maybe String -> UpgradeOpts -> RIO Runner ()
upgrade Maybe String
maybeGitHash UpgradeOpts
upgradeOpts
upgrade ::
Maybe String
-> UpgradeOpts
-> RIO Runner ()
upgrade :: Maybe String -> UpgradeOpts -> RIO Runner ()
upgrade Maybe String
builtHash (UpgradeOpts Maybe BinaryOpts
mbo Maybe SourceOpts
mso) = case (Maybe BinaryOpts
mbo, Maybe SourceOpts
mso) of
(Maybe BinaryOpts
Nothing, Maybe SourceOpts
Nothing) -> forall e (m :: * -> *) a.
(Exception e, MonadIO m, Pretty e) =>
e -> m a
prettyThrowIO UpgradePrettyException
NeitherBinaryOrSourceSpecified
(Just BinaryOpts
bo, Maybe SourceOpts
Nothing) -> BinaryOpts -> RIO Runner ()
binary BinaryOpts
bo
(Maybe BinaryOpts
Nothing, Just SourceOpts
so) -> SourceOpts -> RIO Runner ()
source SourceOpts
so
(Maybe BinaryOpts
_, Just so :: SourceOpts
so@(SourceOpts (Just (String, String)
_))) -> SourceOpts -> RIO Runner ()
source SourceOpts
so
(Just BinaryOpts
bo, Just SourceOpts
so) -> BinaryOpts -> RIO Runner ()
binary BinaryOpts
bo forall (m :: * -> *) a.
MonadUnliftIO m =>
m a -> (SomeException -> m a) -> m a
`catchAny` \SomeException
e -> do
forall env (m :: * -> *).
(HasCallStack, HasTerm env, MonadReader env m, MonadIO m) =>
[StyleDoc] -> m ()
prettyWarnL
[ String -> StyleDoc
flow String
"Exception occurred when trying to perform binary upgrade:"
, forall a. IsString a => String -> a
fromString forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Show a => a -> String
show forall a b. (a -> b) -> a -> b
$ SomeException
e
, StyleDoc
line forall a. Semigroup a => a -> a -> a
<> String -> StyleDoc
flow String
"Falling back to source upgrade."
]
SourceOpts -> RIO Runner ()
source SourceOpts
so
where
binary :: BinaryOpts -> RIO Runner ()
binary = BinaryOpts -> RIO Runner ()
binaryUpgrade
source :: SourceOpts -> RIO Runner ()
source = Maybe String -> SourceOpts -> RIO Runner ()
sourceUpgrade Maybe String
builtHash
binaryUpgrade :: BinaryOpts -> RIO Runner ()
binaryUpgrade :: BinaryOpts -> RIO Runner ()
binaryUpgrade (BinaryOpts Maybe String
mplatform Bool
force' Bool
onlyLocalBin Maybe String
mver Maybe String
morg Maybe String
mrepo) =
forall a. ShouldReexec -> RIO Config a -> RIO Runner a
withConfig ShouldReexec
NoReexec forall a b. (a -> b) -> a -> b
$ do
[(Bool, String)]
platforms0 <-
case Maybe String
mplatform of
Maybe String
Nothing -> forall env (m :: * -> *).
(MonadReader env m, HasPlatform env, MonadThrow m) =>
m [(Bool, String)]
preferredPlatforms
Just String
p -> forall (f :: * -> *) a. Applicative f => a -> f a
pure [(Text
"windows" Text -> Text -> Bool
`T.isInfixOf` String -> Text
T.pack String
p, String
p)]
StackReleaseInfo
archiveInfo <- forall env.
(HasPlatform env, HasLogFunc env) =>
Maybe String
-> Maybe String -> Maybe String -> RIO env StackReleaseInfo
downloadStackReleaseInfo Maybe String
morg Maybe String
mrepo Maybe String
mver
let mdownloadVersion :: Maybe Version
mdownloadVersion = StackReleaseInfo -> Maybe Version
getDownloadVersion StackReleaseInfo
archiveInfo
force :: Bool
force =
case Maybe String
mver of
Maybe String
Nothing -> Bool
force'
Just String
_ -> Bool
True
Bool
isNewer <-
case Maybe Version
mdownloadVersion of
Maybe Version
Nothing -> do
forall env (m :: * -> *).
(HasCallStack, HasTerm env, MonadReader env m, MonadIO m) =>
StyleDoc -> m ()
prettyError forall a b. (a -> b) -> a -> b
$
String -> StyleDoc
flow String
"Unable to determine upstream version from GitHub metadata."
forall a. Semigroup a => a -> a -> a
<> if Bool
force
then forall a. Monoid a => a
mempty
else
StyleDoc
line
forall a. Semigroup a => a -> a -> a
<> [StyleDoc] -> StyleDoc
fillSep
[ String -> StyleDoc
flow String
"Rerun with"
, Style -> StyleDoc -> StyleDoc
style Style
Shell StyleDoc
"--force-download"
, String -> StyleDoc
flow String
"to force an upgrade."
]
forall (f :: * -> *) a. Applicative f => a -> f a
pure Bool
False
Just Version
downloadVersion -> do
forall env (m :: * -> *).
(HasCallStack, HasTerm env, MonadReader env m, MonadIO m) =>
[StyleDoc] -> m ()
prettyInfoL
[ String -> StyleDoc
flow String
"Current Stack version:"
, forall a. IsString a => String -> a
fromString (Version -> String
versionString Version
stackVersion) forall a. Semigroup a => a -> a -> a
<> StyleDoc
";"
, String -> StyleDoc
flow String
"available download version:"
, forall a. IsString a => String -> a
fromString (Version -> String
versionString Version
downloadVersion) forall a. Semigroup a => a -> a -> a
<> StyleDoc
"."
]
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Version
downloadVersion forall a. Ord a => a -> a -> Bool
> Version
stackVersion
Bool
toUpgrade <- case (Bool
force, Bool
isNewer) of
(Bool
False, Bool
False) -> do
forall env (m :: * -> *).
(HasCallStack, HasTerm env, MonadReader env m, MonadIO m) =>
String -> m ()
prettyInfoS String
"Skipping binary upgrade, you are already running the most \
\recent version."
forall (f :: * -> *) a. Applicative f => a -> f a
pure Bool
False
(Bool
True, Bool
False) -> do
forall env (m :: * -> *).
(HasCallStack, HasTerm env, MonadReader env m, MonadIO m) =>
String -> m ()
prettyInfoS String
"Forcing binary upgrade."
forall (f :: * -> *) a. Applicative f => a -> f a
pure Bool
True
(Bool
_, Bool
True) -> do
forall env (m :: * -> *).
(HasCallStack, HasTerm env, MonadReader env m, MonadIO m) =>
String -> m ()
prettyInfoS String
"Newer version detected, downloading."
forall (f :: * -> *) a. Applicative f => a -> f a
pure Bool
True
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
toUpgrade forall a b. (a -> b) -> a -> b
$ do
Config
config <- forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view forall env. HasConfig env => Lens' env Config
configL
forall env.
HasConfig env =>
[(Bool, String)]
-> StackReleaseInfo
-> Path Abs Dir
-> Bool
-> (Path Abs File -> IO ())
-> RIO env ()
downloadStackExe
[(Bool, String)]
platforms0 StackReleaseInfo
archiveInfo (Config -> Path Abs Dir
configLocalBin Config
config) (Bool -> Bool
not Bool
onlyLocalBin) forall a b. (a -> b) -> a -> b
$
\Path Abs File
tmpFile -> do
ExitCode
ec <- String -> [String] -> IO ExitCode
rawSystem (forall b t. Path b t -> String
toFilePath Path Abs File
tmpFile) [String
"--version"]
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (ExitCode
ec forall a. Eq a => a -> a -> Bool
== ExitCode
ExitSuccess) (forall e (m :: * -> *) a.
(Exception e, MonadIO m, Pretty e) =>
e -> m a
prettyThrowIO UpgradePrettyException
ExecutableFailure)
sourceUpgrade ::
Maybe String
-> SourceOpts
-> RIO Runner ()
sourceUpgrade :: Maybe String -> SourceOpts -> RIO Runner ()
sourceUpgrade Maybe String
builtHash (SourceOpts Maybe (String, String)
gitRepo) =
forall (m :: * -> *) a.
MonadUnliftIO m =>
String -> (Path Abs Dir -> m a) -> m a
withSystemTempDir String
"stack-upgrade" forall a b. (a -> b) -> a -> b
$ \Path Abs Dir
tmp -> do
Maybe (Path Abs Dir)
mdir <- case Maybe (String, String)
gitRepo of
Just (String
repo, String
branch) -> do
String
remote <- forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ String -> [String] -> String -> IO String
System.Process.readProcess
String
"git"
[String
"ls-remote", String
repo, String
branch]
[]
String
latestCommit <-
case String -> [String]
words String
remote of
[] -> forall e (m :: * -> *) a.
(Exception e, MonadIO m, Pretty e) =>
e -> m a
prettyThrowIO forall a b. (a -> b) -> a -> b
$ String -> String -> UpgradePrettyException
CommitsNotFound String
branch String
repo
String
x:[String]
_ -> forall (f :: * -> *) a. Applicative f => a -> f a
pure String
x
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (forall a. Maybe a -> Bool
isNothing Maybe String
builtHash) forall a b. (a -> b) -> a -> b
$
forall env (m :: * -> *).
(HasCallStack, HasTerm env, MonadReader env m, MonadIO m) =>
String -> m ()
prettyWarnS
String
"Information about the commit this version of Stack was built from \
\is not available due to how it was built. Will continue by \
\assuming an upgrade is needed because we have no information to \
\the contrary."
if Maybe String
builtHash forall a. Eq a => a -> a -> Bool
== forall a. a -> Maybe a
Just String
latestCommit
then do
forall env (m :: * -> *).
(HasCallStack, HasTerm env, MonadReader env m, MonadIO m) =>
String -> m ()
prettyInfoS String
"Already up-to-date, no upgrade required."
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a. Maybe a
Nothing
else do
forall env (m :: * -> *).
(HasCallStack, HasTerm env, MonadReader env m, MonadIO m) =>
String -> m ()
prettyInfoS String
"Cloning stack."
let args :: [String]
args =
[ String
"clone"
, String
repo
, String
"stack"
, String
"--depth"
, String
"1"
, String
"--recursive"
, String
"--branch"
, String
branch
]
forall env (m :: * -> *) a.
(HasProcessContext env, MonadReader env m, MonadIO m) =>
String -> m a -> m a
withWorkingDir (forall b t. Path b t -> String
toFilePath Path Abs Dir
tmp) forall a b. (a -> b) -> a -> b
$ forall env (m :: * -> *) a.
(HasProcessContext env, HasLogFunc env, MonadReader env m,
MonadIO m, HasCallStack) =>
String -> [String] -> (ProcessConfig () () () -> m a) -> m a
proc String
"git" [String]
args forall (m :: * -> *) stdin stdout stderr.
MonadIO m =>
ProcessConfig stdin stdout stderr -> m ()
runProcess_
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ Path Abs Dir
tmp forall b t. Path b Dir -> Path Rel t -> Path b t
</> Path Rel Dir
relDirStackProgName
Maybe (String, String)
Nothing -> forall a. ShouldReexec -> RIO Config a -> RIO Runner a
withConfig ShouldReexec
NoReexec forall a b. (a -> b) -> a -> b
$ do
forall (f :: * -> *) a. Functor f => f a -> f ()
void
forall a b. (a -> b) -> a -> b
$ forall env.
(HasPantryConfig env, HasLogFunc env) =>
Maybe Utf8Builder -> RIO env DidUpdateOccur
updateHackageIndex
forall a b. (a -> b) -> a -> b
$ forall a. a -> Maybe a
Just Utf8Builder
"Updating index to make sure we find the latest Stack version."
Maybe PackageIdentifierRevision
mversion <- forall env.
(HasPantryConfig env, HasLogFunc env) =>
RequireHackageIndex
-> PackageName
-> UsePreferredVersions
-> RIO env (Maybe PackageIdentifierRevision)
getLatestHackageVersion
RequireHackageIndex
YesRequireHackageIndex
PackageName
"stack"
UsePreferredVersions
UsePreferredVersions
(PackageIdentifierRevision PackageName
_ Version
version CabalFileInfo
_) <-
case Maybe PackageIdentifierRevision
mversion of
Maybe PackageIdentifierRevision
Nothing -> forall e (m :: * -> *) a.
(Exception e, MonadIO m, Pretty e) =>
e -> m a
prettyThrowIO UpgradePrettyException
StackInPackageIndexNotFound
Just PackageIdentifierRevision
version -> forall (f :: * -> *) a. Applicative f => a -> f a
pure PackageIdentifierRevision
version
if Version
version forall a. Ord a => a -> a -> Bool
<= Version
stackVersion
then do
forall env (m :: * -> *).
(HasCallStack, HasTerm env, MonadReader env m, MonadIO m) =>
String -> m ()
prettyInfoS String
"Already at latest version, no upgrade required."
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a. Maybe a
Nothing
else do
Path Rel Dir
suffix <- forall (m :: * -> *). MonadThrow m => String -> m (Path Rel Dir)
parseRelDir forall a b. (a -> b) -> a -> b
$ String
"stack-" forall a. [a] -> [a] -> [a]
++ Version -> String
versionString Version
version
let dir :: Path Abs Dir
dir = Path Abs Dir
tmp forall b t. Path b Dir -> Path Rel t -> Path b t
</> Path Rel Dir
suffix
Maybe (Revision, BlobKey, TreeKey)
mrev <- forall env.
(HasPantryConfig env, HasLogFunc env, HasProcessContext env) =>
RequireHackageIndex
-> PackageName
-> Version
-> RIO env (Maybe (Revision, BlobKey, TreeKey))
getLatestHackageRevision
RequireHackageIndex
YesRequireHackageIndex
PackageName
"stack"
Version
version
case Maybe (Revision, BlobKey, TreeKey)
mrev of
Maybe (Revision, BlobKey, TreeKey)
Nothing -> forall e (m :: * -> *) a.
(Exception e, MonadIO m, Pretty e) =>
e -> m a
prettyThrowIO UpgradePrettyException
VersionWithNoRevision
Just (Revision
_rev, BlobKey
cfKey, TreeKey
treeKey) -> do
let ident :: PackageIdentifier
ident = PackageName -> Version -> PackageIdentifier
PackageIdentifier PackageName
"stack" Version
version
forall env.
(HasPantryConfig env, HasLogFunc env, HasProcessContext env) =>
Path Abs Dir -> PackageLocationImmutable -> RIO env ()
unpackPackageLocation Path Abs Dir
dir forall a b. (a -> b) -> a -> b
$ PackageIdentifier -> BlobKey -> TreeKey -> PackageLocationImmutable
PLIHackage PackageIdentifier
ident BlobKey
cfKey TreeKey
treeKey
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ forall a. a -> Maybe a
Just Path Abs Dir
dir
let modifyGO :: Path Abs Dir -> GlobalOpts -> GlobalOpts
modifyGO Path Abs Dir
dir GlobalOpts
go = GlobalOpts
go
{ globalResolver :: Maybe AbstractResolver
globalResolver = forall a. Maybe a
Nothing
, globalStackYaml :: StackYamlLoc
globalStackYaml = Path Abs File -> StackYamlLoc
SYLOverride forall a b. (a -> b) -> a -> b
$ Path Abs Dir
dir forall b t. Path b Dir -> Path Rel t -> Path b t
</> Path Rel File
stackDotYaml
}
boptsCLI :: BuildOptsCLI
boptsCLI = BuildOptsCLI
defaultBuildOptsCLI
{ boptsCLITargets :: [Text]
boptsCLITargets = [Text
"stack"]
}
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
t a -> (a -> m b) -> m ()
forM_ Maybe (Path Abs Dir)
mdir forall a b. (a -> b) -> a -> b
$ \Path Abs Dir
dir ->
forall r (m :: * -> *) a. MonadReader r m => (r -> r) -> m a -> m a
local (forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
over forall env. HasRunner env => Lens' env GlobalOpts
globalOptsL (Path Abs Dir -> GlobalOpts -> GlobalOpts
modifyGO Path Abs Dir
dir))
forall a b. (a -> b) -> a -> b
$ forall a. ShouldReexec -> RIO Config a -> RIO Runner a
withConfig ShouldReexec
NoReexec
forall a b. (a -> b) -> a -> b
$ forall a.
NeedTargets -> BuildOptsCLI -> RIO EnvConfig a -> RIO Config a
withEnvConfig NeedTargets
AllowNoTargets BuildOptsCLI
boptsCLI
forall a b. (a -> b) -> a -> b
$ forall r (m :: * -> *) a. MonadReader r m => (r -> r) -> m a -> m a
local (forall s t a b. ASetter s t a b -> b -> s -> t
set (forall s. HasConfig s => Lens' s BuildOpts
buildOptsLforall b c a. (b -> c) -> (a -> b) -> a -> c
.Lens' BuildOpts Bool
buildOptsInstallExesL) Bool
True)
forall a b. (a -> b) -> a -> b
$ forall env.
HasEnvConfig env =>
Maybe (Set (Path Abs File) -> IO ()) -> RIO env ()
build forall a. Maybe a
Nothing