| 1 | #!/bin/bash |
| 2 | |
| 3 | |
| 4 | set -euo pipefail |
| 5 | cd "$(dirname "$0")/../.." |
| 6 | work=$(mktemp -d) |
| 7 | trap 'rm -rf "$work"' EXIT |
| 8 | mod=github.com/Code-Hex/vz/v3 |
| 9 | version=$(go list -m -f '{{.Version}}' "$mod") |
| 10 | [[ $version == v3.7.1 ]] || { echo "Review the login view against VZ binding $version" >&2; exit 1; } |
| 11 | go mod download "$mod" |
| 12 | dir=$(go list -m -f '{{.Dir}}' "$mod") |
| 13 | [[ -n "$dir" && -d "$dir" ]] || { echo 'VZ binding source is unavailable after download.' >&2; exit 1; } |
| 14 | cp -R "$dir" "$work/vz" |
| 15 | chmod -R u+w "$work/vz" |
| 16 | cat > "$work/vz/cage_view_object_darwin.go" <<'GO' |
| 17 | //go:build darwin && cgo |
| 18 | |
| 19 | package vz |
| 20 | |
| 21 | import ( |
| 22 | "unsafe" |
| 23 | "github.com/Code-Hex/vz/v3/internal/objc" |
| 24 | ) |
| 25 | |
| 26 | // CageViewObject borrows the VZVirtualMachine for the duration of RunGUI. |
| 27 | func (v *VirtualMachine) CageViewObject() unsafe.Pointer { return objc.Ptr(v) } |
| 28 | GO |
| 29 | cp go.mod "$work/trial.mod" |
| 30 | cp go.sum "$work/trial.sum" |
| 31 | go mod edit -modfile "$work/trial.mod" -replace "$mod=$work/vz" |
| 32 | GOFLAGS="${GOFLAGS:-} -modfile=$work/trial.mod" make cage VERSION="$1" |