pytrainer: unpin python 3.10
[NixPkgs.git] / pkgs / build-support / rust / hooks / cargo-check-hook.sh
blob965e2b45144715f9389be171ab2b469a0905244d
1 # shellcheck shell=bash disable=SC2154,SC2164
3 cargoCheckHook() {
4 echo "Executing cargoCheckHook"
6 runHook preCheck
8 if [[ -n "${buildAndTestSubdir-}" ]]; then
9 pushd "${buildAndTestSubdir}"
12 local flagsArray=("-j" "$NIX_BUILD_CORES")
14 if [[ -z ${dontUseCargoParallelTests-} ]]; then
15 prependToVar checkFlags "--test-threads=$NIX_BUILD_CORES"
16 else
17 prependToVar checkFlags "--test-threads=1"
20 if [ "${cargoCheckType}" != "debug" ]; then
21 flagsArray+=("--profile" "${cargoCheckType}")
24 if [ -n "${cargoCheckNoDefaultFeatures-}" ]; then
25 flagsArray+=("--no-default-features")
28 if [ -n "${cargoCheckFeatures-}" ]; then
29 flagsArray+=("--features=$(concatStringsSep "," cargoCheckFeatures)")
32 flagsArray+=(
33 "--target" "@rustHostPlatformSpec@"
34 "--offline"
37 prependToVar checkFlags "--"
38 concatTo flagsArray cargoTestFlags checkFlags checkFlagsArray
40 echoCmd 'cargoCheckHook flags' "${flagsArray[@]}"
41 @setEnv@ cargo test "${flagsArray[@]}"
43 if [[ -n "${buildAndTestSubdir-}" ]]; then
44 popd
47 echo "Finished cargoCheckHook"
49 runHook postCheck
52 if [ -z "${dontCargoCheck-}" ] && [ -z "${checkPhase-}" ]; then
53 checkPhase=cargoCheckHook