From 2109146184020383306f81c6419e65704069fdd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hern=C3=A1n=20Di=20Pietro?= Date: Sun, 16 Jul 2017 20:32:31 -0300 Subject: [PATCH] Versioning system with PS1 script --- build/verstamp.ps1 | 42 ++++++++++++++++++++++++++++ src/CartelMania.rc | Bin 21332 -> 21528 bytes src/CartelMania.vcxproj | 13 +++++++++ src/CartelMania.vcxproj.filters | 3 ++ src/Version.h | 48 ++++++++++++++++++++++++++++++++ 5 files changed, 106 insertions(+) create mode 100644 build/verstamp.ps1 create mode 100644 src/Version.h diff --git a/build/verstamp.ps1 b/build/verstamp.ps1 new file mode 100644 index 0000000..4566374 --- /dev/null +++ b/build/verstamp.ps1 @@ -0,0 +1,42 @@ +#/***************************************************************************** +# +# CartelMania +# Copyright(C) 2017 Hernán Di Pietro +# +# This program is free software : you can redistribute it and / or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program.If not, see < http://www.gnu.org/licenses/>. +# +#****************************************************************************/ + +# Version stamping script +# +# +# The script should stamp "revision" field with the number days elapsed from +# 1, January, 2017. +# +# Build number will be set to the minute of the day in which the build +# was made (0-1440). +# + +$timespan = (new-timespan -end (get-date -year 2017 -month 1 -day 1)); +$hour = Get-Date -UFormat %H; +$mins = Get-Date -UFormat %M; +$todaymins = $hour.ToInt32($Null) * 60 + $mins.Toint32($Null) + +$filetext = Get-Content -Path "..\src\version.h" -ErrorAction Stop; +$build = "#define _BUILDPLACEHOLDER " + $todaymins; +$rev = "#define _REVPLACEHOLDER " + -$timespan.Days; +$filetext = $filetext -replace "#define _BUILDPLACEHOLDER [ 0-9]*$", $build; +$filetext = $filetext -replace "#define _REVPLACEHOLDER [ 0-9]*$", $rev; + +Set-Content -Path "..\src\version.h" -Value $filetext -ErrorAction Stop; diff --git a/src/CartelMania.rc b/src/CartelMania.rc index c04908447917f8e798a703c023ea6f55b4a25f12..912d5983f3c7eaa2b22510a7be84f8cc56bd1f05 100644 GIT binary patch delta 203 zcmcbzjB&;a#t921e`6Hk4P!`UC}JpP$YjW8$lEwo&@<4P!I#02!H>ZcNX9dSF}N}W oF$4p7{y?#Ku$&i=9mJr+KuD!0PzO-u`}+3Mc>o diff --git a/src/CartelMania.vcxproj b/src/CartelMania.vcxproj index 05e2f2c..b3af259 100644 --- a/src/CartelMania.vcxproj +++ b/src/CartelMania.vcxproj @@ -148,6 +148,12 @@ true true + + powershell $(SolutionDir)\build\verstamp.ps1 + + + Version stamping + @@ -170,6 +176,12 @@ true false + + powershell $(SolutionDir)\build\verstamp.ps1 + + + Version stamping + @@ -354,6 +366,7 @@ + diff --git a/src/CartelMania.vcxproj.filters b/src/CartelMania.vcxproj.filters index bf9f9b8..acdbc54 100644 --- a/src/CartelMania.vcxproj.filters +++ b/src/CartelMania.vcxproj.filters @@ -93,6 +93,9 @@ Header Files + + Header Files + diff --git a/src/Version.h b/src/Version.h new file mode 100644 index 0000000..e03c0e9 --- /dev/null +++ b/src/Version.h @@ -0,0 +1,48 @@ +#pragma once +/***************************************************************************** + + CartelMania + Copyright(C) 2017 Hernán Di Pietro + + This program is free software : you can redistribute it and / or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program.If not, see < http://www.gnu.org/licenses/>. + +*****************************************************************************/ + +/** Version Data -- this file is processed by VerStamp.ps1 Pre-build step + on release configurations by stamping data on _REVPLACEHOLDER and + _BUILDPLACEHOLDER definitions. Do not mess this! + + Initial value should be 9999,0. + + The script should stamp "revision" field with year/month/day. Month + in hex (0-C), e.g: for 2017-11-30: 17B30. + + Build number will be set to the minute of the day in which the build + was made (0-1440). + + See verstamp.ps1 script in pre-build step for details. + +**/ + + +#define _REVPLACEHOLDER 196 +#define _BUILDPLACEHOLDER 1230 + +// --------------------------------------------------------------------------- +#define CMANIA_VERSION_MAJOR 0 +#define CMANIA_VERSION_MINOR 5 +#define CMANIA_VERSION_REV _REVPLACEHOLDER +#define CMANIA_VERSION_BUILD _BUILDPLACEHOLDER +// --------------------------------------------------------------------------- +