diff --git a/tools/build/version_update.py b/tools/build/version_update.py index e43a432..dc38091 100644 --- a/tools/build/version_update.py +++ b/tools/build/version_update.py @@ -45,14 +45,13 @@ def write_version_to_file(file_path, version): if not os.path.exists(PROJECT_DIR + os.sep + "include"): os.mkdir(PROJECT_DIR + os.sep + "include") VERSION_HEADER = "include" + os.sep + VERSION_HEADER - + current_version = read_version_from_file(VERSION_HEADER) -if current_version: - if current_version.startswith(current_date): - new_version = current_version - else: - new_version = current_date +if current_version is None: + new_version = current_date +elif current_version.startswith(current_date) or current_version > current_date: + new_version = current_version else: new_version = current_date diff --git a/tools/commit.sh b/tools/commit.sh index ba340a6..1c08057 100755 --- a/tools/commit.sh +++ b/tools/commit.sh @@ -51,7 +51,11 @@ while git rev-parse "$tag" >/dev/null 2>&1; do tag="${base}.${suffix}" done -echo $tag +sed -i.bak "s/#define VERSION \"${version}\"/#define VERSION \"${tag}\"/" "$VERSION_HEADER" + +rm "${VERSION_HEADER}.bak" + +echo "Updated version to $tag in $VERSION_HEADER" # Checking for commit message file if [ -f "$COMMIT_MESSAGE_FILE" ]; then