Skip to content

Commit ebb2767

Browse files
fendorlukel97
authored andcommitted
Improve s-b-i frontend command and add tests
Also, rename new-show-build-info to show-build-info in ShowBuildInfo
1 parent 6274f04 commit ebb2767

Some content is hidden

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

46 files changed

+1065
-411
lines changed

Cabal/Distribution/Simple/ShowBuildInfo.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
-- This module defines a simple JSON-based format for exporting basic
33
-- information about a Cabal package and the compiler configuration Cabal
44
-- would use to build it. This can be produced with the
5-
-- @cabal new-show-build-info@ command.
5+
-- @cabal show-build-info@ command.
66
--
77
--
88
-- This format is intended for consumption by external tooling and should

cabal-install/Distribution/Client/CmdBuild.hs

+2-1
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 Prelude ()

cabal-install/Distribution/Client/CmdShowBuildInfo.hs

+188-115
Large diffs are not rendered by default.

cabal-install/Distribution/Client/CmdWriteAutogenFiles.hs

-220
This file was deleted.

cabal-install/Distribution/Client/Setup.hs

+3-31
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,7 @@ module Distribution.Client.Setup
5353
, doctestCommand
5454
, copyCommand
5555
, registerCommand
56-
57-
--ghc-mod support commands
58-
, showBuildInfoCommand
59-
, writeAutogenFilesCommand, WriteAutogenFilesFlags(..)
56+
--, showBuildInfoCommand
6057
, parsePackageArgs
6158
, liftOptions
6259
, yesNoOpt
@@ -103,7 +100,6 @@ import Distribution.Simple.Setup
103100
, SDistFlags(..), HaddockFlags(..)
104101
, CleanFlags(..), DoctestFlags(..)
105102
, CopyFlags(..), RegisterFlags(..)
106-
, WriteAutogenFilesFlags(..)
107103
, readPackageDbList, showPackageDbList
108104
, Flag(..), toFlag, flagToMaybe, flagToList, maybeToFlag
109105
, BooleanFlag(..), optionVerbosity
@@ -197,7 +193,6 @@ globalCommand commands = CommandUI {
197193
, "haddock"
198194
, "hscolour"
199195
, "show-build-info"
200-
, "write-autogen-files"
201196
, "exec"
202197
, "new-build"
203198
, "new-configure"
@@ -285,7 +280,6 @@ globalCommand commands = CommandUI {
285280
, addCmd "report"
286281
, par
287282
, addCmd "show-build-info"
288-
, addCmd "write-autogen-files"
289283
, addCmd "freeze"
290284
, addCmd "gen-bounds"
291285
, 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
-- ------------------------------------------------------------
@@ -2973,10 +2948,10 @@ relevantConfigValuesText vs =
29732948

29742949

29752950
-- ------------------------------------------------------------
2976-
-- * Commands to support ghc-mod
2951+
-- * Commands to support show-build-info
29772952
-- ------------------------------------------------------------
29782953

2979-
showBuildInfoCommand :: CommandUI (BuildFlags, BuildExFlags)
2954+
showBuildInfoCommand :: CommandUI (Cabal.ShowBuildInfoFlags, BuildExFlags)
29802955
showBuildInfoCommand = parent {
29812956
commandDefaultFlags = (commandDefaultFlags parent, mempty),
29822957
commandOptions =
@@ -2990,6 +2965,3 @@ showBuildInfoCommand = parent {
29902965
setSnd b (a,_) = (a,b)
29912966

29922967
parent = Cabal.showBuildInfoCommand defaultProgramDb
2993-
2994-
writeAutogenFilesCommand :: CommandUI WriteAutogenFilesFlags
2995-
writeAutogenFilesCommand = Cabal.writeAutogenFilesCommand defaultProgramDb

cabal-install/Distribution/Client/SetupWrapper.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
-- runs it with the given arguments.
1919

2020
module Distribution.Client.SetupWrapper (
21-
getSetup, runSetup, runSetupCommand, setupWrapper,
21+
getSetup, runSetup, runSetupCommand, setupWrapper, getSetupMethod,
2222
SetupScriptOptions(..),
2323
defaultSetupScriptOptions,
2424
) where

cabal-install/cabal-install.cabal

+1-2
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,6 @@ executable cabal
160160
Distribution.Client.CmdBench
161161
Distribution.Client.CmdBuild
162162
Distribution.Client.CmdClean
163-
Distribution.Client.CmdShowBuildInfo
164-
Distribution.Client.CmdWriteAutogenFiles
165163
Distribution.Client.CmdConfigure
166164
Distribution.Client.CmdUpdate
167165
Distribution.Client.CmdErrorMessages
@@ -174,6 +172,7 @@ executable cabal
174172
Distribution.Client.CmdRepl
175173
Distribution.Client.CmdRun
176174
Distribution.Client.CmdRun.ClientRunFlags
175+
Distribution.Client.CmdShowBuildInfo
177176
Distribution.Client.CmdTest
178177
Distribution.Client.CmdLegacy
179178
Distribution.Client.CmdSdist

cabal-install/cabal-install.cabal.pp

+1
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@
111111
Distribution.Client.CmdRepl
112112
Distribution.Client.CmdRun
113113
Distribution.Client.CmdRun.ClientRunFlags
114+
Distribution.Client.CmdShowBuildInfo
114115
Distribution.Client.CmdTest
115116
Distribution.Client.CmdLegacy
116117
Distribution.Client.CmdSdist

0 commit comments

Comments
 (0)