Page MenuHomec4science

source_informations.sh.in
No OneTemporary

File Metadata

Created
Mon, Nov 4, 19:56

source_informations.sh.in

#!/usr/bin/env bash
set -euo pipefail
GIT=@GIT_EXECUTABLE@
SOURCE_DIR=@PROJECT_SOURCE_DIR@
OUTPUT_FILE=@OUTPUT_FILE@
UUENCODE=@UUENCODE_EXECUTABLE@
set -x
GIT_VERSION=$(${GIT} describe --always --dirty)
GIT_BRANCH=$(${GIT} rev-parse --abbrev-ref --symbolic-full-name @)
GIT_REMOTE_BRANCH=$(${GIT} rev-parse --abbrev-ref --symbolic-full-name @{upstream})
GIT_REMOTE=$(git config branch.$GIT_BRANCH.remote)
GIT_REMOTE_URL=$(${GIT} config remote.$GIT_REMOTE.url)
GIT_DIFF=$(${GIT} diff @ | sed '1h;1!H;$!d;x;s/\n/\\n/g; s/'\''/\'\''/g; s/"/\\"/g')
set +x
cat <<EOF > ${OUTPUT_FILE}
#include <string>
auto @PROJECT_NAME@_GIT_VERSION = "${GIT_VERSION}";
auto @PROJECT_NAME@_GIT_BRANCH = "${GIT_BRANCH}";
auto @PROJECT_NAME@_GIT_REMOTE_BRANCH = "${GIT_REMOTE_BRANCH}";
auto @PROJECT_NAME@_GIT_REMOTE_URL = "${GIT_REMOTE_URL}";
auto @PROJECT_NAME@_GIT_DIFF = "${GIT_DIFF}";
EOF

Event Timeline