Skip to content

Commit

Permalink
Fix hpc command, improve CLI help #2664
Browse files Browse the repository at this point in the history
  • Loading branch information
mgsloan committed Oct 2, 2016
1 parent a15b11e commit 1ff1556
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
8 changes: 5 additions & 3 deletions src/Stack/Coverage.hs
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ generateHpcReportForTargets opts = do
forM (toList comps) $ \nc ->
case nc of
CTest testName ->
liftM (pkgPath </>) $ parseRelFile (T.unpack testName ++ ".tix")
liftM (pkgPath </>) $ parseRelFile (T.unpack testName ++ "/" ++ T.unpack testName ++ ".tix")
_ -> fail $
"Can't specify anything except test-suites as hpc report targets (" ++
packageNameString name ++
Expand All @@ -257,8 +257,10 @@ generateHpcReportForTargets opts = do
exists <- doesDirExist pkgPath
if exists
then do
(_, files) <- listDir pkgPath
return (filter ((".tix" `isSuffixOf`) . toFilePath) files)
(dirs, _) <- listDir pkgPath
liftM concat $ forM dirs $ \dir -> do
(_, files) <- listDir dir
return (filter ((".tix" `isSuffixOf`) . toFilePath) files)
else return []
tixPaths <- liftM (++ targetTixFiles) $ mapM (resolveFile' . T.unpack) tixFiles
when (null tixPaths) $
Expand Down
4 changes: 2 additions & 2 deletions src/Stack/Options/HpcReportParser.hs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import Stack.Types.Config
hpcReportOptsParser :: Parser HpcReportOpts
hpcReportOptsParser = HpcReportOpts
<$> many (textArgument $ metavar "TARGET_OR_TIX")
<*> switch (long "all" <> help "Use results from all packages and components")
<*> optional (strOption (long "destdir" <> help "Output directy for HTML report"))
<*> switch (long "all" <> help "Use results from all packages and components involved in previous --coverage run")
<*> optional (strOption (long "destdir" <> help "Output directory for HTML report"))

pvpBoundsOption :: Parser PvpBounds
pvpBoundsOption =
Expand Down
2 changes: 1 addition & 1 deletion src/main/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ commandLineHandler progName isInterpreter = complicatedOptions
"hpc"
"Subcommands specific to Haskell Program Coverage"
(addCommand' "report"
"Generate HPC report a combined HPC report"
"Generate unified HPC coverage report from tix files and project targets"
hpcReportCmd
hpcReportOptsParser)
)
Expand Down

0 comments on commit 1ff1556

Please sign in to comment.