-
Notifications
You must be signed in to change notification settings - Fork 239
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
Replace collectRunComponents with haskellLib.check #316
Changes from all commits
8ae8b5a
349abfa
cfb1699
de8c4ad
b29de00
47e0bb7
cee580c
42c7cce
a51248c
848c395
b68c60e
e6505d5
4d619a7
9b9fa13
a43d302
a9d867d
c54a039
d8314a7
b6975b5
cf15c36
77e0098
8323b9c
d07ffb0
013c0fd
896854b
64afed9
3ce1b29
64689a4
bf5dc77
79a7f9f
bb5daae
37b9e11
ec4a4eb
e8fae60
c6ab443
1dc1708
a1e0b92
a8a044f
e861f35
fff24e4
d8199c4
5a321d3
6021f5d
b79da5f
4cf064f
192737c
27ce94c
c2be4ab
344abd7
fa15c3a
46cd1a8
d635a22
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,8 +20,6 @@ | |
, preHaddock ? component.preHaddock , postHaddock ? component.postHaddock | ||
, shellHook ? "" | ||
|
||
, doCheck ? component.doCheck || haskellLib.isTest componentId | ||
, doCrossCheck ? component.doCrossCheck || false | ||
, dontPatchELF ? true | ||
, dontStrip ? true | ||
|
||
|
@@ -128,13 +126,7 @@ let | |
|
||
exeExt = lib.optionalString stdenv.hostPlatform.isWindows ".exe"; | ||
testExecutable = "dist/build/${componentId.cname}/${componentId.cname}${exeExt}"; | ||
# exe components are in /bin, but test and benchmarks are not. Perhaps to avoid | ||
# them being from being added to the PATH when the all component added to an env. | ||
# TODO revist this to find out why and document or maybe change this. | ||
installedExeDir = if haskellLib.isTest componentId || haskellLib.isBenchmark componentId | ||
then name | ||
else "bin"; | ||
installedExe = "${installedExeDir}/${componentId.cname}${exeExt}"; | ||
installedExe = "bin/${componentId.cname}${exeExt}"; | ||
|
||
in stdenv.lib.fix (drv: | ||
|
||
|
@@ -143,20 +135,20 @@ stdenv.mkDerivation ({ | |
|
||
src = cleanSrc; | ||
|
||
inherit doCheck doCrossCheck dontPatchELF dontStrip; | ||
doCheck = false; | ||
doCrossCheck = false; | ||
|
||
inherit dontPatchELF dontStrip; | ||
|
||
passthru = { | ||
inherit (package) identifier; | ||
config = component; | ||
inherit configFiles executableToolDepends cleanSrc; | ||
inherit configFiles executableToolDepends cleanSrc installedExe; | ||
env = shellWrappers; | ||
|
||
# The directory containing the haddock documentation. | ||
# `null' if no haddock documentation was built. | ||
haddockDir = if doHaddock' then "${docdir drv.doc}/html" else null; | ||
run = runCommand (fullName + "-run") {} '' | ||
${toString component.testWrapper} ${drv}/${installedExe} | tee $out | ||
''; | ||
}; | ||
|
||
meta = { | ||
|
@@ -217,13 +209,7 @@ stdenv.mkDerivation ({ | |
runHook postBuild | ||
''; | ||
|
||
checkPhase = '' | ||
runHook preCheck | ||
|
||
${toString component.testWrapper} ${testExecutable} ${lib.concatStringsSep " " component.testFlags} | ||
|
||
runHook postCheck | ||
''; | ||
checkPhase = "notice: Tests are only executed by building the .run sub-derivation of this component."; | ||
|
||
haddockPhase = '' | ||
runHook preHaddock | ||
|
@@ -281,25 +267,25 @@ stdenv.mkDerivation ({ | |
fi | ||
''} | ||
${(lib.optionalString (haskellLib.isTest componentId || haskellLib.isBenchmark componentId || haskellLib.isAll componentId) '' | ||
mkdir -p $out/${name} | ||
mkdir -p $out/bin | ||
if [ -f ${testExecutable} ]; then | ||
cp ${testExecutable} $out/${name}/ | ||
cp ${testExecutable} $out/bin/ | ||
fi | ||
'') | ||
# In case `setup copy` did not creat this | ||
+ (lib.optionalString enableSeparateDataOutput "mkdir -p $data") | ||
+ (lib.optionalString (stdenv.hostPlatform.isWindows && (haskellLib.mayHaveExecutable componentId)) '' | ||
echo "Copying libffi and gmp .dlls ..." | ||
echo "Symlink libffi and gmp .dlls ..." | ||
for p in ${lib.concatStringsSep " " [ libffi gmp ]}; do | ||
find "$p" -iname '*.dll' -exec cp {} $out/${installedExeDir} \; | ||
find "$p" -iname '*.dll' -exec ln -s {} $out/bin \; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you think it's better/possible to do this symlinking of DLLs only when running the check phase? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it might be better to do it here or running without using |
||
done | ||
# copy all .dlls into the local directory. | ||
# symlink all .dlls into the local directory. | ||
# we ask ghc-pkg for *all* dynamic-library-dirs and then iterate over the unique set | ||
# to copy over dlls as needed. | ||
echo "Copying library dependencies..." | ||
# to symlink over dlls as needed. | ||
echo "Symlink library dependencies..." | ||
for libdir in $(x86_64-pc-mingw32-ghc-pkg --package-db=$packageConfDir field "*" dynamic-library-dirs --simple-output|xargs|sed 's/ /\n/g'|sort -u); do | ||
if [ -d "$libdir" ]; then | ||
find "$libdir" -iname '*.dll' -exec cp {} $out/${installedExeDir} \; | ||
find "$libdir" -iname '*.dll' -exec ln -s {} $out/bin \; | ||
fi | ||
done | ||
'') | ||
|
@@ -316,7 +302,7 @@ stdenv.mkDerivation ({ | |
// lib.optionalAttrs (patches != []) { patches = map (p: if builtins.isFunction p then p { inherit (package.identifier) version; inherit revision; } else p) patches; } | ||
// haskellLib.optionalHooks { | ||
inherit preUnpack postUnpack preConfigure postConfigure | ||
preBuild postBuild preCheck postCheck | ||
preBuild postBuild | ||
preInstall postInstall preHaddock postHaddock; | ||
} | ||
// lib.optionalAttrs (stdenv.buildPlatform.libc == "glibc"){ LOCALE_ARCHIVE = "${buildPackages.glibcLocales}/lib/locale/locale-archive"; } | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ stdenv, lib, haskellLib, srcOnly }: | ||
drv: | ||
|
||
let | ||
component = drv.config; | ||
|
||
# This derivation can be used to execute test component. | ||
# The $out of the derivation is a file containing the resulting | ||
# stdout output. | ||
in stdenv.mkDerivation ({ | ||
name = (drv.name + "-check"); | ||
|
||
# Useing `srcOnly` (rather than getting the `src` via a `drv.passthru`) | ||
# should correctly apply the patches from `drv` (if any). | ||
src = srcOnly drv; | ||
|
||
passthru = { | ||
inherit (drv) identifier config configFiles executableToolDepends cleanSrc env; | ||
}; | ||
|
||
inherit (drv) meta LANG LC_ALL; | ||
|
||
inherit (component) doCheck doCrossCheck; | ||
|
||
phases = ["buildPhase" "checkPhase"]; | ||
|
||
# If doCheck or doCrossCheck are false we may still build this | ||
# component and we want it to quietly succeed. | ||
buildPhase = '' | ||
touch $out | ||
''; | ||
|
||
checkPhase = '' | ||
runHook preCheck | ||
|
||
${toString component.testWrapper} ${drv}/${drv.installedExe} ${lib.concatStringsSep " " component.testFlags} | tee $out | ||
|
||
runHook postCheck | ||
''; | ||
} // haskellLib.optionalHooks { | ||
inherit (component) preCheck postCheck; | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be helpful