Skip to content

Commit 2e70d3d

Browse files
committed
Improve s-b-i frontend command and add tests
1 parent 59281db commit 2e70d3d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1298
-427
lines changed

cabal-install/Distribution/Client/CmdBuild.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ module Distribution.Client.CmdBuild (
88
-- * Internals exposed for testing
99
TargetProblem(..),
1010
selectPackageTargets,
11-
selectComponentTarget
11+
selectComponentTarget,
12+
reportTargetProblems
1213
) where
1314

1415
import Distribution.Client.ProjectOrchestration

cabal-install/Distribution/Client/CmdShowBuildInfo.hs

Lines changed: 186 additions & 113 deletions
Large diffs are not rendered by default.

cabal-install/Distribution/Client/CmdWriteAutogenFiles.hs

Lines changed: 0 additions & 220 deletions
This file was deleted.

cabal-install/Distribution/Client/Setup.hs

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,7 @@ module Distribution.Client.Setup
5656
, doctestCommand
5757
, copyCommand
5858
, registerCommand
59-
60-
--ghc-mod support commands
61-
, showBuildInfoCommand
62-
, writeAutogenFilesCommand, WriteAutogenFilesFlags(..)
59+
--, showBuildInfoCommand
6360
, parsePackageArgs
6461
, liftOptions
6562
, yesNoOpt
@@ -108,7 +105,6 @@ import Distribution.Simple.Setup
108105
, SDistFlags(..), HaddockFlags(..)
109106
, CleanFlags(..), DoctestFlags(..)
110107
, CopyFlags(..), RegisterFlags(..)
111-
, WriteAutogenFilesFlags(..)
112108
, readPackageDbList, showPackageDbList
113109
, Flag(..), toFlag, flagToMaybe, flagToList, maybeToFlag
114110
, BooleanFlag(..), optionVerbosity
@@ -202,7 +198,6 @@ globalCommand commands = CommandUI {
202198
, "haddock"
203199
, "hscolour"
204200
, "show-build-info"
205-
, "write-autogen-files"
206201
, "exec"
207202
, "new-build"
208203
, "new-configure"
@@ -290,7 +285,6 @@ globalCommand commands = CommandUI {
290285
, addCmd "report"
291286
, par
292287
, addCmd "show-build-info"
293-
, addCmd "write-autogen-files"
294288
, addCmd "freeze"
295289
, addCmd "gen-bounds"
296290
, addCmd "outdated"
@@ -869,25 +863,6 @@ filterTestFlags flags cabalLibVersion
869863
Cabal.testWrapper = NoFlag
870864
}
871865

872-
-- ------------------------------------------------------------
873-
-- * show-build-info command
874-
-- ------------------------------------------------------------
875-
876-
showBuildInfoCommand :: CommandUI (BuildFlags, BuildExFlags)
877-
showBuildInfoCommand = parent {
878-
commandDefaultFlags = (commandDefaultFlags parent, mempty),
879-
commandOptions =
880-
\showOrParseArgs -> liftOptions fst setFst
881-
(commandOptions parent showOrParseArgs)
882-
++
883-
liftOptions snd setSnd (buildExOptions showOrParseArgs)
884-
}
885-
where
886-
setFst a (_,b) = (a,b)
887-
setSnd b (a,_) = (a,b)
888-
889-
parent = Cabal.showBuildInfoCommand defaultProgramDb
890-
891866
-- ------------------------------------------------------------
892867
-- * Repl command
893868
-- ------------------------------------------------------------
@@ -3012,10 +2987,10 @@ relevantConfigValuesText vs =
30122987

30132988

30142989
-- ------------------------------------------------------------
3015-
-- * Commands to support ghc-mod
2990+
-- * Commands to support show-build-info
30162991
-- ------------------------------------------------------------
30172992

3018-
showBuildInfoCommand :: CommandUI (BuildFlags, BuildExFlags)
2993+
showBuildInfoCommand :: CommandUI (Cabal.ShowBuildInfoFlags, BuildExFlags)
30192994
showBuildInfoCommand = parent {
30202995
commandDefaultFlags = (commandDefaultFlags parent, mempty),
30212996
commandOptions =
@@ -3029,6 +3004,3 @@ showBuildInfoCommand = parent {
30293004
setSnd b (a,_) = (a,b)
30303005

30313006
parent = Cabal.showBuildInfoCommand defaultProgramDb
3032-
3033-
writeAutogenFilesCommand :: CommandUI WriteAutogenFilesFlags
3034-
writeAutogenFilesCommand = Cabal.writeAutogenFilesCommand defaultProgramDb

cabal-install/Distribution/Client/SetupWrapper.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
-- runs it with the given arguments.
1818

1919
module Distribution.Client.SetupWrapper (
20-
getSetup, runSetup, runSetupCommand, setupWrapper,
20+
getSetup, runSetup, runSetupCommand, setupWrapper, getSetupMethod,
2121
SetupScriptOptions(..),
2222
defaultSetupScriptOptions,
2323
) where

cabal-install/cabal-install.cabal

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,6 @@ executable cabal
161161
Distribution.Client.CmdBench
162162
Distribution.Client.CmdBuild
163163
Distribution.Client.CmdClean
164-
Distribution.Client.CmdShowBuildInfo
165-
Distribution.Client.CmdWriteAutogenFiles
166164
Distribution.Client.CmdConfigure
167165
Distribution.Client.CmdUpdate
168166
Distribution.Client.CmdErrorMessages
@@ -173,6 +171,7 @@ executable cabal
173171
Distribution.Client.CmdInstall.ClientInstallFlags
174172
Distribution.Client.CmdRepl
175173
Distribution.Client.CmdRun
174+
Distribution.Client.CmdShowBuildInfo
176175
Distribution.Client.CmdTest
177176
Distribution.Client.CmdLegacy
178177
Distribution.Client.CmdSdist

cabal-install/cabal-install.cabal.pp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@
100100
Distribution.Client.CmdInstall.ClientInstallFlags
101101
Distribution.Client.CmdRepl
102102
Distribution.Client.CmdRun
103+
Distribution.Client.CmdShowBuildInfo
103104
Distribution.Client.CmdTest
104105
Distribution.Client.CmdLegacy
105106
Distribution.Client.CmdSdist

0 commit comments

Comments
 (0)