Commit d6e0edbe authored by quasicomputational's avatar quasicomputational
Browse files

Make cabal check play nice with cabal-testsuite.

Now `cabal check` will produce marked output and won't wrap lines if
you don't tell it to.
parent 0ea56b5b
......@@ -25,7 +25,7 @@ import Distribution.PackageDescription.Configuration (flattenPackageDescription)
import Distribution.PackageDescription.Parsec
(parseGenericPackageDescription, runParseResult)
import Distribution.Parsec.Common (PWarning (..), showPError, showPWarning)
import Distribution.Simple.Utils (defaultPackageDesc, die', warn, wrapText)
import Distribution.Simple.Utils (defaultPackageDesc, die', notice, warn)
import Distribution.Verbosity (Verbosity)
import qualified Data.ByteString as BS
......@@ -75,19 +75,19 @@ check verbosity = do
distInexusable = [ x | x@PackageDistInexcusable {} <- packageChecks ]
unless (null buildImpossible) $ do
putStrLn "The package will not build sanely due to these errors:"
warn verbosity "The package will not build sanely due to these errors:"
printCheckMessages buildImpossible
unless (null buildWarning) $ do
putStrLn "The following warnings are likely to affect your build negatively:"
warn verbosity "The following warnings are likely to affect your build negatively:"
printCheckMessages buildWarning
unless (null distSuspicious) $ do
putStrLn "These warnings may cause trouble when distributing the package:"
warn verbosity "These warnings may cause trouble when distributing the package:"
printCheckMessages distSuspicious
unless (null distInexusable) $ do
putStrLn "The following errors will cause portability problems on other environments:"
warn verbosity "The following errors will cause portability problems on other environments:"
printCheckMessages distInexusable
let isDistError (PackageDistSuspicious {}) = False
......@@ -98,13 +98,12 @@ check verbosity = do
errors = filter isDistError packageChecks
unless (null errors) $
putStrLn "Hackage would reject this package."
warn verbosity "Hackage would reject this package."
when (null packageChecks) $
putStrLn "No errors or warnings could be found in the package."
notice verbosity "No errors or warnings could be found in the package."
return (not . any isCheckError $ packageChecks)
where
printCheckMessages = traverse_ (putStrLn . format . explanation)
format = wrapText . ("* "++)
printCheckMessages = traverse_ (warn verbosity . explanation)
......@@ -1244,9 +1244,9 @@ checkCommand = CommandUI {
++ "If no errors and warnings are reported, Hackage will accept this "
++ "package.\n",
commandNotes = Nothing,
commandUsage = \pname -> "Usage: " ++ pname ++ " check\n",
commandUsage = usageFlags "check",
commandDefaultFlags = toFlag normal,
commandOptions = \_ -> []
commandOptions = \_ -> [optionVerbosity id const]
}
formatCommand :: CommandUI (Flag Verbosity)
......
......@@ -274,7 +274,7 @@ cabalG' global_args cmd args = do
-- Sandboxes manage dist dir
| testHaveSandbox env
= install_args
| cmd `elem` ["v1-update", "outdated", "user-config", "manpage", "v1-freeze"]
| cmd `elem` ["v1-update", "outdated", "user-config", "manpage", "v1-freeze", "check"]
= [ ]
-- new-build commands are affected by testCabalProjectFile
| "new-" `isPrefixOf` cmd
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment