Files
hcie-rust-v3.05/scripts/cargo-with-build-id.sh
T
phantom b49106dc1d BIG REFACTOR GPT SOL
feat: Refactor Iced panel adapter and introduce build metadata management

- Updated Cargo.toml files across multiple crates to use workspace versioning.
- Enhanced the `iced-panel-adapter` to include a new `plain_slider` module and updated widget rendering to support theme colors.
- Added new theme color utilities for recessed and elevated surfaces in `iced-panel-adapter`.
- Introduced a new `hcie-build-info` crate to manage build metadata, including a build ID system.
- Created a build script to synchronize build IDs across the workspace.
- Added a Makefile for simplified build commands for the Iced application.
- Implemented regression tests for vector shape creation history in the engine API.
- Added a new script for managing Cargo commands with synchronized build ID increments.
- Updated line count report to reflect recent changes in codebase.
- Created a visual plan document for future improvements in the Iced history and panel systems.
2026-07-21 04:25:23 +03:00

70 lines
1.8 KiB
Bash
Executable File

#!/usr/bin/env bash
# Runs one Cargo command with one synchronized HCIE build-number increment.
set -euo pipefail
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
ROOT_DIR="$(cd -- "${SCRIPT_DIR}/.." && pwd)"
LOCK_DIR="${ROOT_DIR}/.build-id.lock"
COUNTER_FILE="${ROOT_DIR}/build.id"
cleanup() {
rm -rf -- "${LOCK_DIR}"
}
acquire_lock() {
while ! mkdir -- "${LOCK_DIR}" 2>/dev/null; do
if [[ -f "${LOCK_DIR}/pid" ]]; then
local owner
owner="$(<"${LOCK_DIR}/pid")"
if [[ "${owner}" =~ ^[0-9]+$ ]] && ! kill -0 "${owner}" 2>/dev/null; then
rm -rf -- "${LOCK_DIR}"
continue
fi
fi
sleep 0.05
done
printf '%s\n' "$$" > "${LOCK_DIR}/pid"
trap cleanup EXIT INT TERM
}
write_counter() {
local target="$1"
local value="$2"
local temporary="${target}.tmp.$$"
printf '%s\n' "${value}" > "${temporary}"
mv -f -- "${temporary}" "${target}"
}
if [[ $# -eq 0 ]]; then
echo "usage: scripts/cargo-with-build-id.sh <cargo-subcommand> [arguments...]" >&2
exit 2
fi
acquire_lock
if [[ -f "${COUNTER_FILE}" ]]; then
current="$(tr -d '[:space:]' < "${COUNTER_FILE}")"
else
current="0"
fi
if [[ ! "${current}" =~ ^[0-9]+$ ]]; then
echo "build.id must contain one unsigned integer, found: ${current}" >&2
exit 1
fi
if (( current >= 9223372036854775807 )); then
echo "build.id reached the supported integer limit" >&2
exit 1
fi
next=$((current + 1))
write_counter "${COUNTER_FILE}" "${next}"
write_counter "${ROOT_DIR}/hcie-egui-app/build.id" "${next}"
write_counter "${ROOT_DIR}/hcie-egui-app/crates/hcie-gui-egui/build.id" "${next}"
export HCIE_BUILD_ID_OVERRIDE="${next}"
echo "HCIE build ${next}: cargo $*"
cd -- "${ROOT_DIR}"
cargo "$@"