Use active rustup toolchain in Apple build
Some checks failed
Build Rust / Cargo Test (push) Waiting to run
Build Site / Next.js Build (push) Waiting to run
Build Apple / Build App (iOS Simulator) (push) Failing after 57s
Build Apple / Build App (macOS) (push) Failing after 1m55s

This commit is contained in:
Conrad Kramer 2026-03-19 03:27:14 -07:00
parent f7193728df
commit 9fcaf137ac

View file

@ -62,10 +62,19 @@ else
CARGO_TARGET_SUBDIR="release"
fi
RUSTUP_TOOLCHAIN=""
if [[ -x "$(command -v rustup)" ]]; then
CARGO_PATH="$(dirname $(rustup which cargo)):/usr/bin"
RUSTUP_TOOLCHAIN="$(rustup show active-toolchain | awk '{print $1}')"
if [[ -z "${RUSTUP_TOOLCHAIN}" ]]; then
echo 'error: Unable to determine active rustup toolchain'
exit 1
fi
CARGO_BIN="$(rustup which --toolchain "${RUSTUP_TOOLCHAIN}" cargo)"
RUSTC_BIN="$(rustup which --toolchain "${RUSTUP_TOOLCHAIN}" rustc)"
CARGO_PATH="$(dirname "${CARGO_BIN}"):$(dirname "${RUSTC_BIN}"):/usr/bin"
else
CARGO_PATH="$(dirname $(readlink -f $(which cargo))):/usr/bin"
CARGO_BIN="$(command -v cargo)"
CARGO_PATH="$(dirname "${CARGO_BIN}"):/usr/bin"
fi
PROTOC=$(readlink -f $(which protoc))
@ -82,7 +91,7 @@ fi
if [[ -x "$(command -v rustup)" ]]; then
for TARGET in "${RUST_TARGETS[@]}"; do
if ! rustup target list --installed | grep -qx "${TARGET}"; then
rustup target add "${TARGET}"
rustup target add --toolchain "${RUSTUP_TOOLCHAIN}" "${TARGET}"
fi
done
fi
@ -102,13 +111,16 @@ BUILD_ENV=(
"CARGO_TARGET_DIR=${EFFECTIVE_CARGO_TARGET_DIR}"
"${EXTRA_ENV[@]}"
)
if [[ -n "${RUSTUP_TOOLCHAIN}" ]]; then
BUILD_ENV+=("RUSTUP_TOOLCHAIN=${RUSTUP_TOOLCHAIN}")
fi
if [[ -n "${IPHONEOS_DEPLOYMENT_TARGET:-}" ]]; then
BUILD_ENV+=("IPHONEOS_DEPLOYMENT_TARGET=${IPHONEOS_DEPLOYMENT_TARGET}")
fi
if [[ -n "${MACOSX_DEPLOYMENT_TARGET:-}" ]]; then
BUILD_ENV+=("MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET}")
fi
env -i "${BUILD_ENV[@]}" cargo build "${CARGO_ARGS[@]}"
env -i "${BUILD_ENV[@]}" "${CARGO_BIN}" build "${CARGO_ARGS[@]}"
mkdir -p "${BUILT_PRODUCTS_DIR}"