f99010fae1
CI / lint (push) Failing after 1s
CI / frontend (push) Failing after 1s
CI / scripts (push) Failing after 1s
CI / Go Test (ubuntu-latest) (push) Failing after 0s
CI / frontend-node-25 (push) Failing after 1s
CI / docs (push) Failing after 0s
CI / coverage (push) Failing after 0s
CI / e2e (push) Failing after 0s
Docker / build-and-push (push) Failing after 1s
CI / integration (push) Failing after 4m43s
CI / Go Test (windows-latest) (push) Has been cancelled
CI / Desktop Unit Tests (Windows) (push) Has been cancelled
Desktop Artifacts / Desktop Build (Linux (arm64)) (push) Has been cancelled
Desktop Artifacts / Desktop Build (Linux) (push) Has been cancelled
Desktop Artifacts / Desktop Build (Windows) (push) Has been cancelled
Desktop Artifacts (macOS) / Desktop Build (macOS (aarch64)) (push) Has been cancelled
Desktop Artifacts (macOS) / Desktop Build (macOS (x86_64)) (push) Has been cancelled
75 lines
1.9 KiB
Bash
Executable File
75 lines
1.9 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# Wrapper that restores tauri.conf.json after `tauri` exits,
|
|
# undoing the version patch applied by prepare-sidecar.sh.
|
|
# Uses the .orig backup instead of git checkout to preserve
|
|
# any pre-existing uncommitted edits.
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
CONF="$SCRIPT_DIR/../src-tauri/tauri.conf.json"
|
|
|
|
detect_host_triple() {
|
|
if ! command -v rustc >/dev/null 2>&1; then
|
|
echo "error: rustc is required to determine the Tauri target triple" >&2
|
|
return 1
|
|
fi
|
|
local host
|
|
host="$(rustc -vV | awk '/^host: /{print $2}')"
|
|
if [ -z "$host" ]; then
|
|
echo "error: could not determine host target triple" >&2
|
|
return 1
|
|
fi
|
|
echo "$host"
|
|
}
|
|
|
|
resolve_build_target_arg() {
|
|
if [ -n "${TAURI_ENV_TARGET_TRIPLE:-}" ]; then
|
|
echo "$TAURI_ENV_TARGET_TRIPLE"
|
|
return 0
|
|
fi
|
|
if [ -n "${CARGO_BUILD_TARGET:-}" ]; then
|
|
echo "$CARGO_BUILD_TARGET"
|
|
return 0
|
|
fi
|
|
|
|
# Tauri currently defaults to x64 on native Windows ARM64 shells in some
|
|
# Node/npm environments, while prepare-sidecar builds the ARM64 sidecar from
|
|
# rustc's host triple. Pin only that host so the app and sidecar match,
|
|
# leaving other native builds on Tauri's default target/release layout.
|
|
local host
|
|
host="$(detect_host_triple)"
|
|
if [ "$host" = "aarch64-pc-windows-msvc" ]; then
|
|
echo "$host"
|
|
fi
|
|
}
|
|
|
|
has_explicit_target() {
|
|
local arg
|
|
for arg in "$@"; do
|
|
case "$arg" in
|
|
--target | --target=*) return 0 ;;
|
|
esac
|
|
done
|
|
return 1
|
|
}
|
|
|
|
cleanup() {
|
|
if [ -f "$CONF.orig" ]; then
|
|
mv "$CONF.orig" "$CONF"
|
|
fi
|
|
}
|
|
trap cleanup EXIT INT TERM
|
|
|
|
args=("$@")
|
|
if [ "${args[0]:-}" = "build" ] && ! has_explicit_target "$@"; then
|
|
target_triple="$(resolve_build_target_arg)"
|
|
if [ -n "$target_triple" ]; then
|
|
export TAURI_ENV_TARGET_TRIPLE="$target_triple"
|
|
args=("build" "--target" "$target_triple" "${args[@]:1}")
|
|
echo "Building Tauri target: $target_triple"
|
|
fi
|
|
fi
|
|
|
|
tauri "${args[@]}"
|