@@ -42,8 +42,8 @@ import Stack.Types
4242import System.Process.Read
4343import Text.Hastache (htmlEscape )
4444
45- -- | Move a tix file into a sub-directory of the hpc report directory.
46- -- Deletes the old one if one is present.
45+ -- | Move a tix file into a sub-directory of the hpc report directory. Deletes the old one if one is
46+ -- present.
4747updateTixFile :: (MonadIO m ,MonadReader env m ,HasConfig env ,MonadLogger m ,MonadBaseControl IO m ,MonadCatch m ,HasEnvConfig env )
4848 => Path Abs File -> String -> m ()
4949updateTixFile tixSrc pkgId = do
@@ -56,8 +56,8 @@ updateTixFile tixSrc pkgId = do
5656 createTree (parent tixDest)
5757 renameFile tixSrc tixDest
5858
59- -- | Get the tix file location, given the name of the file (without
60- -- extension), and the package identifier string.
59+ -- | Get the tix file location, given the name of the file (without extension), and the package
60+ -- identifier string.
6161tixFilePath :: (MonadIO m ,MonadReader env m ,HasConfig env ,MonadLogger m ,MonadBaseControl IO m ,MonadCatch m ,HasEnvConfig env )
6262 => String -> String -> m (Path Abs File )
6363tixFilePath pkgId tixName = do
@@ -66,13 +66,11 @@ tixFilePath pkgId tixName = do
6666 tixRel <- parseRelFile (tixName ++ " .tix" )
6767 return (outputDir </> pkgIdRel </> tixRel)
6868
69- -- | Generates the HTML coverage report and shows a textual coverage
70- -- summary for a package.
69+ -- | Generates the HTML coverage report and shows a textual coverage summary for a package.
7170generateHpcReport :: (MonadIO m ,MonadReader env m ,HasConfig env ,MonadLogger m ,MonadBaseControl IO m ,MonadCatch m ,HasEnvConfig env )
7271 => Path Abs Dir -> Package -> [Text ] -> m ()
7372generateHpcReport pkgDir package tests = do
74- -- If we're using > GHC 7.10, the hpc 'include' parameter must
75- -- specify a ghc package key. See
73+ -- If we're using > GHC 7.10, the hpc 'include' parameter must specify a ghc package key. See
7674 -- https://github.com/commercialhaskell/stack/issues/785
7775 let pkgName = packageNameText (packageName package)
7876 pkgId = packageIdentifierString (packageIdentifier package)
@@ -82,7 +80,7 @@ generateHpcReport pkgDir package tests = do
8280 if getGhcVersion compilerVersion < $ (mkVersion " 7.10" ) then return $ Right $ Just pkgId
8381 -- We don't expect to find a package key if there is no library.
8482 else if not (packageHasLibrary package) then return $ Right Nothing
85- -- Look in the
83+ -- Look in the inplace DB for the package key.
8684 -- See https://github.com/commercialhaskell/stack/issues/1181#issuecomment-148968986
8785 else do
8886 mghcPkgKey <- findPackageKeyForBuiltPackage pkgDir (packageIdentifier package)
@@ -99,9 +97,8 @@ generateHpcReport pkgDir package tests = do
9997 reportDir = parent tixSrc </> subdir
10098 case eincludeName of
10199 Left err -> generateHpcErrorReport reportDir (sanitize (T. unpack err))
102- -- Restrict to just the current library code, if there is a
103- -- library in the package (see #634 - this will likely be
104- -- customizable in the future)
100+ -- Restrict to just the current library code, if there is a library in the package (see
101+ -- #634 - this will likely be customizable in the future)
105102 Right mincludeName -> do
106103 let extraArgs = case mincludeName of
107104 Just includeName -> [" --include" , includeName ++ " :" ]
@@ -111,8 +108,7 @@ generateHpcReport pkgDir package tests = do
111108generateHpcReportInternal :: (MonadIO m ,MonadReader env m ,HasConfig env ,MonadLogger m ,MonadBaseControl IO m ,MonadCatch m ,HasEnvConfig env )
112109 => Path Abs File -> Path Abs Dir -> Text -> [String ] -> [String ] -> m ()
113110generateHpcReportInternal tixSrc reportDir report extraMarkupArgs extraReportArgs = do
114- -- If a .tix file exists, move it to the HPC output directory
115- -- and generate a report for it.
111+ -- If a .tix file exists, move it to the HPC output directory and generate a report for it.
116112 tixFileExists <- fileExists tixSrc
117113 if not tixFileExists
118114 then $ logError $ T. concat
@@ -129,11 +125,9 @@ generateHpcReportInternal tixSrc reportDir report extraMarkupArgs extraReportArg
129125 -- Compute arguments used for both "hpc markup" and "hpc report".
130126 pkgDirs <- Map. keys . envConfigPackages <$> asks getEnvConfig
131127 let args =
132- -- Use index files from all packages (allows cross-package
133- -- coverage results).
128+ -- Use index files from all packages (allows cross-package coverage results).
134129 concatMap (\ x -> [" --srcdir" , toFilePath x]) pkgDirs ++
135- -- Look for index files in the correct dir (relative to
136- -- each pkgdir).
130+ -- Look for index files in the correct dir (relative to each pkgdir).
137131 [" --hpcdir" , toFilePath hpcRelDir, " --reset-hpcdirs" ]
138132 menv <- getMinimalEnvOverride
139133 $ logInfo $ " Generating " <> report
@@ -159,8 +153,7 @@ generateHpcReportInternal tixSrc reportDir report extraMarkupArgs extraReportArg
159153 $ logError (msg False )
160154 generateHpcErrorReport reportDir (msg True )
161155 else do
162- -- Print output, stripping @\r@ characters because
163- -- Windows.
156+ -- Print output, stripping @\r@ characters because Windows.
164157 forM_ outputLines ($ logInfo . T. decodeUtf8 . S8. filter (not . (== ' \r ' )))
165158 $ logInfo
166159 (" The " <> report <> " is available at " <>
@@ -207,8 +200,8 @@ readTixOrLog path = do
207200 $ logError $ " Failed to read tix file " <> T. pack (toFilePath path)
208201 return mtix
209202
210- -- | Module names which contain '/' have a package name, and so they
211- -- weren't built into the executable.
203+ -- | Module names which contain '/' have a package name, and so they weren't built into the
204+ -- executable.
212205removeExeModules :: Tix -> Tix
213206removeExeModules (Tix ms) = Tix (filter (\ (TixModule name _ _ _) -> ' /' `elem` name) ms)
214207
0 commit comments