@@ -453,10 +453,11 @@ withExecuteEnv menv bopts boptsCli baseConfigOpts locals globalPackages snapshot
453453 dumpLog :: String -> (Path Abs Dir , Path Abs File ) -> m ()
454454 dumpLog msgSuffix (pkgDir, filepath) = do
455455 $ logInfo $ T. pack $ concat [" \n -- Dumping log file" , msgSuffix, " : " , toFilePath filepath, " \n " ]
456+ compilerVer <- view actualCompilerVersionL
456457 runResourceT
457458 $ CB. sourceFile (toFilePath filepath)
458459 $$ CT. decodeUtf8Lenient
459- =$ mungeBuildOutput ExcludeTHLoading ConvertPathsToAbsolute pkgDir
460+ =$ mungeBuildOutput ExcludeTHLoading ConvertPathsToAbsolute pkgDir compilerVer
460461 =$ CL. mapM_ $ logInfo
461462 $ logInfo $ T. pack $ " \n -- End of log file: " ++ toFilePath filepath ++ " \n "
462463
@@ -1093,8 +1094,9 @@ withSingleContext runInBase ActionContext {..} ExecuteEnv {..} task@Task {..} md
10931094 setupArgs = (" --builddir=" ++ toFilePathNoTrailingSep distRelativeDir') : args
10941095
10951096 runExe :: Path Abs File -> [String ] -> m ()
1096- runExe exeName fullArgs =
1097- runAndOutput `catch` \ (ProcessExitedUnsuccessfully _ ec) -> do
1097+ runExe exeName fullArgs = do
1098+ compilerVer <- view actualCompilerVersionL
1099+ runAndOutput compilerVer `catch` \ (ProcessExitedUnsuccessfully _ ec) -> do
10981100 bss <-
10991101 case mlogFile of
11001102 Nothing -> return []
@@ -1103,7 +1105,7 @@ withSingleContext runInBase ActionContext {..} ExecuteEnv {..} task@Task {..} md
11031105 runResourceT
11041106 $ CB. sourceFile (toFilePath logFile)
11051107 =$= CT. decodeUtf8Lenient
1106- $$ mungeBuildOutput stripTHLoading makeAbsolute pkgDir
1108+ $$ mungeBuildOutput stripTHLoading makeAbsolute pkgDir compilerVer
11071109 =$ CL. consume
11081110 throwM $ CabalExitedUnsuccessfully
11091111 ec
@@ -1113,18 +1115,22 @@ withSingleContext runInBase ActionContext {..} ExecuteEnv {..} task@Task {..} md
11131115 (fmap fst mlogFile)
11141116 bss
11151117 where
1116- runAndOutput :: m ()
1117- runAndOutput = case mlogFile of
1118+ runAndOutput :: CompilerVersion -> m ()
1119+ runAndOutput compilerVer = case mlogFile of
11181120 Just (_, h) ->
11191121 sinkProcessStderrStdoutHandle (Just pkgDir) menv (toFilePath exeName) fullArgs h h
11201122 Nothing ->
11211123 void $ sinkProcessStderrStdout (Just pkgDir) menv (toFilePath exeName) fullArgs
1122- (outputSink KeepTHLoading LevelWarn )
1123- (outputSink stripTHLoading LevelInfo )
1124- outputSink :: ExcludeTHLoading -> LogLevel -> Sink S. ByteString IO ()
1125- outputSink excludeTH level =
1124+ (outputSink KeepTHLoading LevelWarn compilerVer)
1125+ (outputSink stripTHLoading LevelInfo compilerVer)
1126+ outputSink
1127+ :: ExcludeTHLoading
1128+ -> LogLevel
1129+ -> CompilerVersion
1130+ -> Sink S. ByteString IO ()
1131+ outputSink excludeTH level compilerVer =
11261132 CT. decodeUtf8Lenient
1127- =$ mungeBuildOutput excludeTH makeAbsolute pkgDir
1133+ =$ mungeBuildOutput excludeTH makeAbsolute pkgDir compilerVer
11281134 =$ CL. mapM_ (runInBase . monadLoggerLog $ (TH. location >>= liftLoc) " " level)
11291135 -- If users want control, we should add a config option for this
11301136 makeAbsolute :: ConvertPathsToAbsolute
@@ -1691,12 +1697,13 @@ mungeBuildOutput :: forall m. (MonadIO m, MonadCatch m, MonadBaseControl IO m)
16911697 => ExcludeTHLoading -- ^ exclude TH loading?
16921698 -> ConvertPathsToAbsolute -- ^ convert paths to absolute?
16931699 -> Path Abs Dir -- ^ package's root directory
1700+ -> CompilerVersion -- ^ compiler we're building with
16941701 -> ConduitM Text Text m ()
1695- mungeBuildOutput excludeTHLoading makeAbsolute pkgDir = void $
1702+ mungeBuildOutput excludeTHLoading makeAbsolute pkgDir compilerVer = void $
16961703 CT. lines
16971704 =$ CL. map stripCR
16981705 =$ CL. filter (not . isTHLoading)
1699- =$ CL. filter ( not . isLinkerWarning)
1706+ =$ filterLinkerWarnings
17001707 =$ toAbsolute
17011708 where
17021709 -- | Is this line a Template Haskell "Loading package" line
@@ -1708,15 +1715,22 @@ mungeBuildOutput excludeTHLoading makeAbsolute pkgDir = void $
17081715 " Loading package " `T.isPrefixOf` bs &&
17091716 (" done." `T.isSuffixOf` bs || " done.\r " `T.isSuffixOf` bs)
17101717
1718+ filterLinkerWarnings :: ConduitM Text Text m ()
1719+ filterLinkerWarnings
1720+ -- Check for ghc 7.8 since it's the only one prone to producing
1721+ -- linker warnings on Windows x64
1722+ | getGhcVersion compilerVer >= $ (mkVersion " 7.8" ) = doNothing
1723+ | otherwise = CL. filter (not . isLinkerWarning)
1724+
17111725 isLinkerWarning :: Text -> Bool
17121726 isLinkerWarning str =
1713- (" ghc.exe: warning:" `T.isPrefixOf` str || " ghc.EXE: warning:" `T.isPrefixOf` str) &&
1714- " is linked instead of __imp_" `T.isInfixOf` str
1727+ (" ghc.exe: warning:" `T.isPrefixOf` str || " ghc.EXE: warning:" `T.isPrefixOf` str) &&
1728+ " is linked instead of __imp_" `T.isInfixOf` str
17151729
17161730 -- | Convert GHC error lines with file paths to have absolute file paths
17171731 toAbsolute :: ConduitM Text Text m ()
17181732 toAbsolute = case makeAbsolute of
1719- KeepPathsAsIs -> awaitForever yield
1733+ KeepPathsAsIs -> doNothing
17201734 ConvertPathsToAbsolute -> CL. mapM toAbsolutePath
17211735
17221736 toAbsolutePath :: Text -> m Text
@@ -1732,6 +1746,9 @@ mungeBuildOutput excludeTHLoading makeAbsolute pkgDir = void $
17321746 Nothing -> return bs
17331747 Just fp -> return $ fp `T.append` y
17341748
1749+ doNothing :: ConduitM Text Text m ()
1750+ doNothing = awaitForever yield
1751+
17351752 -- | Match the error location format at the end of lines
17361753 isValidSuffix = isRight . parseOnly lineCol
17371754 lineCol = char ' :'
0 commit comments