Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
sevanspowell committed Aug 3, 2020
1 parent f5f564b commit f1b464e
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 94 deletions.
93 changes: 0 additions & 93 deletions lib/cover-files-only.nix

This file was deleted.

44 changes: 44 additions & 0 deletions lib/cover-project.nix
@@ -0,0 +1,44 @@
{ pkgs, stdenv, lib, haskellLib }:

project:

let
coverageReports = lib.mapAttrsToList (n: package: package.coverageReport) project;
in
stdenv.mkDerivation {
name = "coverage-report";

phases = ["buildPhase"];

buildInputs = (with pkgs.haskellPackages; [
ghc
]);

buildPhase = ''
mkdir -p $out/share/hpc/tix/all
mkdir -p $out/share/hpc/mix/
findMixDir() {
find $1 -iwholename "*/hpc/vanilla/mix" -exec find {} -maxdepth 1 -type d -iwholename "*/mix/*" \; -quit
}
findCabalFile() {
find $1 -iname "*.cabal" -print -quit
}
# Create tix file with test run information for all packages
tixFile="$out/share/hpc/tix/all/all.tix"
hpcSumCmd=("hpc" "sum" "--union" "--output=$tixFile")
for report in ${lib.concatStringsSep " " coverageReports}; do
for tix in $(find $report -iwholename "*.tix" -type f); do
hpcSumCmd+=("$tix")
done
# Copy mix and tix information over from each report
cp -R $report/share/hpc/mix/* $out/share/hpc/mix
cp -R $report/share/hpc/tix/* $out/share/hpc/tix
done
eval "''${hpcSumCmd[@]}"
'';
}
2 changes: 1 addition & 1 deletion lib/default.nix
Expand Up @@ -244,7 +244,7 @@ in {
inherit stdenv lib haskellLib pkgs;
};

projectCoverageReport = import ./cover-files-only.nix {
projectCoverageReport = import ./cover-project.nix {
inherit stdenv lib haskellLib pkgs;
};

Expand Down

0 comments on commit f1b464e

Please sign in to comment.