From 042adf08d1c1886dfbe11603b012f987c60b1148 Mon Sep 17 00:00:00 2001 From: Jonathan Ringer Date: Sun, 28 Feb 2021 17:18:12 -0800 Subject: [PATCH] cargo/hooks: allow hooks to be disabled --- pkgs/build-support/rust/hooks/cargo-build-hook.sh | 4 +++- pkgs/build-support/rust/hooks/cargo-check-hook.sh | 2 +- pkgs/build-support/rust/hooks/cargo-install-hook.sh | 2 +- pkgs/build-support/rust/hooks/cargo-setup-hook.sh | 4 +++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pkgs/build-support/rust/hooks/cargo-build-hook.sh b/pkgs/build-support/rust/hooks/cargo-build-hook.sh index 6760277c2941..c10120c5aa19 100644 --- a/pkgs/build-support/rust/hooks/cargo-build-hook.sh +++ b/pkgs/build-support/rust/hooks/cargo-build-hook.sh @@ -36,4 +36,6 @@ cargoBuildHook() { echo "Finished cargoBuildHook" } -buildPhase=cargoBuildHook +if [ -z "${dontCargoBuild-}" ] && [ -z "${buildPhase-}" ]; then + buildPhase=cargoBuildHook +fi diff --git a/pkgs/build-support/rust/hooks/cargo-check-hook.sh b/pkgs/build-support/rust/hooks/cargo-check-hook.sh index e4c906f873c4..f0339afb38fa 100644 --- a/pkgs/build-support/rust/hooks/cargo-check-hook.sh +++ b/pkgs/build-support/rust/hooks/cargo-check-hook.sh @@ -41,6 +41,6 @@ cargoCheckHook() { runHook postCheck } -if [ -z "${checkPhase-}" ]; then +if [ -z "${dontCargoCheck-}" ] && [ -z "${checkPhase-}" ]; then checkPhase=cargoCheckHook fi diff --git a/pkgs/build-support/rust/hooks/cargo-install-hook.sh b/pkgs/build-support/rust/hooks/cargo-install-hook.sh index e6ffa3007063..69ce72669366 100644 --- a/pkgs/build-support/rust/hooks/cargo-install-hook.sh +++ b/pkgs/build-support/rust/hooks/cargo-install-hook.sh @@ -43,7 +43,7 @@ cargoInstallHook() { } -if [ -z "${installPhase-}" ]; then +if [ -z "${dontCargoInstall-}" ] && [ -z "${installPhase-}" ]; then installPhase=cargoInstallHook postBuildHooks+=(cargoInstallPostBuildHook) fi diff --git a/pkgs/build-support/rust/hooks/cargo-setup-hook.sh b/pkgs/build-support/rust/hooks/cargo-setup-hook.sh index 0fddd30582a1..842e66b5170e 100644 --- a/pkgs/build-support/rust/hooks/cargo-setup-hook.sh +++ b/pkgs/build-support/rust/hooks/cargo-setup-hook.sh @@ -77,7 +77,9 @@ cargoSetupPostPatchHook() { echo "Finished cargoSetupPostPatchHook" } -postUnpackHooks+=(cargoSetupPostUnpackHook) +if [ -z "${dontCargoSetupPostUnpack-}" ]; then + postUnpackHooks+=(cargoSetupPostUnpackHook) +fi if [ -z ${cargoVendorDir-} ]; then postPatchHooks+=(cargoSetupPostPatchHook)