mirror of
https://github.com/ilyakooo0/haskell.nix.git
synced 2024-09-11 06:55:40 +03:00
ghcjs: copy and run tests (#494)
This commit is contained in:
parent
b921ff83f0
commit
13a88d15f3
@ -1,4 +1,4 @@
|
||||
{ stdenv, buildPackages, ghc, lib, gobject-introspection ? null, haskellLib, makeConfigFiles, ghcForComponent, hsPkgs, runCommand, libffi, gmp }:
|
||||
{ stdenv, buildPackages, ghc, lib, gobject-introspection ? null, haskellLib, makeConfigFiles, ghcForComponent, hsPkgs, runCommand, libffi, gmp, nodejs }:
|
||||
|
||||
{ componentId
|
||||
, component
|
||||
@ -142,7 +142,8 @@ let
|
||||
&& (haskellLib.isLibrary componentId)
|
||||
&& !haskellLib.isCrossHost;
|
||||
|
||||
exeExt = lib.optionalString stdenv.hostPlatform.isWindows ".exe";
|
||||
exeExt = if stdenv.hostPlatform.isGhcjs then ".jsexe/all.js" else
|
||||
if stdenv.hostPlatform.isWindows then ".exe" else "";
|
||||
exeName = componentId.cname + exeExt;
|
||||
testExecutable = "dist/build/${componentId.cname}/${exeName}";
|
||||
|
||||
@ -313,7 +314,13 @@ stdenv.mkDerivation ({
|
||||
${(lib.optionalString (haskellLib.isTest componentId || haskellLib.isBenchmark componentId || haskellLib.isAll componentId) ''
|
||||
mkdir -p $out/bin
|
||||
if [ -f ${testExecutable} ]; then
|
||||
cp ${testExecutable} $out/bin/
|
||||
mkdir -p $(dirname $out/bin/${exeName})
|
||||
${if stdenv.hostPlatform.isGhcjs then ''
|
||||
cat <(echo \#!${lib.getBin buildPackages.nodejs}/bin/node) ${testExecutable} >| $out/bin/${exeName}
|
||||
chmod +x $out/bin/${exeName}
|
||||
'' else ''
|
||||
cp -r ${testExecutable} $(dirname $out/bin/${exeName})
|
||||
''}
|
||||
fi
|
||||
'')
|
||||
# In case `setup copy` did not creat this
|
||||
|
Loading…
Reference in New Issue
Block a user