|
1 | 1 | {-# LANGUAGE RecordWildCards #-} |
| 2 | +{-# LANGUAGE LambdaCase #-} |
2 | 3 |
|
3 | 4 | -- | cabal-install CLI command: build |
4 | 5 | module Distribution.Client.CmdBuild |
@@ -49,15 +50,17 @@ import Distribution.Simple.Command |
49 | 50 | ( CommandUI (..) |
50 | 51 | , option |
51 | 52 | , usageAlternatives |
| 53 | + , reqArg |
52 | 54 | ) |
53 | | -import Distribution.Simple.Flag (Flag (..), fromFlag, fromFlagOrDefault, toFlag) |
| 55 | +import Distribution.Simple.Flag (Flag (..), fromFlag, fromFlagOrDefault, toFlag, flagToList) |
54 | 56 | import Distribution.Simple.Utils |
55 | 57 | ( dieWithException |
56 | 58 | , wrapText |
57 | 59 | ) |
58 | 60 | import Distribution.Verbosity |
59 | 61 | ( normal |
60 | 62 | ) |
| 63 | +import Distribution.ReadE (succeedReadE) |
61 | 64 |
|
62 | 65 | buildCommand :: CommandUI (NixStyleFlags BuildFlags) |
63 | 66 | buildCommand = |
@@ -113,18 +116,27 @@ buildCommand = |
113 | 116 | buildOnlyConfigure |
114 | 117 | (\v flags -> flags{buildOnlyConfigure = v}) |
115 | 118 | (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) |
116 | 126 | ] |
117 | 127 | ) |
118 | 128 | } |
119 | 129 |
|
120 | 130 | data BuildFlags = BuildFlags |
121 | 131 | { buildOnlyConfigure :: Flag Bool |
| 132 | + , buildInstallClosure :: Flag FilePath |
122 | 133 | } |
123 | 134 |
|
124 | 135 | defaultBuildFlags :: BuildFlags |
125 | 136 | defaultBuildFlags = |
126 | 137 | BuildFlags |
127 | 138 | { buildOnlyConfigure = toFlag False |
| 139 | + , buildInstallClosure = mempty |
128 | 140 | } |
129 | 141 |
|
130 | 142 | -- | The @build@ command does a lot. It brings the install plan up to date, |
|
0 commit comments