Skip to content

Commit 40e7a7a

Browse files
committed
Fix up Haskell.nix usage and add Hydra job for coverage
1 parent 9bce54e commit 40e7a7a

File tree

2 files changed

+20
-14
lines changed

2 files changed

+20
-14
lines changed

default.nix

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ let
7575

7676
# Creates a development environment for Cabal builds or ghci
7777
# sessions, with various build tools included.
78-
mkShell = name: hsPkgs: hsPkgs.shellFor {
78+
mkShell = name: hp: hp.shellFor {
7979
inherit name;
8080
packages = ps: attrValues (selectProjectPackages ps);
8181
buildInputs = (with self; [
@@ -150,12 +150,8 @@ let
150150
tests = collectComponents "tests" isProjectPackage coveredHaskellPackages;
151151
# `checks` are the result of executing the tests.
152152
checks = pkgs.recurseIntoAttrs (getPackageChecks (selectProjectPackages coveredHaskellPackages));
153-
# Combined coverage report
154-
# fixme: haskell.nix needs to support using `checks` attrset from
155-
# above, otherwise we will be running unnecessary test suites.
156-
# testCoverageReport = pkgs.haskell-nix.haskellLib.projectCoverageReport {
157-
# packages = selectProjectPackages coveredHaskellPackages;
158-
# };
153+
# Combined project coverage report
154+
inherit (coveredHaskellPackages) testCoverageReport;
159155
# `benchmarks` are only built, not run.
160156
benchmarks = collectComponents "benchmarks" isProjectPackage haskellPackages;
161157

nix/haskell.nix

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ let
3131
filterSubDir = subDir:
3232
haskell.haskellLib.cleanSourceWith { inherit src subDir; };
3333

34-
pkgSet = haskell.mkStackPkgSet {
34+
pkg-set = haskell.mkStackPkgSet {
3535
inherit stack-pkgs;
3636
modules = [
3737
# Add source filtering to local packages
@@ -302,10 +302,20 @@ let
302302
'';
303303
};
304304

305+
proj = haskell.addProjectAndPackageAttrs {
306+
inherit pkg-set;
307+
inherit (pkg-set.config) hsPkgs;
308+
};
309+
305310
in
306-
haskell.addProjectAndPackageAttrs {
307-
pkg-set = pkgSet;
308-
inherit (pkgSet.config) hsPkgs;
309-
_config = pkgSet.config;
310-
_roots = haskell.roots pkgSet.config.ghc;
311-
}
311+
proj.hsPkgs // {
312+
_config = proj.pkg-set.config;
313+
#_roots = haskell.roots proj.pkg-set.config.ghc;
314+
testCoverageReport = proj.projectCoverageReport.overrideAttrs (old: {
315+
buildCommand = old.buildCommand + ''
316+
mkdir -p $out/nix-support
317+
echo "report coverage $out/share/hpc/vanilla/html/all/hpc_index.html" >> $out/nix-support/hydra-build-products
318+
echo "report coverage-per-package $out/share/hpc/vanilla/html/index.html" >> $out/nix-support/hydra-build-products
319+
'';
320+
});
321+
}

0 commit comments

Comments
 (0)