summaryrefslogtreecommitdiff
path: root/utils/hpc/HpcFlags.hs
diff options
context:
space:
mode:
authorIan Lynagh <ian@well-typed.com>2012-11-23 18:03:22 +0000
committerIan Lynagh <ian@well-typed.com>2012-11-23 18:03:22 +0000
commit39f273709488ec609b25320c10f2fc7b5f7518de (patch)
treeca0be8558f0045da50d5ad11c832fb2909621539 /utils/hpc/HpcFlags.hs
parent95027b829425b1a4f18f2cb197a0982cfaedcbe5 (diff)
downloadhaskell-39f273709488ec609b25320c10f2fc7b5f7518de.tar.gz
Add a --reset-hpcdirs flag to hpc
Diffstat (limited to 'utils/hpc/HpcFlags.hs')
-rw-r--r--utils/hpc/HpcFlags.hs18
1 files changed, 12 insertions, 6 deletions
diff --git a/utils/hpc/HpcFlags.hs b/utils/hpc/HpcFlags.hs
index b66d418e6c..3bb31639b1 100644
--- a/utils/hpc/HpcFlags.hs
+++ b/utils/hpc/HpcFlags.hs
@@ -13,7 +13,7 @@ data Flags = Flags
{ outputFile :: String
, includeMods :: Set.Set String
, excludeMods :: Set.Set String
- , hpcDir :: String
+ , hpcDirs :: [String]
, srcDirs :: [String]
, destDir :: String
@@ -34,7 +34,7 @@ default_flags = Flags
{ outputFile = "-"
, includeMods = Set.empty
, excludeMods = Set.empty
- , hpcDir = ".hpc"
+ , hpcDirs = [".hpc"]
, srcDirs = []
, destDir = "."
@@ -72,7 +72,8 @@ anArg flag detail argtype fn = (:) $ Option [] [flag] (ReqArg fn argtype) detail
infoArg :: String -> FlagOptSeq
infoArg info = (:) $ Option [] [] (NoArg $ id) info
-excludeOpt, includeOpt, hpcDirOpt, srcDirOpt, destDirOpt, outputOpt,
+excludeOpt, includeOpt, hpcDirOpt, resetHpcDirsOpt, srcDirOpt,
+ destDirOpt, outputOpt,
perModuleOpt, decListOpt, xmlOutputOpt, funTotalsOpt,
altHighlightOpt, combineFunOpt, combineFunOptInfo, mapFunOpt,
mapFunOptInfo, unionModuleOpt :: FlagOptSeq
@@ -82,10 +83,14 @@ excludeOpt = anArg "exclude" "exclude MODULE and/or PACKAGE" "[PACKAGE:]
includeOpt = anArg "include" "include MODULE and/or PACKAGE" "[PACKAGE:][MODULE]"
$ \ a f -> f { includeMods = a `Set.insert` includeMods f }
-hpcDirOpt = anArg "hpcdir" "sub-directory that contains .mix files" "DIR"
- (\ a f -> f { hpcDir = a })
+hpcDirOpt = anArg "hpcdir" "append sub-directory that contains .mix files" "DIR"
+ (\ a f -> f { hpcDirs = hpcDirs f ++ [a] })
. infoArg "default .hpc [rarely used]"
+resetHpcDirsOpt = noArg "reset-hpcdirs" "empty the list of hpcdir's"
+ (\ f -> f { hpcDirs = [] })
+ . infoArg "[rarely used]"
+
srcDirOpt = anArg "srcdir" "path to source directory of .hs files" "DIR"
(\ a f -> f { srcDirs = srcDirs f ++ [a] })
. infoArg "multi-use of srcdir possible"
@@ -130,8 +135,9 @@ unionModuleOpt = noArg "union"
-------------------------------------------------------------------------------
readMixWithFlags :: Flags -> Either String TixModule -> IO Mix
-readMixWithFlags flags modu = readMix [ dir ++ "/" ++ hpcDir flags
+readMixWithFlags flags modu = readMix [ dir ++ "/" ++ hpcDir
| dir <- srcDirs flags
+ , hpcDir <- hpcDirs flags
] modu
-------------------------------------------------------------------------------