From 809c4efececcf5cb919eb71c3a8d723175a8cff2 Mon Sep 17 00:00:00 2001 From: Jan De Landtsheer Date: Fri, 15 Aug 2025 23:27:26 +0200 Subject: [PATCH] Add comprehensive git environment variables for build scripts --- scripts/compile-components.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/compile-components.sh b/scripts/compile-components.sh index b0b9010..80c218f 100755 --- a/scripts/compile-components.sh +++ b/scripts/compile-components.sh @@ -57,7 +57,12 @@ build_rust_component() { . ~/.cargo/env # Set git version for components that use git_version macro - export GIT_DESCRIBE=$(cd "$COMPONENTS_DIR/$component_name" && git describe --tags --always --dirty=-modified 2>/dev/null || echo "unknown") + # Many git_version crates check these environment variables first + export VERGEN_GIT_DESCRIBE=$(cd "$COMPONENTS_DIR/$component_name" && git describe --tags --always --dirty=-modified 2>/dev/null || echo "unknown") + export GIT_VERSION=$(cd "$COMPONENTS_DIR/$component_name" && git describe --tags --always --dirty=-modified 2>/dev/null || echo "unknown") + export VERGEN_GIT_BRANCH=$(cd "$COMPONENTS_DIR/$component_name" && git branch --show-current 2>/dev/null || echo "main") + export VERGEN_GIT_COMMIT_TIMESTAMP=$(cd "$COMPONENTS_DIR/$component_name" && git log -1 --format=%ct 2>/dev/null || echo "0") + export VERGEN_GIT_SHA=$(cd "$COMPONENTS_DIR/$component_name" && git rev-parse HEAD 2>/dev/null || echo "unknown") # Build with musl target for static linking cargo build --release --target x86_64-unknown-linux-musl