X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=utils%2Fhpc%2FHpcMarkup.hs;h=4b3b976f5aee774c375b9529e05a91350d5a4331;hb=a8427a4125e9b78e88a487eeabf018f1c6e8bc08;hp=53eaf323e8e07340c90823d5cbe4affbc88acd93;hpb=11d36d9f0256a3a3ef2934a776924f7c90afb6de;p=ghc-hetmet.git diff --git a/utils/hpc/HpcMarkup.hs b/utils/hpc/HpcMarkup.hs index 53eaf32..4b3b976 100644 --- a/utils/hpc/HpcMarkup.hs +++ b/utils/hpc/HpcMarkup.hs @@ -12,18 +12,22 @@ import Trace.Hpc.Util import HpcFlags import System.Environment +import System.Directory import Data.List import Data.Maybe(fromJust) import Data.Array -import qualified Data.Set as Set +import qualified HpcSet as Set ------------------------------------------------------------------------------ -markup_options = - [ excludeOpt,includeOpt,hpcDirOpt,hsDirOpt,funTotalsOpt - , altHighlightOpt - , destDirOpt - ] +markup_options + = excludeOpt + . includeOpt + . srcDirOpt + . hpcDirOpt + . funTotalsOpt + . altHighlightOpt + . destDirOpt markup_plugin = Plugin { name = "markup" , usage = "[OPTION] .. [ [ ..]]" @@ -43,20 +47,23 @@ markup_main flags (prog:modNames) = do `Set.union` includeMods flags } let Flags - { hpcDirs = hpcDirs - , hsDirs = theHsPath - , funTotals = theFunTotals + { funTotals = theFunTotals , altHighlight = invertOutput , destDir = dest_dir } = hpcflags1 mtix <- readTix (getTixFileName prog) Tix tixs <- case mtix of - Nothing -> error $ "unable to find tix file for: " ++ prog + Nothing -> hpcError markup_plugin $ "unable to find tix file for: " ++ prog Just a -> return a +#if __GLASGOW_HASKELL__ >= 604 + -- create the dest_dir if needed + createDirectoryIfMissing True dest_dir +#endif + mods <- - sequence [ genHtmlFromMod dest_dir hpcDirs tix theFunTotals theHsPath invertOutput + sequence [ genHtmlFromMod dest_dir hpcflags1 tix theFunTotals invertOutput | tix <- tixs , allowModule hpcflags1 (tixModuleName tix) ] @@ -68,6 +75,9 @@ markup_main flags (prog:modNames) = do let writeSummary name cmp = do let mods' = sortBy cmp mods + + + putStrLn $ "Writing: " ++ (name ++ ".html") writeFile (dest_dir ++ "/" ++ name ++ ".html") $ @@ -75,6 +85,7 @@ markup_main flags (prog:modNames) = do "