hpc-lcov 1.0.0 → 1.0.1
raw patch · 5 files changed
+21/−13 lines, 5 filesdep ~aesondep ~optparse-applicativedep ~pathPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: aeson, optparse-applicative, path, path-io
API changes (from Hackage documentation)
Files
- CHANGELOG.md +6/−0
- README.md +2/−2
- exe/Main.hs +8/−3
- hpc-lcov.cabal +3/−3
- src/Trace/Hpc/Lcov/Report.hs +2/−5
CHANGELOG.md view
@@ -1,5 +1,11 @@ ## Upcoming +## 1.0.1++Bug fix:++* Don't error if the `packages` field in `stack.yaml` doesn't exist+ ## 1.0.0 Initial release of `hpc-lcov`:
README.md view
@@ -11,9 +11,9 @@ ### Stack -1. Run `stack build hpc-lcov`+1. Run `stack install hpc-lcov` 1. Run your test(s) with coverage, e.g. `stack test --coverage`-1. Run `stack exec hpc-lcov`+1. Run `hpc-lcov` 1. Upload the generated `lcov.info` file to your coverage service ### Cabal
exe/Main.hs view
@@ -7,7 +7,8 @@ import Control.Monad (forM) import qualified Data.Aeson as JSON import qualified Data.Aeson.Types as JSON-import Data.HashMap.Lazy (HashMap, (!))+import Data.HashMap.Lazy (HashMap)+import qualified Data.HashMap.Lazy as HashMap import Data.List (find, isPrefixOf) import qualified Data.Map as Map import Data.Maybe (fromMaybe)@@ -168,8 +169,12 @@ stackConfigDir <- Path.parent <$> Path.parseAbsFile stackConfigPath - packagePaths <- maybe (fail $ "Invalid packages field: " ++ show stackConfig) return $- JSON.parseMaybe JSON.parseJSON (stackConfig ! "packages")+ packagePaths <- case HashMap.lookup "packages" stackConfig of+ Nothing -> pure ["."]+ Just packagesField ->+ case JSON.parseMaybe JSON.parseJSON packagesField of+ Just packages -> return packages+ Nothing -> fail $ "Invalid packages field: " ++ show stackConfig forM packagePaths $ \packagePath -> do packageDir <- case packagePath of
hpc-lcov.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: b79ca55a2aa6f2e6e21c1a0a8b3e7cd5351aa31bcdb45110c89044f6271aa51a+-- hash: fcb5afe73b641055dbaa90b0e976ead73d6bf55fa27df7c61574f3762fc26ad6 name: hpc-lcov-version: 1.0.0+version: 1.0.1 synopsis: Convert HPC output into LCOV format description: Convert HPC output into LCOV format. category: Control@@ -54,7 +54,7 @@ exe ghc-options: -Wall build-depends:- aeson >=1.1.2.0 && <1.5+ aeson >=1.1.2.0 && <1.6 , base >=4.9 && <5 , containers >=0.5.7.1 && <0.7 , hpc >=0.6.0.3 && <0.7
src/Trace/Hpc/Lcov/Report.hs view
@@ -11,9 +11,7 @@ ) where import Data.List (intercalate)-import Data.Word (Word32) import Trace.Hpc.Util (Hash)-import Unsafe.Coerce (unsafeCoerce) -- http://ltp.sourceforge.net/coverage/lcov/geninfo.1.php newtype LcovReport = LcovReport [FileReport]@@ -70,10 +68,9 @@ showFunctionHits FunctionReport{..} = line "FNDA" [show functionReportHits, functionReportName] generateBranchReport BranchReport{..} =- let branchHash = unsafeCoerce branchReportHash :: Word32- mkBranchLine branchNum hits = line "BRDA"+ let mkBranchLine branchNum hits = line "BRDA" [ show branchReportLine- , show branchHash+ , show branchReportHash , show (branchNum :: Int) , show hits ]