Skip to content

Commit

Permalink
Improve s-b-i frontend command and add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fendor committed Sep 15, 2019
1 parent 59281db commit c946e9a
Show file tree
Hide file tree
Showing 45 changed files with 1,061 additions and 427 deletions.
3 changes: 2 additions & 1 deletion cabal-install/Distribution/Client/CmdBuild.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ module Distribution.Client.CmdBuild (
-- * Internals exposed for testing
TargetProblem(..),
selectPackageTargets,
selectComponentTarget
selectComponentTarget,
reportTargetProblems
) where

import Distribution.Client.ProjectOrchestration
Expand Down
299 changes: 186 additions & 113 deletions cabal-install/Distribution/Client/CmdShowBuildInfo.hs

Large diffs are not rendered by default.

220 changes: 0 additions & 220 deletions cabal-install/Distribution/Client/CmdWriteAutogenFiles.hs

This file was deleted.

34 changes: 3 additions & 31 deletions cabal-install/Distribution/Client/Setup.hs
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,7 @@ module Distribution.Client.Setup
, doctestCommand
, copyCommand
, registerCommand

--ghc-mod support commands
, showBuildInfoCommand
, writeAutogenFilesCommand, WriteAutogenFilesFlags(..)
--, showBuildInfoCommand
, parsePackageArgs
, liftOptions
, yesNoOpt
Expand Down Expand Up @@ -108,7 +105,6 @@ import Distribution.Simple.Setup
, SDistFlags(..), HaddockFlags(..)
, CleanFlags(..), DoctestFlags(..)
, CopyFlags(..), RegisterFlags(..)
, WriteAutogenFilesFlags(..)
, readPackageDbList, showPackageDbList
, Flag(..), toFlag, flagToMaybe, flagToList, maybeToFlag
, BooleanFlag(..), optionVerbosity
Expand Down Expand Up @@ -202,7 +198,6 @@ globalCommand commands = CommandUI {
, "haddock"
, "hscolour"
, "show-build-info"
, "write-autogen-files"
, "exec"
, "new-build"
, "new-configure"
Expand Down Expand Up @@ -290,7 +285,6 @@ globalCommand commands = CommandUI {
, addCmd "report"
, par
, addCmd "show-build-info"
, addCmd "write-autogen-files"
, addCmd "freeze"
, addCmd "gen-bounds"
, addCmd "outdated"
Expand Down Expand Up @@ -869,25 +863,6 @@ filterTestFlags flags cabalLibVersion
Cabal.testWrapper = NoFlag
}

-- ------------------------------------------------------------
-- * show-build-info command
-- ------------------------------------------------------------

showBuildInfoCommand :: CommandUI (BuildFlags, BuildExFlags)
showBuildInfoCommand = parent {
commandDefaultFlags = (commandDefaultFlags parent, mempty),
commandOptions =
\showOrParseArgs -> liftOptions fst setFst
(commandOptions parent showOrParseArgs)
++
liftOptions snd setSnd (buildExOptions showOrParseArgs)
}
where
setFst a (_,b) = (a,b)
setSnd b (a,_) = (a,b)

parent = Cabal.showBuildInfoCommand defaultProgramDb

-- ------------------------------------------------------------
-- * Repl command
-- ------------------------------------------------------------
Expand Down Expand Up @@ -3012,10 +2987,10 @@ relevantConfigValuesText vs =


-- ------------------------------------------------------------
-- * Commands to support ghc-mod
-- * Commands to support show-build-info
-- ------------------------------------------------------------

showBuildInfoCommand :: CommandUI (BuildFlags, BuildExFlags)
showBuildInfoCommand :: CommandUI (Cabal.ShowBuildInfoFlags, BuildExFlags)
showBuildInfoCommand = parent {
commandDefaultFlags = (commandDefaultFlags parent, mempty),
commandOptions =
Expand All @@ -3029,6 +3004,3 @@ showBuildInfoCommand = parent {
setSnd b (a,_) = (a,b)

parent = Cabal.showBuildInfoCommand defaultProgramDb

writeAutogenFilesCommand :: CommandUI WriteAutogenFilesFlags
writeAutogenFilesCommand = Cabal.writeAutogenFilesCommand defaultProgramDb
2 changes: 1 addition & 1 deletion cabal-install/Distribution/Client/SetupWrapper.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
-- runs it with the given arguments.

module Distribution.Client.SetupWrapper (
getSetup, runSetup, runSetupCommand, setupWrapper,
getSetup, runSetup, runSetupCommand, setupWrapper, getSetupMethod,
SetupScriptOptions(..),
defaultSetupScriptOptions,
) where
Expand Down
3 changes: 1 addition & 2 deletions cabal-install/cabal-install.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,6 @@ executable cabal
Distribution.Client.CmdBench
Distribution.Client.CmdBuild
Distribution.Client.CmdClean
Distribution.Client.CmdShowBuildInfo
Distribution.Client.CmdWriteAutogenFiles
Distribution.Client.CmdConfigure
Distribution.Client.CmdUpdate
Distribution.Client.CmdErrorMessages
Expand All @@ -173,6 +171,7 @@ executable cabal
Distribution.Client.CmdInstall.ClientInstallFlags
Distribution.Client.CmdRepl
Distribution.Client.CmdRun
Distribution.Client.CmdShowBuildInfo
Distribution.Client.CmdTest
Distribution.Client.CmdLegacy
Distribution.Client.CmdSdist
Expand Down
1 change: 1 addition & 0 deletions cabal-install/cabal-install.cabal.pp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
Distribution.Client.CmdInstall.ClientInstallFlags
Distribution.Client.CmdRepl
Distribution.Client.CmdRun
Distribution.Client.CmdShowBuildInfo
Distribution.Client.CmdTest
Distribution.Client.CmdLegacy
Distribution.Client.CmdSdist
Expand Down
Loading

0 comments on commit c946e9a

Please sign in to comment.