Skip to content

Commit

Permalink
Adopt coding style and edit comments
Browse files Browse the repository at this point in the history
  • Loading branch information
fendor committed Mar 25, 2019
1 parent 6343dd2 commit ba81d96
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 26 deletions.
2 changes: 1 addition & 1 deletion Cabal/Distribution/Simple/Setup.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2218,7 +2218,7 @@ optionNumJobs get set =


-- ------------------------------------------------------------
-- * ghc-mod support flags
-- * show-build-info command flags
-- ------------------------------------------------------------

showBuildInfoCommand :: ProgramDb -> CommandUI BuildFlags
Expand Down
8 changes: 4 additions & 4 deletions cabal-install/Distribution/Client/CmdShowBuildInfo.hs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- | cabal-install CLI command: build
--
module Distribution.Client.CmdShowBuildInfo (
-- * The @build@ CLI and action
-- * The @show-build-info@ CLI and action
showBuildInfoCommand,
showBuildInfoAction
) where
Expand Down Expand Up @@ -74,7 +74,7 @@ showBuildInfoCommand = Client.installCommand {
}


-- | The @build@ command does a lot. It brings the install plan up to date,
-- | The @show-build-info@ command does a lot. It brings the install plan up to date,
-- selects that part of the plan needed by the given or implicit targets and
-- then executes the plan.
--
Expand Down Expand Up @@ -219,7 +219,7 @@ selectPackageTargets targetSelector targets
-- | For a 'TargetComponent' 'TargetSelector', check if the component can be
-- selected.
--
-- For the @build@ command we just need the basic checks on being buildable etc.
-- For the @show-build-info@ command we just need the basic checks on being buildable etc.
--
selectComponentTarget :: SubComponentTarget
-> AvailableTarget k -> Either TargetProblem k
Expand All @@ -229,7 +229,7 @@ selectComponentTarget subtarget =


-- | The various error conditions that can occur when matching a
-- 'TargetSelector' against 'AvailableTarget's for the @build@ command.
-- 'TargetSelector' against 'AvailableTarget's for the @show-build-info@ command.
--
data TargetProblem =
TargetProblemCommon TargetProblemCommon
Expand Down
4 changes: 1 addition & 3 deletions cabal-install/Distribution/Client/Setup.hs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ module Distribution.Client.Setup
, doctestCommand
, copyCommand
, registerCommand

--ghc-mod support commands
, showBuildInfoCommand
, writeAutogenFilesCommand, WriteAutogenFilesFlags(..)
, parsePackageArgs
Expand Down Expand Up @@ -2963,7 +2961,7 @@ relevantConfigValuesText vs =


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

showBuildInfoCommand :: CommandUI (BuildFlags, BuildExFlags)
Expand Down
26 changes: 8 additions & 18 deletions cabal-install/main/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,6 @@ mainWorker args = do
, hiddenCmd win32SelfUpgradeCommand win32SelfUpgradeAction
, hiddenCmd actAsSetupCommand actAsSetupAction
, hiddenCmd manpageCommand (manpageAction commandSpecs)
-- ghc-mod supporting commands
, hiddenCmd CmdShowBuildInfo.showBuildInfoCommand
CmdShowBuildInfo.showBuildInfoAction
, hiddenCmd CmdWriteAutogenFiles.writeAutogenFilesCommand
Expand Down Expand Up @@ -480,30 +479,21 @@ buildActionForCommand commandUI verbosity (buildFlags, buildExFlags) extraArgs g
distPref <- findSavedDistPref config (buildDistPref buildFlags)
-- Calls 'configureAction' to do the real work, so nothing special has to be
-- done to support sandboxes.
config' <- reconfigure configureAction
verbosity
distPref
useSandbox
noAddSource
(buildNumJobs buildFlags)
mempty
[]
globalFlags
config
config' <- reconfigure
configureAction verbosity distPref useSandbox noAddSource
(buildNumJobs buildFlags) mempty [] globalFlags config

nixShell verbosity distPref globalFlags config $ do
maybeWithSandboxDirOnSearchPath useSandbox $ buildForCommand commandUI
verbosity
config'
distPref
buildFlags
extraArgs
maybeWithSandboxDirOnSearchPath useSandbox $ buildForCommand
commandUI verbosity config' distPref buildFlags extraArgs

-- | Actually do the work of building the package. This is separate from
-- 'buildAction' so that 'testAction' and 'benchmarkAction' do not invoke
-- 'reconfigure' twice.
build :: Verbosity -> SavedConfig -> FilePath -> BuildFlags -> [String] -> IO ()
build = buildForCommand (Cabal.buildCommand defaultProgramDb)

-- | Helper function
buildForCommand :: CommandUI BuildFlags
-> Verbosity
-> SavedConfig
Expand Down Expand Up @@ -1293,7 +1283,7 @@ manpageAction commands flagVerbosity extraArgs _ = do
else pname
putStrLn $ manpage cabalCmd commands

--Further commands to support ghc-mod usage
--Further commands to support show-build-info usage
writeAutogenFilesAction :: WriteAutogenFilesFlags -> [String] -> Action
writeAutogenFilesAction flags _ globalFlags = do
let verbosity = fromFlag (wafVerbosity flags)
Expand Down

0 comments on commit ba81d96

Please sign in to comment.