Files
VictronBLE/check_version.sh
T
scottp 318e221170 v0.7.1: rename C core header to victronble_core.h (fixes #2)
src/ held both VictronBLE.h and victronble.h. On case-insensitive
filesystems (Windows, macOS) extracting the library ZIP overwrote one
with the other and the Arduino build failed.

The core header is now victronble_core.h in include/ and src/, and every
include is updated. include/victronble.h stays as a deprecated forwarder
so 0.7.0 Zephyr and host code still builds; it is never in src/.

check_version.sh now fails if two tracked paths differ only in case.
2026-10-09 12:54:06 +11:00

44 lines
1.4 KiB
Bash
Executable File

#!/usr/bin/env bash
#
# check_version.sh -- verify the library version is consistent and released.
#
# Read-only: confirms the version matches in both manifests and that a matching
# git tag (vX.Y.Z) exists. Run it before tagging a release. Non-zero exit if the
# versions disagree, the tag is missing, or two tracked paths differ only in
# case (they collide when the ZIP is extracted on Windows or macOS).
#
# SPDX-License-Identifier: MIT
set -u
cd "$(dirname "$0")" || exit 2
json=$(sed -nE 's/.*"version"[[:space:]]*:[[:space:]]*"([^"]+)".*/\1/p' library.json | head -1)
prop=$(sed -nE 's/^version=([^[:space:]]+).*/\1/p' library.properties | tr -d '\r' | head -1)
echo "library.json : ${json:-<none>}"
echo "library.properties : ${prop:-<none>}"
fail=0
if [ -n "$json" ] && [ "$json" = "$prop" ]; then
echo "ok versions match ($json)"
else
echo "FAIL versions differ (json=$json properties=$prop)"; fail=1
fi
if git rev-parse -q --verify "refs/tags/v$json" >/dev/null 2>&1; then
echo "ok git tag v$json exists"
else
echo "FAIL no git tag v$json -- create one to release: git tag v$json"; fail=1
fi
clash=$(git ls-files | tr '[:upper:]' '[:lower:]' | sort | uniq -d)
if [ -z "$clash" ]; then
echo "ok no paths differ only in case"
else
echo "FAIL paths differ only in case (breaks Windows/macOS extract):"
echo "$clash" | sed 's/^/ /'; fail=1
fi
exit "$fail"