Make hpack default to only outputting warnings #2011

This commit is contained in:
Michael Sloan 2016-05-04 14:47:49 -07:00
parent 4ebc3d2748
commit 872ff1eae6
4 changed files with 16 additions and 6 deletions

View file

@ -42,7 +42,7 @@ import Prelude.Compat
import Control.Arrow ((&&&))
import Control.Exception hiding (try,catch)
import Control.Monad (liftM, liftM2, (<=<), when, forM)
import Control.Monad (liftM, liftM2, (<=<), when, forM, forM_)
import Control.Monad.Catch
import Control.Monad.IO.Class
import Control.Monad.Logger
@ -1125,8 +1125,18 @@ hpack pkgDir = do
when exists $ do
let fpt = T.pack (toFilePath hpackFile)
$logDebug $ "Running hpack on " <> fpt
liftIO $ Hpack.hpack (toFilePath pkgDir) True
$logDebug $ "Done running hpack on " <> fpt
r <- liftIO $ Hpack.hpackResult (toFilePath pkgDir)
forM_ (Hpack.resultWarnings r) $ \w -> $logWarn ("WARNING: " <> T.pack w)
let cabalFile = T.pack (Hpack.resultCabalFile r)
case Hpack.resultStatus r of
Hpack.Generated -> $logDebug $
"hpack generated a modified version of " <> cabalFile
Hpack.OutputUnchanged -> $logDebug $
"hpack output unchanged in " <> cabalFile
-- NOTE: this is 'logInfo' so it will be outputted to the
-- user by default.
Hpack.AlreadyGeneratedByNewerHpack -> $logWarn $
"WARNING: " <> cabalFile <> " was generated with a newer version of hpack, please upgrade and try again."
-- | Path for the package's build log.
buildLogPath :: (MonadReader env m, HasBuildConfig env, MonadThrow m)

View file

@ -31,7 +31,7 @@ extra-deps:
- process-1.2.1.0
- time-1.5.0.1
- base-compat-0.9.0
- hpack-0.10.0
- hpack-0.14.0
- microlens-0.4.1.0
- open-browser-0.2.1.0
- tls-1.3.5

View file

@ -19,7 +19,7 @@ nix:
packages:
- zlib
extra-deps:
- hpack-0.12.0
- hpack-0.14.0
- path-0.5.7
- path-io-1.1.0
- transformers-0.5.2.0

View file

@ -218,7 +218,7 @@ library
, hastache
, project-template >= 0.2
, zip-archive
, hpack >= 0.10.0 && < 0.15
, hpack >= 0.14.0 && < 0.15
if os(windows)
cpp-options: -DWINDOWS
build-depends: Win32