#!/usr/bin/env bash
set -e

VERSION_REVISION=$(grep "SET(VERSION_REVISION" cmake/autogenerated_versions.txt | sed 's/^.*VERSION_REVISION \(.*\)$/\1/' | sed 's/[) ].*//')
VERSION_MAJOR=$(grep "SET(VERSION_MAJOR" cmake/autogenerated_versions.txt | sed 's/^.*VERSION_MAJOR \(.*\)/\1/' | sed 's/[) ].*//')
VERSION_MINOR=$(grep "SET(VERSION_MINOR" cmake/autogenerated_versions.txt | sed 's/^.*VERSION_MINOR \(.*\)/\1/' | sed 's/[) ].*//')
VERSION_PATCH=$(grep "SET(VERSION_PATCH" cmake/autogenerated_versions.txt | sed 's/^.*VERSION_PATCH \(.*\)/\1/' | sed 's/[) ].*//')
GIT_COMMIT=$(git rev-parse --short=8 HEAD)
GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
VERSION_DESCRIBE=$(grep "SET(VERSION_DESCRIBE" cmake/autogenerated_versions.txt | sed 's/^.*VERSION_DESCRIBE \(.*\)/\1/' | sed 's/[) ].*//')
VERSION_STRING=$(grep "SET(VERSION_STRING" cmake/autogenerated_versions.txt | sed 's/^.*VERSION_STRING \(.*\)/\1/' | sed 's/[) ].*//')
MYSCALE_VERSION_STRING=$(grep "SET(MYSCALE_VERSION_STRING" cmake/autogenerated_myscale_versions.txt | sed 's/^.*MYSCALE_VERSION_STRING \(.*\)/\1/' | sed 's/[) ].*//')
