OpenHantek
OH_VERSION.h
Go to the documentation of this file.
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 
3 // define OH_VERSION as the version that is shown on top of the program
4 // if defined in this file it will tag the commit automatically
5 // via .git/hooks/post-commit (see below)
6 // the hook will then renamed from OH_VERSION to LAST_OH_VERSION
7 //
8 // if OH_VERSION is undefined VERSION ($COMMIT_DATE-$COMMIT_HASH) will be shown by OpenHantek
9 
10 // next line shall define either OH_VERSION or LAST_OH_VERSION
11 //
12 #define OH_VERSION "3.3.2"
13 
14 
15 // do not edit below
16 
17 /* content of ".git/hooks/post-commit":
18 
19 #!/bin/bash
20 
21 # this file is called automatically after a commit
22 # it tags the commit if a version is defined in the version file
23 # inspired by: https://coderwall.com/p/mk18zq/automatic-git-version-tagging-for-npm-modules
24 
25 # this file was updated during development (by script build/MK_NEW_VER)
26 #
27 OPENHANTEK="$(git rev-parse --show-toplevel)"
28 OH_VERSION_H="$OPENHANTEK/openhantek/src/OH_VERSION.h"
29 
30 # check if the last commit changed the entry OH_VERSION in file ...OH_VERSION.h and extract the new version
31 #
32 OH_VERSION=$(git diff HEAD^..HEAD -- ${OH_VERSION_H} | awk '/^\+#define OH_VERSION/ { print $3 }' | tr -d '"')
33 
34 # if commit was marked as OH_VERSION then tag it accordingly and change entry to LAST_OH_VERSION
35 #
36 if [ "$OH_VERSION" != "" ]; then
37  git tag -a $OH_VERSION -m "$(git log -1 --format=%s)"
38  sed -i 's|^#define[[:blank:]]*OH_VERSION|#define LAST_OH_VERSION|g' $OH_VERSION_H
39  echo "Created a new tag: $OH_VERSION"
40 fi
41 
42 # update the build system with next build
43 touch $OPENHANTEK/CMakeLists.txt
44 
45 */