mirror of
https://github.com/lahfir/agent-desktop.git
synced 2026-08-07 14:40:05 +00:00
todo 001: add explicit `cargo test -p agent-desktop-ffi --tests` step so the c_abi_harness and error_lifetime integration tests run on every PR. `cargo test --lib --workspace` skipped them, which meant ABI regressions could land without the harness catching them. todo 006: replace `find target -path '*/agent_desktop.h' | head -1` with a deterministic lookup. build.rs now stamps the absolute path of the just-generated header at target/ffi-header-path.txt, and both CI and scripts/update-ffi-header.sh read that file. Under a warm target/ cache with multiple agent-desktop-ffi-<hash>/ dirs, `find | head -1` picked arbitrarily and could compare a stale header — the stamp always points to the header from the current build.
30 lines
946 B
Bash
Executable file
30 lines
946 B
Bash
Executable file
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# Regenerate the committed FFI header from source.
|
|
#
|
|
# Run this after changing any `#[no_mangle] pub extern "C"` signatures in
|
|
# crates/ffi/src/ and commit the result. build.rs stamps the absolute path
|
|
# to the generated header at target/ffi-header-path.txt so we never have to
|
|
# guess which of several cached `agent-desktop-ffi-<hash>/` build dirs is
|
|
# current — `find target | head -1` would pick arbitrarily.
|
|
|
|
ROOT=$(git rev-parse --show-toplevel)
|
|
cd "$ROOT"
|
|
|
|
cargo build -p agent-desktop-ffi >/dev/null 2>&1
|
|
|
|
STAMP=target/ffi-header-path.txt
|
|
if [ ! -f "$STAMP" ]; then
|
|
echo "ERROR: $STAMP was not produced by build.rs. Check the build output." >&2
|
|
exit 1
|
|
fi
|
|
|
|
GENERATED=$(cat "$STAMP")
|
|
if [ ! -f "$GENERATED" ]; then
|
|
echo "ERROR: stamped header path does not exist: $GENERATED" >&2
|
|
exit 1
|
|
fi
|
|
|
|
cp "$GENERATED" crates/ffi/include/agent_desktop.h
|
|
echo "Updated crates/ffi/include/agent_desktop.h"
|