Skip to content

Commit 862becf

Browse files
committed
builder: reduce duplication in test/benchmark installPhase
1 parent 2243d5d commit 862becf

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

builder/comp-builder.nix

Lines changed: 4 additions & 7 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

@@ -235,11 +235,8 @@ stdenv.mkDerivation ({
235235
''}
236236
${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

0 commit comments

Comments
 (0)