feat(hyperhdr): vendor the flatbuffers schemas and generated bindings
The .fbs files come from HyperHDR (see schema/NOTICE); the *_generated.rs files are flatc output regenerated by scripts/regen-fbs.sh, which refuses to run unless flatc matches the pinned flatbuffers crate.
This commit is contained in:
Executable
+20
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env bash
|
||||
# Regenerate Rust code from the HyperHDR flatbuffers schemas.
|
||||
# The flatc version must match the `flatbuffers` crate version in Cargo.toml.
|
||||
set -euo pipefail
|
||||
|
||||
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
out="$root/src/hyperhdr/generated"
|
||||
|
||||
crate_ver="$(grep -E '^flatbuffers\s*=' "$root/Cargo.toml" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')"
|
||||
flatc_ver="$(flatc --version | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')"
|
||||
if [[ "$crate_ver" != "$flatc_ver" ]]; then
|
||||
echo "flatc $flatc_ver does not match flatbuffers crate $crate_ver" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm -f "$out"/*_generated.rs
|
||||
mkdir -p "$out"
|
||||
flatc --rust -o "$out" "$root/schema/hyperhdr_request.fbs" "$root/schema/hyperhdr_reply.fbs"
|
||||
echo "generated with flatc $flatc_ver:"
|
||||
ls -1 "$out"
|
||||
Reference in New Issue
Block a user