proposition of different version number management

This commit is contained in:
filux 2015-02-01 15:44:24 +01:00
parent 69e9dff754
commit 5192c3f87f
4 changed files with 116 additions and 32 deletions

View File

@ -89,6 +89,7 @@ CLANG_BIN_PATH=$( which clang 2>/dev/null )
CLANGPP_BIN_PATH=$( which clang++ 2>/dev/null )
cd ${SCRIPTDIR}
./mg-version-synch.sh >/dev/null
# Google breakpad integration (cross platform memory dumps) - OPTIONAL
# Set this to the root path of your Google breakpad subversion working copy.

View File

@ -1,45 +1,106 @@
#!/bin/bash
#!/bin/sh
# Use this script to synchronize other scripts and installers with the version
# in mg-version.sh for a Version Release
# ----------------------------------------------------------------------------
# Written by Mark Vejvoda <mark_vejvoda@hotmail.com>
# Copyright (c) 2011 Mark Vejvoda under GNU GPL v3.0+
# Copyright (c) 2011-2015 Mark Vejvoda under GNU GPL v3.0+
CURRENT_VERSION=`./mg-version.sh --version`
OLD_VERSION=`./mg-version.sh --oldversion_binary`
VERSION_INFO_FILE="$(dirname "$(readlink -f "$0")")/../../source/version.txt"
LastCompatibleSaveGameVersion="$(awk -F '=' '/^LastCompatibleSaveGameVersion =/ {print $2}' "$VERSION_INFO_FILE" | awk -F '"' '{print $2}')"
MapeditorVersion="$(awk -F '=' '/^MapeditorVersion =/ {print $2}' "$VERSION_INFO_FILE" | awk -F '"' '{print $2}')"
G3dviewerVersion="$(awk -F '=' '/^G3dviewerVersion =/ {print $2}' "$VERSION_INFO_FILE" | awk -F '"' '{print $2}')"
if [ "$(echo "$CURRENT_VERSION" | grep -v [a-zA-Z])" != "" ]; then modifymore="yes"; else modifymore="no"; fi
echo
echo '===== Updating Game ======'
# const string glestVersionString = "v3.12-dev";
echo 'Game version # before:'
grep -E '^const string glestVersionString = "[^"]*";$' ../../source/glest_game/facilities/game_util.cpp
sed -i 's/^const string glestVersionString = "[^"]*";$/const string glestVersionString = "v'$CURRENT_VERSION'";/' ../../source/glest_game/facilities/game_util.cpp
echo 'Game version # after:'
grep -E '^const string glestVersionString = "[^"]*";$' ../../source/glest_game/facilities/game_util.cpp
echo
if [ "$modifymore" = "yes" ]; then
# const string lastCompatibleSaveGameVersionString = "v3.9.0";
echo 'Compatible Save Game version # before:'
grep -E '^const string lastCompatibleSaveGameVersionString = "[^"]*";$' ../../source/glest_game/facilities/game_util.cpp
sed -i 's/^const string lastCompatibleSaveGameVersionString = "[^"]*";$/const string lastCompatibleSaveGameVersionString = "v'$LastCompatibleSaveGameVersion'";/' ../../source/glest_game/facilities/game_util.cpp
echo 'Compatible Save Game version # after:'
grep -E '^const string lastCompatibleSaveGameVersionString = "[^"]*";$' ../../source/glest_game/facilities/game_util.cpp
echo
fi
if [ "$modifymore" = "yes" ] && [ "$(git status >/dev/null 2>&1; echo "$?")" -eq "0" ]; then
# const string GIT_RawRev = "$4446.1a8673f$";
GitCommitForRelease="`git rev-list HEAD --count`.`git log -1 --format=%h`";
echo 'GitCommitForRelease # before:'
grep -E '^GitCommitForRelease = "[^"]*";$' "$VERSION_INFO_FILE"
grep -E '^const string GIT_RawRev = "\$[^"$]*\$";$' ../../source/glest_game/facilities/game_util.cpp
sed -i 's/^GitCommitForRelease = "[^"]*";$/GitCommitForRelease = "'$GitCommitForRelease'";/' "$VERSION_INFO_FILE"
sed -i 's/^const string GIT_RawRev = "$[^"]*";$/const string GIT_RawRev = "$'$GitCommitForRelease'$";/' ../../source/glest_game/facilities/game_util.cpp
echo 'GitCommitForRelease # after:'
grep -E '^GitCommitForRelease = "[^"]*";$' "$VERSION_INFO_FILE"
grep -E '^const string GIT_RawRev = "\$[^"$]*\$";$' ../../source/glest_game/facilities/game_util.cpp
fi
echo
if [ "$modifymore" = "yes" ]; then
echo '===== Updating Mapeditor ======'
# const string mapeditorVersionString = "v1.6.1";
echo 'Mapeditor version # before:'
grep -E '^const string mapeditorVersionString = "[^"]*";$' ../../source/glest_map_editor/main.cpp
sed -i 's/^const string mapeditorVersionString = "[^"]*";$/const string mapeditorVersionString = "v'$MapeditorVersion'";/' ../../source/glest_map_editor/main.cpp
echo 'Mapeditor version # after:'
grep -E '^const string mapeditorVersionString = "[^"]*";$' ../../source/glest_map_editor/main.cpp
echo
echo '===== Updating G3dviewer ======'
# const string g3dviewerVersionString= "v1.3.6";
echo 'G3dviewer version # before:'
grep -E '^const string g3dviewerVersionString= "[^"]*";$' ../../source/g3d_viewer/main.cpp
sed -i 's/^const string g3dviewerVersionString= "[^"]*";$/const string g3dviewerVersionString= "v'$G3dviewerVersion'";/' ../../source/g3d_viewer/main.cpp
echo 'G3dviewer version # after:'
grep -E '^const string g3dviewerVersionString= "[^"]*";$' ../../source/g3d_viewer/main.cpp
fi
echo
echo '===== Updating Linux Installer ======'
# local GAME_VERSION = "x.x.x";
echo 'Linux Installer version # before:'
grep -E '^local GAME_VERSION = "[^"]*";$' mojosetup/megaglest-installer/scripts/config.lua;sed -i 's/^local GAME_VERSION = "[^"]*";$/local GAME_VERSION = "'$CURRENT_VERSION'";/' mojosetup/megaglest-installer/scripts/config.lua
grep -E '^local GAME_VERSION = "[^"]*";$' mojosetup/megaglest-installer/scripts/config.lua
sed -i 's/^local GAME_VERSION = "[^"]*";$/local GAME_VERSION = "'$CURRENT_VERSION'";/' mojosetup/megaglest-installer/scripts/config.lua
echo 'Linux Installer version # after:'
grep -E '^local GAME_VERSION = "[^"]*";$' mojosetup/megaglest-installer/scripts/config.lua
echo
echo '===== Updating Windows Installer ======'
# !define APVER 3.6.0
echo 'Windows Installer version # before:'
grep -E '^\!define APVER [^"]*$' ../windoze/Installer/MegaGlestInstaller.nsi;sed -i 's/^\!define APVER [^"]*$/\!define APVER '$CURRENT_VERSION'/' ../windoze/Installer/MegaGlestInstaller.nsi
grep -E '^\!define APVER [^"]*$' ../windoze/Installer/MegaGlestInstaller.nsi
sed -i 's/^\!define APVER [^"]*$/\!define APVER '$CURRENT_VERSION'/' ../windoze/Installer/MegaGlestInstaller.nsi
echo 'Windows Installer version # after:'
grep -E '^\!define APVER [^"]*$' ../windoze/Installer/MegaGlestInstaller.nsi
echo 'Windows Installer version # before:'
grep -E '^\!define APVER_OLD [^"]*$' ../windoze/Installer/MegaGlestInstaller.nsi;sed -i 's/^\!define APVER_OLD [^"]*$/\!define APVER_OLD '$OLD_VERSION'/' ../windoze/Installer/MegaGlestInstaller.nsi
echo 'Windows Installer version # after:'
grep -E '^\!define APVER_OLD [^"]*$' ../windoze/Installer/MegaGlestInstaller.nsi
echo '===== Updating Windows Updater ======'
echo 'Windows Updater version # before:'
grep -E '^\!define APVER [^"]*$' ../windoze/Installer/MegaGlestUpdater.nsi;sed -i 's/^\!define APVER [^"]*$/\!define APVER '$CURRENT_VERSION'/' ../windoze/Installer/MegaGlestUpdater.nsi
echo 'Windows Updater version # after:'
grep -E '^\!define APVER [^"]*$' ../windoze/Installer/MegaGlestUpdater.nsi
echo 'Windows Updater version # before:'
grep -E '^\!define APVER_OLD [^"]*$' ../windoze/Installer/MegaGlestUpdater.nsi;sed -i 's/^\!define APVER_OLD [^"]*$/\!define APVER_OLD '$OLD_VERSION'/' ../windoze/Installer/MegaGlestUpdater.nsi
echo 'Windows Updater version # after:'
grep -E '^\!define APVER_OLD [^"]*$' ../windoze/Installer/MegaGlestUpdater.nsi
grep -E '^\!define APVER_UPDATE [^"]*$' ../windoze/Installer/MegaGlestUpdater.nsi;sed -i 's/^\!define APVER_UPDATE [^"]*$/\!define APVER_UPDATE '$CURRENT_VERSION'/' ../windoze/Installer/MegaGlestUpdater.nsi
echo 'Windows Updater version # after:'
grep -E '^\!define APVER_UPDATE [^"]*$' ../windoze/Installer/MegaGlestUpdater.nsi
echo
if [ "$modifymore" = "yes" ]; then
echo 'Windows Installer version # before:'
grep -E '^\!define APVER_OLD [^"]*$' ../windoze/Installer/MegaGlestInstaller.nsi
sed -i 's/^\!define APVER_OLD [^"]*$/\!define APVER_OLD '$OLD_VERSION'/' ../windoze/Installer/MegaGlestInstaller.nsi
echo 'Windows Installer version # after:'
grep -E '^\!define APVER_OLD [^"]*$' ../windoze/Installer/MegaGlestInstaller.nsi
echo
echo '===== Updating Windows Updater ======'
echo 'Windows Updater version # before:'
grep -E '^\!define APVER [^"]*$' ../windoze/Installer/MegaGlestUpdater.nsi
sed -i 's/^\!define APVER [^"]*$/\!define APVER '$CURRENT_VERSION'/' ../windoze/Installer/MegaGlestUpdater.nsi
echo 'Windows Updater version # after:'
grep -E '^\!define APVER [^"]*$' ../windoze/Installer/MegaGlestUpdater.nsi
echo
echo 'Windows Updater version # before:'
grep -E '^\!define APVER_OLD [^"]*$' ../windoze/Installer/MegaGlestUpdater.nsi
sed -i 's/^\!define APVER_OLD [^"]*$/\!define APVER_OLD '$OLD_VERSION'/' ../windoze/Installer/MegaGlestUpdater.nsi
echo 'Windows Updater version # after:'
grep -E '^\!define APVER_OLD [^"]*$' ../windoze/Installer/MegaGlestUpdater.nsi
echo
echo 'Windows Updater version # before:'
grep -E '^\!define APVER_UPDATE [^"]*$' ../windoze/Installer/MegaGlestUpdater.nsi
sed -i 's/^\!define APVER_UPDATE [^"]*$/\!define APVER_UPDATE '$CURRENT_VERSION'/' ../windoze/Installer/MegaGlestUpdater.nsi
echo 'Windows Updater version # after:'
grep -E '^\!define APVER_UPDATE [^"]*$' ../windoze/Installer/MegaGlestUpdater.nsi
echo
fi

View File

@ -1,12 +1,13 @@
#!/bin/bash
#!/bin/sh
# Use this script to idenitfy previous and current Version for a Version Release
# ----------------------------------------------------------------------------
# Written by Mark Vejvoda <mark_vejvoda@hotmail.com>
# Copyright (c) 2011 Mark Vejvoda under GNU GPL v3.0+
OLD_MG_VERSION=3.11.0
OLD_MG_VERSION_BINARY=3.11.0
MG_VERSION=3.12-dev
VERSION_INFO_FILE="$(dirname "$(readlink -f "$0")")/../../source/version.txt"
OLD_MG_VERSION="$(awk -F '=' '/^OldReleaseGameDataVersion =/ {print $2}' "$VERSION_INFO_FILE" | awk -F '"' '{print $2}')"
OLD_MG_VERSION_BINARY="$(awk -F '=' '/^OldReleaseGameBinaryVersion =/ {print $2}' "$VERSION_INFO_FILE" | awk -F '"' '{print $2}')"
MG_VERSION="$(awk -F '=' '/^CurrentGameVersion =/ {print $2}' "$VERSION_INFO_FILE" | awk -F '"' '{print $2}')"
if [ "$1" = "--oldversion" ]; then
echo "$OLD_MG_VERSION"

21
source/version.txt Normal file
View File

@ -0,0 +1,21 @@
# How it currently works?
# Set version here (only here) and just start build on linux. Versions will be
# updated everywhere automatically, but if CurrentGameVersion is a "dev" then
# only game version will be automatically updated (saving time during rebuild
# and for cleaner "git status").
#
# Then you should on the occasion commit changed files (this step should/will
# disappear someday, during later improvements).
CurrentGameVersion = "3.12-dev";
# ^ typical version numbers look like this: "3.11-beta1.0", "3.12-dev", "3.12.0"
OldReleaseGameBinaryVersion = "3.11.0";
OldReleaseGameDataVersion = "3.11.0";
LastCompatibleSaveGameVersion = "3.9.0";
MapeditorVersion = "1.6.1";
G3dviewerVersion = "1.3.6";
GitCommitForRelease = "4446.1a8673f";
# ^ will be automatically generated