mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-16 14:54:29 +01:00
14d44173e4
buildRustPackage: support custom cargo profiles
54 lines
1.3 KiB
Bash
54 lines
1.3 KiB
Bash
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="--cargo-profile ${cargoCheckType}"
|
|
fi
|
|
|
|
if [ -n "${cargoCheckNoDefaultFeatures-}" ]; then
|
|
cargoCheckNoDefaultFeaturesFlag=--no-default-features
|
|
fi
|
|
|
|
if [ -n "${cargoCheckFeatures-}" ]; then
|
|
cargoCheckFeaturesFlag="--features=${cargoCheckFeatures// /,}"
|
|
fi
|
|
|
|
argstr="${cargoCheckProfileFlag} ${cargoCheckNoDefaultFeaturesFlag} ${cargoCheckFeaturesFlag}
|
|
--target @rustHostPlatformSpec@ --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
|