Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 5 additions & 15 deletions pkgs/by-name/ca/cargo-tauri/hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,6 @@ tauriBuildHook() {
# separateDebugInfo.
export "CARGO_PROFILE_${cargoBuildType@U}_STRIP"=false

if [ -n "${buildAndTestSubdir-}" ]; then
# ensure the output doesn't end up in the subdirectory
CARGO_TARGET_DIR="$(pwd)/target"
export CARGO_TARGET_DIR

# Tauri doesn't respect $CARGO_TARGET_DIR, but does respect the cargo
# argument...but that doesn't respect `--target`, so we have to use the
# config file
# https://github.com/tauri-apps/tauri/issues/10190
mkdir -p .cargo
printf '\nbuild.target-dir = "%s"' "$CARGO_TARGET_DIR" >>config.toml

pushd "${buildAndTestSubdir}"
fi

local cargoFlagsArray=(
"-j" "$NIX_BUILD_CORES"
"--target" "@rustHostPlatformSpec@"
Expand All @@ -44,6 +29,11 @@ tauriBuildHook() {
"--target" "@rustHostPlatformSpec@"
)

# https://github.com/tauri-apps/tauri/issues/10190 if fixed so we can default to `--target-dir`
if [ -n "${buildAndTestSubdir-}" ]; then
cargoFlagsArray+=("--target-dir" "$(pwd)/target")
fi

if [ "${cargoBuildType}" != "debug" ]; then
cargoFlagsArray+=("--profile" "${cargoBuildType}")
fi
Expand Down