Rely on cxx to enforce matching versions (#3713)

This commit is contained in:
David Tolnay 2024-12-01 14:12:05 -08:00 committed by GitHub
parent c2cb7f36a7
commit dfc36aefcf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 21 additions and 65 deletions

View file

@ -9,51 +9,11 @@ trap 'rm -rf -- "${META}"' EXIT
cargo metadata --locked --format-version 1 > "${META}"
get_version() {
local package="${1}"
jq -r '.packages[] | select(.name == "'"${package}"'") | .version' "${META}"
}
get_msrv() {
local package="${1}"
jq -r '.packages[] | select(.name == "'"${package}"'") | .rust_version' "${META}"
}
# check that the cxx packages all have the same version
check_cxx_versions() {
local cxx_version=$(get_version "cxx")
local cxx_build_version=$(get_version "cxx-build")
local cxxbridge_cmd_version=$(get_version "cxx-build")
local cxxbridge_flags_version=$(get_version "cxxbridge-flags")
local cxxbridge_macro_version=$(get_version "cxxbridge-macro")
ok=true
echo "Found cxx version ${cxx_version}"
if [ "${cxx_version}" != "${cxx_build_version}" ]; then
echo "Found differing cxx-build version ${cxx_build_version}"
ok = false
fi
if [ "${cxx_version}" != "${cxxbridge_cmd_version}" ]; then
echo "Found differing cxxbridge-cmd version ${cxxbridge_cmd_version}"
ok = false
fi
if [ "${cxx_version}" != "${cxxbridge_flags_version}" ]; then
echo "Found differing cxxbridge-flags version ${cxxbridge_flags_version}"
ok = false
fi
if [ "${cxx_version}" != "${cxxbridge_macro_version}" ]; then
echo "Found differing cxxbridge-macro version ${cxxbridge_macro_version}"
ok = false
fi
if ! $ok; then
echo "All cxx packages must be at the same version. Fix this in src/taskchampion-cpp/Cargo.toml."
exit 1
else
echo "✓ All cxx packages are at the same version."
fi
}
check_msrv() {
local taskchampion_msrv=$(get_msrv taskchampion)
local taskchampion_lib_msrv=$(get_msrv taskchampion-lib)
@ -69,5 +29,4 @@ check_msrv() {
fi
}
check_cxx_versions
check_msrv