-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathtarget_crate_build.sh
More file actions
executable file
·61 lines (46 loc) · 1.33 KB
/
Copy pathtarget_crate_build.sh
File metadata and controls
executable file
·61 lines (46 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env bash
# This file builds a target crate with mir_wrapper for debugging.
set -euo pipefail
repo_root="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"
usage() {
cat <<'EOF'
Usage:
target_crate_build.sh [DIRECTORY]
Description:
Build DIRECTORY with this repository's mir_wrapper. If DIRECTORY is omitted,
build $HOME.
Examples:
./target_crate_build.sh /path/to/crate
MIR_WRAPPER_DUMP=/tmp/inv.json ./target_crate_build.sh ~/workspace
EOF
}
# Help
if [[ "${1:-}" == "-h" || "${1:-}" == "--help" ]]; then
usage
return 0 2>/dev/null || exit 0
fi
# Default directory
target="${1:-$HOME}"
# Expand ~ manually (bash won't expand it inside quotes reliably in all cases)
if [[ "$target" == "~" ]]; then
target="$HOME"
elif [[ "$target" == "~/"* ]]; then
target="$HOME/${target#~/}"
fi
# Validate
if [[ ! -d "$target" ]]; then
echo "Error: not a directory: $target" >&2
return 2 2>/dev/null || exit 2
fi
# Change directory
cd "$target"
# Optional: show where we are
pwd
# build the target crate
rustup override set nightly-2025-01-10
rm -rf target
export RUSTC_WRAPPER="${RUSTC_WRAPPER:-$repo_root/target/debug/mir_wrapper}"
export MIR_WRAPPER_DUMP="${MIR_WRAPPER_DUMP:-/var/tmp/inv.json}"
export MIR_CHECKER_ARGS="${MIR_CHECKER_ARGS:-[\"--show_all_entries\"]}"
# env | grep RUSTC
cargo +nightly-2025-01-10 build -vv