on iko/ghcjs-patch-master help sign in
Fix hpc for cross-compiled builds (#862)
b129059Rodney Lorrimar
lib/cover-project.nix+9−3
@@ -60,9 +60,9 @@ let
60 srcDirs = map (l: l.src.outPath) (projectLibs);
60 srcDirs = map (l: l.src.outPath) (projectLibs);
61
61
62in pkgs.runCommand "project-coverage-report"
62in pkgs.runCommand "project-coverage-report"
63− ({ buildInputs = [ghc];
63+ ({ nativeBuildInputs = [ (ghc.buildGHC or ghc) pkgs.buildPackages.zip ];
64− LANG = "en_US.UTF-8";
64+ LANG = "en_US.UTF-8";
65− LC_ALL = "en_US.UTF-8";
65+ LC_ALL = "en_US.UTF-8";
66 } // lib.optionalAttrs (stdenv.buildPlatform.libc == "glibc") {
66 } // lib.optionalAttrs (stdenv.buildPlatform.libc == "glibc") {
67 LOCALE_ARCHIVE = "${pkgs.buildPackages.glibcLocales}/lib/locale/locale-archive";
67 LOCALE_ARCHIVE = "${pkgs.buildPackages.glibcLocales}/lib/locale/locale-archive";
68 })
68 })
@@ -106,6 +106,7 @@ in pkgs.runCommand "project-coverage-report"
106 popd
106 popd
107 }
107 }
108
108
109+ mkdir -p $out/nix-support
109 mkdir -p $out/share/hpc/vanilla/tix/all
110 mkdir -p $out/share/hpc/vanilla/tix/all
110 mkdir -p $out/share/hpc/vanilla/mix/
111 mkdir -p $out/share/hpc/vanilla/mix/
111 mkdir -p $out/share/hpc/vanilla/html/
112 mkdir -p $out/share/hpc/vanilla/html/
@@ -136,6 +137,7 @@ in pkgs.runCommand "project-coverage-report"
136
137
137 # Markup a HTML coverage report for the entire project
138 # Markup a HTML coverage report for the entire project
138 cp ${projectIndexHtml} $out/share/hpc/vanilla/html/index.html
139 cp ${projectIndexHtml} $out/share/hpc/vanilla/html/index.html
140+ echo "report coverage-per-package $out/share/hpc/vanilla/html/index.html" >> $out/nix-support/hydra-build-products
139
141
140 local markupOutDir="$out/share/hpc/vanilla/html/all"
142 local markupOutDir="$out/share/hpc/vanilla/html/all"
141 local srcDirs=${toBashArray srcDirs}
143 local srcDirs=${toBashArray srcDirs}
@@ -146,5 +148,9 @@ in pkgs.runCommand "project-coverage-report"
146 findModules allMixModules "$out/share/hpc/vanilla/mix/" "*.mix"
148 findModules allMixModules "$out/share/hpc/vanilla/mix/" "*.mix"
147
149
148 markup srcDirs mixDirs allMixModules "$markupOutDir" "$tixFile"
150 markup srcDirs mixDirs allMixModules "$markupOutDir" "$tixFile"
151+
152+ echo "report coverage $markupOutDir/hpc_index.html" >> $out/nix-support/hydra-build-products
153+ ( cd $out/share/hpc/vanilla/html ; zip -r $out/share/hpc/vanilla/html.zip . )
154+ echo "file zip $out/share/hpc/vanilla/html.zip" >> $out/nix-support/hydra-build-products
149 fi
155 fi
150 ''
156 ''
lib/cover.nix+7−1
@@ -24,7 +24,7 @@ let
24 srcDirs = map (l: l.src.outPath) mixLibraries;
24 srcDirs = map (l: l.src.outPath) mixLibraries;
25
25
26in pkgs.runCommand (name + "-coverage-report")
26in pkgs.runCommand (name + "-coverage-report")
27− ({ buildInputs = [ ghc ];
27+ ({nativeBuildInputs = [ (ghc.buildGHC or ghc) pkgs.buildPackages.zip ];
28 passthru = {
28 passthru = {
29 inherit name library checks;
29 inherit name library checks;
30 };
30 };
@@ -99,6 +99,7 @@ in pkgs.runCommand (name + "-coverage-report")
99
99
100 local mixDirs=${toBashArray mixDirs}
100 local mixDirs=${toBashArray mixDirs}
101
101
102+ mkdir -p $out/nix-support
102 mkdir -p $out/share/hpc/vanilla/mix/${name}
103 mkdir -p $out/share/hpc/vanilla/mix/${name}
103 mkdir -p $out/share/hpc/vanilla/tix/${name}
104 mkdir -p $out/share/hpc/vanilla/tix/${name}
104 mkdir -p $out/share/hpc/vanilla/html/${name}
105 mkdir -p $out/share/hpc/vanilla/html/${name}
@@ -161,5 +162,10 @@ in pkgs.runCommand (name + "-coverage-report")
161
162
162 # Markup a HTML report, included modules from only this package
163 # Markup a HTML report, included modules from only this package
163 markup srcDirs mixDirs pkgMixModules "$markupOutDir" "$sumTixFile"
164 markup srcDirs mixDirs pkgMixModules "$markupOutDir" "$sumTixFile"
165+
166+ # Provide a HTML zipfile and Hydra links
167+ ( cd "$markupOutDir" ; zip -r $out/share/hpc/vanilla/${name}-html.zip . )
168+ echo "report coverage $markupOutDir/hpc_index.html" >> $out/nix-support/hydra-build-products
169+ echo "file zip $out/share/hpc/vanilla/${name}-html.zip" >> $out/nix-support/hydra-build-products
164 fi
170 fi
165 ''
171 ''