Skip to content

Commit

Permalink
Make hpack default to only outputting warnings #2011
Browse files Browse the repository at this point in the history
  • Loading branch information
mgsloan committed May 14, 2016
1 parent 4ebc3d2 commit 872ff1e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
16 changes: 13 additions & 3 deletions src/Stack/Package.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion stack-7.8.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion stack-8.0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion stack.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 872ff1e

Please sign in to comment.