Skip to content

Commit 5ac12d0

Browse files
authored
builder: Install benchmarks properly (#175)
* builder: Install benchmarks properly * builder: reduce duplication in test/benchmark installPhase
1 parent 62984c9 commit 5ac12d0

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

builder/comp-builder.nix

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ let
104104
&& (haskellLib.isLibrary componentId)
105105
&& stdenv.hostPlatform == stdenv.buildPlatform;
106106

107-
testExecutable = "dist/build/${componentId.cname}/${componentId.cname}"
108-
+ lib.optionalString stdenv.hostPlatform.isWindows ".exe";
107+
exeExt = lib.optionalString stdenv.hostPlatform.isWindows ".exe";
108+
testExecutable = "dist/build/${componentId.cname}/${componentId.cname}${exeExt}";
109109

110110
in stdenv.lib.fix (drv:
111111

@@ -233,13 +233,10 @@ stdenv.mkDerivation ({
233233
${ghc.targetPrefix}ghc-pkg -v0 --package-db ${configFiles}/package.conf.d -f $out/package.conf.d register ${name}.conf
234234
fi
235235
''}
236-
${lib.optionalString (haskellLib.isTest componentId || haskellLib.isAll componentId) ''
236+
${lib.optionalString (haskellLib.isTest componentId || haskellLib.isBenchmark componentId || haskellLib.isAll componentId) ''
237237
mkdir -p $out/${name}
238-
if [ -f "dist/build/${componentId.cname}/${componentId.cname}" ]; then
239-
cp dist/build/${componentId.cname}/${componentId.cname} $out/${name}/
240-
fi
241-
if [ -f "dist/build/${componentId.cname}/${componentId.cname}.exe" ]; then
242-
cp dist/build/${componentId.cname}/${componentId.cname}.exe $out/${name}/
238+
if [ -f ${testExecutable} ]; then
239+
cp ${testExecutable} $out/${name}/
243240
fi
244241
''}
245242
runHook postInstall

lib/default.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ with haskellLib;
5555
isLibrary = componentId: componentId.ctype == "lib";
5656
isAll = componentId: componentId.ctype == "all";
5757
isTest = componentId: componentId.ctype == "test";
58+
isBenchmark = componentId: componentId.ctype == "bench";
5859

5960
# Format a componentId as it should appear as a target on the
6061
# command line of the setup script.

0 commit comments

Comments
 (0)