[commit: ghc] master: Add a --reset-hpcdirs flag to hpc (39f2737)

Ian Lynagh <[email protected]>
Newsgroups gmane.comp.lang.haskell.cvs.ghc
Message-ID <[email protected]>
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/39f273709488ec609b25320c10f2fc7b5f7518de

>---------------------------------------------------------------

commit 39f273709488ec609b25320c10f2fc7b5f7518de
Author: Ian Lynagh <[email protected]>
Date:   Fri Nov 23 18:03:22 2012 +0000

    Add a --reset-hpcdirs flag to hpc

>---------------------------------------------------------------

 docs/users_guide/profiling.xml |   18 +++++++++++++-----
 utils/hpc/HpcDraft.hs          |    1 +
 utils/hpc/HpcFlags.hs          |   18 ++++++++++++------
 utils/hpc/HpcMarkup.hs         |    1 +
 utils/hpc/HpcOverlay.hs        |    1 +
 utils/hpc/HpcReport.hs         |    1 +
 utils/hpc/HpcShowTix.hs        |    1 +
 7 files changed, 30 insertions(+), 11 deletions(-)

diff --git a/docs/users_guide/profiling.xml b/docs/users_guide/profiling.xml
index 5589fa9..f213c54 100644
--- a/docs/users_guide/profiling.xml
+++ b/docs/users_guide/profiling.xml
@@ -1626,8 +1626,10 @@ Options:
     --include=[PACKAGE:][MODULE]  include MODULE and/or PACKAGE
     --srcdir=DIR                  path to source directory of .hs files
                                   multi-use of srcdir possible
-    --hpcdir=DIR                  sub-directory that contains .mix files
+    --hpcdir=DIR                  append sub-directory that contains .mix files
                                   default .hpc [rarely used]
+    --reset-hpcdirs               empty the list of hpcdir's
+                                  [rarely used]
     --xml-output                  show output in XML
 </screen>
        </sect3>
@@ -1644,8 +1646,10 @@ Options:
     --include=[PACKAGE:][MODULE]  include MODULE and/or PACKAGE
     --srcdir=DIR                  path to source directory of .hs files
                                   multi-use of srcdir possible
-    --hpcdir=DIR                  sub-directory that contains .mix files
+    --hpcdir=DIR                  append sub-directory that contains .mix files
                                   default .hpc [rarely used]
+    --reset-hpcdirs               empty the list of hpcdir's
+                                  [rarely used]
     --fun-entry-count             show top-level function entry counts
     --highlight-covered           highlight covered code, rather that code gaps
     --destdir=DIR                 path to write output to
@@ -1723,8 +1727,10 @@ Options:
 
     --srcdir=DIR   path to source directory of .hs files
                    multi-use of srcdir possible
-    --hpcdir=DIR   sub-directory that contains .mix files
-                   default .hpc [rarely used]
+    --hpcdir=DIR                  append sub-directory that contains .mix files
+                                  default .hpc [rarely used]
+    --reset-hpcdirs               empty the list of hpcdir's
+                                  [rarely used]
     --output=FILE  output FILE
 % hpc help draft
 Usage: hpc draft [OPTION] .. &lt;TIX_FILE&gt;
@@ -1735,8 +1741,10 @@ Options:
     --include=[PACKAGE:][MODULE]  include MODULE and/or PACKAGE
     --srcdir=DIR                  path to source directory of .hs files
                                   multi-use of srcdir possible
-    --hpcdir=DIR                  sub-directory that contains .mix files
+    --hpcdir=DIR                  append sub-directory that contains .mix files
                                   default .hpc [rarely used]
+    --reset-hpcdirs               empty the list of hpcdir's
+                                  [rarely used]
     --output=FILE                 output FILE
 </screen>
       </sect3>
diff --git a/utils/hpc/HpcDraft.hs b/utils/hpc/HpcDraft.hs
index c0b5c47..b804d56 100644
--- a/utils/hpc/HpcDraft.hs
+++ b/utils/hpc/HpcDraft.hs
@@ -18,6 +18,7 @@ draft_options
         . includeOpt
         . srcDirOpt
         . hpcDirOpt
+        . resetHpcDirsOpt
         . outputOpt
 
 draft_plugin :: Plugin
diff --git a/utils/hpc/HpcFlags.hs b/utils/hpc/HpcFlags.hs
index b66d418..3bb3163 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
 
 -------------------------------------------------------------------------------
diff --git a/utils/hpc/HpcMarkup.hs b/utils/hpc/HpcMarkup.hs
index bd29782..ebec912 100644
--- a/utils/hpc/HpcMarkup.hs
+++ b/utils/hpc/HpcMarkup.hs
@@ -29,6 +29,7 @@ markup_options
         . includeOpt
         . srcDirOpt
         . hpcDirOpt
+        . resetHpcDirsOpt
         . funTotalsOpt
         . altHighlightOpt
         . destDirOpt
diff --git a/utils/hpc/HpcOverlay.hs b/utils/hpc/HpcOverlay.hs
index d5566aa..531018c 100644
--- a/utils/hpc/HpcOverlay.hs
+++ b/utils/hpc/HpcOverlay.hs
@@ -13,6 +13,7 @@ overlay_options :: FlagOptSeq
 overlay_options
         = srcDirOpt
         . hpcDirOpt
+        . resetHpcDirsOpt
         . outputOpt
 
 overlay_plugin :: Plugin
diff --git a/utils/hpc/HpcReport.hs b/utils/hpc/HpcReport.hs
index 12403eb..a97d6b0 100644
--- a/utils/hpc/HpcReport.hs
+++ b/utils/hpc/HpcReport.hs
@@ -272,6 +272,7 @@ report_options
         . includeOpt
         . srcDirOpt
         . hpcDirOpt
+        . resetHpcDirsOpt
         . xmlOutputOpt
 
 
diff --git a/utils/hpc/HpcShowTix.hs b/utils/hpc/HpcShowTix.hs
index 354ee06..13a2875 100644
--- a/utils/hpc/HpcShowTix.hs
+++ b/utils/hpc/HpcShowTix.hs
@@ -13,6 +13,7 @@ showtix_options
         . includeOpt
         . srcDirOpt
         . hpcDirOpt
+        . resetHpcDirsOpt
         . outputOpt
 
 showtix_plugin :: Plugin
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.