mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-19 04:02:10 +00:00
rustPlatform.cargoNextestHook: init
This commit is contained in:
parent
11e329ae8c
commit
0643540f97
54
pkgs/build-support/rust/hooks/cargo-nextest-hook.sh
Normal file
54
pkgs/build-support/rust/hooks/cargo-nextest-hook.sh
Normal file
|
@ -0,0 +1,54 @@
|
|||
declare -a checkFlags
|
||||
declare -a cargoTestFlags
|
||||
|
||||
cargoNextestHook() {
|
||||
echo "Executing cargoNextestHook"
|
||||
|
||||
runHook preCheck
|
||||
|
||||
if [[ -n "${buildAndTestSubdir-}" ]]; then
|
||||
pushd "${buildAndTestSubdir}"
|
||||
fi
|
||||
|
||||
if [[ -z ${dontUseCargoParallelTests-} ]]; then
|
||||
threads=$NIX_BUILD_CORES
|
||||
else
|
||||
threads=1
|
||||
fi
|
||||
|
||||
if [ "${cargoCheckType}" != "debug" ]; then
|
||||
cargoCheckProfileFlag="--${cargoCheckType}"
|
||||
fi
|
||||
|
||||
if [ -n "${cargoCheckNoDefaultFeatures-}" ]; then
|
||||
cargoCheckNoDefaultFeaturesFlag=--no-default-features
|
||||
fi
|
||||
|
||||
if [ -n "${cargoCheckFeatures-}" ]; then
|
||||
cargoCheckFeaturesFlag="--features=${cargoCheckFeatures// /,}"
|
||||
fi
|
||||
|
||||
argstr="${cargoCheckProfileFlag} ${cargoCheckNoDefaultFeaturesFlag} ${cargoCheckFeaturesFlag}
|
||||
--target @rustTargetPlatformSpec@ --frozen ${cargoTestFlags}"
|
||||
|
||||
(
|
||||
set -x
|
||||
cargo nextest run \
|
||||
-j ${threads} \
|
||||
${argstr} -- \
|
||||
${checkFlags} \
|
||||
${checkFlagsArray+"${checkFlagsArray[@]}"}
|
||||
)
|
||||
|
||||
if [[ -n "${buildAndTestSubdir-}" ]]; then
|
||||
popd
|
||||
fi
|
||||
|
||||
echo "Finished cargoNextestHook"
|
||||
|
||||
runHook postCheck
|
||||
}
|
||||
|
||||
if [ -z "${dontCargoCheck-}" ] && [ -z "${checkPhase-}" ]; then
|
||||
checkPhase=cargoNextestHook
|
||||
fi
|
|
@ -1,6 +1,7 @@
|
|||
{ buildPackages
|
||||
, callPackage
|
||||
, cargo
|
||||
, cargo-nextest
|
||||
, clang
|
||||
, lib
|
||||
, makeSetupHook
|
||||
|
@ -55,6 +56,15 @@ in {
|
|||
};
|
||||
} ./cargo-install-hook.sh) {};
|
||||
|
||||
cargoNextestHook = callPackage ({ }:
|
||||
makeSetupHook {
|
||||
name = "cargo-nextest-hook.sh";
|
||||
deps = [ cargo cargo-nextest ];
|
||||
substitutions = {
|
||||
inherit rustTargetPlatformSpec;
|
||||
};
|
||||
} ./cargo-nextest-hook.sh) {};
|
||||
|
||||
cargoSetupHook = callPackage ({ }:
|
||||
makeSetupHook {
|
||||
name = "cargo-setup-hook.sh";
|
||||
|
|
Loading…
Reference in a new issue