Skip to content

Commit 97a4fe5

Browse files
committed
wip: install-closure
1 parent 405a801 commit 97a4fe5

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

cabal-install/src/Distribution/Client/CmdBuild.hs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{-# LANGUAGE RecordWildCards #-}
2+
{-# LANGUAGE LambdaCase #-}
23

34
-- | cabal-install CLI command: build
45
module Distribution.Client.CmdBuild
@@ -49,15 +50,17 @@ import Distribution.Simple.Command
4950
( CommandUI (..)
5051
, option
5152
, usageAlternatives
53+
, reqArg
5254
)
53-
import Distribution.Simple.Flag (Flag (..), fromFlag, fromFlagOrDefault, toFlag)
55+
import Distribution.Simple.Flag (Flag (..), fromFlag, fromFlagOrDefault, toFlag, flagToList)
5456
import Distribution.Simple.Utils
5557
( dieWithException
5658
, wrapText
5759
)
5860
import Distribution.Verbosity
5961
( normal
6062
)
63+
import Distribution.ReadE (succeedReadE)
6164

6265
buildCommand :: CommandUI (NixStyleFlags BuildFlags)
6366
buildCommand =
@@ -113,18 +116,27 @@ buildCommand =
113116
buildOnlyConfigure
114117
(\v flags -> flags{buildOnlyConfigure = v})
115118
(yesNoOpt showOrParseArgs)
119+
, option
120+
[]
121+
["install-closure"]
122+
"Install the closure of the build plan to the given directory"
123+
buildInstallClosure
124+
(\path flags -> flags{buildInstallClosure = path})
125+
(reqArg "DIR" (succeedReadE Flag) flagToList)
116126
]
117127
)
118128
}
119129

120130
data BuildFlags = BuildFlags
121131
{ buildOnlyConfigure :: Flag Bool
132+
, buildInstallClosure :: Flag FilePath
122133
}
123134

124135
defaultBuildFlags :: BuildFlags
125136
defaultBuildFlags =
126137
BuildFlags
127138
{ buildOnlyConfigure = toFlag False
139+
, buildInstallClosure = mempty
128140
}
129141

130142
-- | The @build@ command does a lot. It brings the install plan up to date,

0 commit comments

Comments
 (0)