Skip to content

Fix hpc for cross-compiled builds #862

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Oct 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions lib/cover-project.nix
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ let
srcDirs = map (l: l.src.outPath) (projectLibs);

in pkgs.runCommand "project-coverage-report"
({ buildInputs = [ghc];
LANG = "en_US.UTF-8";
LC_ALL = "en_US.UTF-8";
({ nativeBuildInputs = [ (ghc.buildGHC or ghc) pkgs.buildPackages.zip ];
LANG = "en_US.UTF-8";
LC_ALL = "en_US.UTF-8";
} // lib.optionalAttrs (stdenv.buildPlatform.libc == "glibc") {
LOCALE_ARCHIVE = "${pkgs.buildPackages.glibcLocales}/lib/locale/locale-archive";
})
Expand Down Expand Up @@ -106,6 +106,7 @@ in pkgs.runCommand "project-coverage-report"
popd
}

mkdir -p $out/nix-support
mkdir -p $out/share/hpc/vanilla/tix/all
mkdir -p $out/share/hpc/vanilla/mix/
mkdir -p $out/share/hpc/vanilla/html/
Expand Down Expand Up @@ -136,6 +137,7 @@ in pkgs.runCommand "project-coverage-report"

# Markup a HTML coverage report for the entire project
cp ${projectIndexHtml} $out/share/hpc/vanilla/html/index.html
echo "report coverage-per-package $out/share/hpc/vanilla/html/index.html" >> $out/nix-support/hydra-build-products

local markupOutDir="$out/share/hpc/vanilla/html/all"
local srcDirs=${toBashArray srcDirs}
Expand All @@ -146,5 +148,9 @@ in pkgs.runCommand "project-coverage-report"
findModules allMixModules "$out/share/hpc/vanilla/mix/" "*.mix"

markup srcDirs mixDirs allMixModules "$markupOutDir" "$tixFile"

echo "report coverage $markupOutDir/hpc_index.html" >> $out/nix-support/hydra-build-products
( cd $out/share/hpc/vanilla/html ; zip -r $out/share/hpc/vanilla/html.zip . )
echo "file zip $out/share/hpc/vanilla/html.zip" >> $out/nix-support/hydra-build-products
fi
''
8 changes: 7 additions & 1 deletion lib/cover.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ let
srcDirs = map (l: l.src.outPath) mixLibraries;

in pkgs.runCommand (name + "-coverage-report")
({ buildInputs = [ ghc ];
({nativeBuildInputs = [ (ghc.buildGHC or ghc) pkgs.buildPackages.zip ];
passthru = {
inherit name library checks;
};
Expand Down Expand Up @@ -99,6 +99,7 @@ in pkgs.runCommand (name + "-coverage-report")

local mixDirs=${toBashArray mixDirs}

mkdir -p $out/nix-support
mkdir -p $out/share/hpc/vanilla/mix/${name}
mkdir -p $out/share/hpc/vanilla/tix/${name}
mkdir -p $out/share/hpc/vanilla/html/${name}
Expand Down Expand Up @@ -161,5 +162,10 @@ in pkgs.runCommand (name + "-coverage-report")

# Markup a HTML report, included modules from only this package
markup srcDirs mixDirs pkgMixModules "$markupOutDir" "$sumTixFile"

# Provide a HTML zipfile and Hydra links
( cd "$markupOutDir" ; zip -r $out/share/hpc/vanilla/${name}-html.zip . )
echo "report coverage $markupOutDir/hpc_index.html" >> $out/nix-support/hydra-build-products
echo "file zip $out/share/hpc/vanilla/${name}-html.zip" >> $out/nix-support/hydra-build-products
fi
''