Update versioning scripts.

This commit is contained in:
2023-03-26 21:29:55 +03:00
parent 0f8304ef23
commit 6b3a90d682
8 changed files with 100 additions and 40 deletions

View File

@@ -1,4 +1,5 @@
@ECHO OFF
CHCP 1251 >nul
SETLOCAL ENABLEDELAYEDEXPANSION
SET CURRENT_TIME=%TIME%
@@ -8,8 +9,8 @@ SET BUILDTIME=%CURRENT_TIME:~0,8%
SET BUILDDATE=%CURRENT_DATE%
SET BUILD_DATETIME=Build time: %BUILDDATE% %BUILDTIME%
SET CURRENT_YEAR=%CURRENT_DATE:~6,4%
SET BUILDSECS=0
SET GIT_COUNT=0
SET GIT_TIME=0
SET GIT_DATE=0
@@ -28,25 +29,28 @@ SET PYS=0
SET PA=0
CD /D %~dp0
IF NOT EXIST "VersionInfo.h" (
ECHO Can't find file 'VersionInfo.h'
IF NOT EXIST "Version.h" (
ECHO Can't find file 'Version.h'
TIMEOUT /T 3
EXIT /B 1
)
COPY /Y "VersionInfo.h" "version.h" >nul
COPY /Y "Version.h" "VersionInfo.h" >nul
FOR /F "tokens=3" %%A IN ('FINDSTR /I /L /C:"define V_MAJOR" "version.h"') DO (SET "VerMajor=%%A")
FOR /F "tokens=3" %%A IN ('FINDSTR /I /L /C:"define V_MINOR" "version.h"') DO (SET "VerMinor=%%A")
FOR /F "tokens=3" %%A IN ('FINDSTR /I /L /C:"define V_PATCH" "version.h"') DO (SET "VerPatch=%%A")
FOR /F "tokens=3" %%A IN ('FINDSTR /I /L /C:"define PRODUCT_NAME" "version.h"') DO (SET "PN=%%~A")
FOR /F "tokens=3" %%A IN ('FINDSTR /I /L /C:"define PRODUCT_YEAR_START" "version.h"') DO (SET "PYS=%%A")
FOR /F "tokens=2*" %%A IN ('FINDSTR /I /L /C:"define PRODUCT_AUTHORS" "version.h"') DO (SET "PA=%%~B")
FOR /F "tokens=3" %%A IN ('FINDSTR /I /L /C:"define V_MAJOR" "VersionInfo.h"') DO (SET "VerMajor=%%A")
FOR /F "tokens=3" %%A IN ('FINDSTR /I /L /C:"define V_MINOR" "VersionInfo.h"') DO (SET "VerMinor=%%A")
FOR /F "tokens=3" %%A IN ('FINDSTR /I /L /C:"define V_PATCH" "VersionInfo.h"') DO (SET "VerPatch=%%A")
FOR /F "tokens=3" %%A IN ('FINDSTR /I /L /C:"define PRODUCT_NAME" "VersionInfo.h"') DO (SET "PN=%%~A")
FOR /F "tokens=3" %%A IN ('FINDSTR /I /L /C:"define PRODUCT_YEAR_START" "VersionInfo.h"') DO (SET "PYS=%%A")
FOR /F "tokens=2*" %%A IN ('FINDSTR /I /L /C:"define PRODUCT_AUTHORS" "VersionInfo.h"') DO (SET "PA=%%~B")
FOR /F "tokens=1-4 delims=:., " %%A IN ("%BUILDTIME%") DO (SET /A "BUILDSECS=%%A * 3600 + %%B * 60 + %%C")
FOR /F "delims=" %%A IN ('git rev-list --count HEAD') DO (SET /A GIT_COUNT=%%A)
FOR /F "tokens=1,2 delims= " %%A IN ('git log -1 --date=format:%%d.%%m.%%Y ^| find /I "Date:"') DO (SET "GIT_DATE=%%B")
FOR /F "tokens=2-4 delims=, " %%A IN ('git log -1 --date=format:"%%a,%%d-%%h-%%Y,%%T" ^| find /I "Date:"') DO (
SET "GIT_DATETIME=Git time: %%A, %%B %%C"
SET "GIT_TIME=%%C"
IF EXIST ".git" (
FOR /F "delims=" %%A IN ('git rev-list --count HEAD') DO (SET /A GIT_COUNT=%%A)
FOR /F "tokens=1,2 delims= " %%A IN ('git log -1 --date=format:%%d.%%m.%%Y ^| find /I "Date:"') DO (SET "GIT_DATE=%%B")
FOR /F "tokens=2-4 delims=, " %%A IN ('git log -1 --date=format:"%%a,%%d-%%h-%%Y,%%T" ^| find /I "Date:"') DO (
SET "GIT_DATETIME=Git time: %%A, %%B %%C"
SET "GIT_TIME=%%C"
)
)
SET VSF=%VerMajor%.%VerMinor%.%VerPatch%.%GIT_COUNT%
@@ -60,22 +64,27 @@ SET PCF=Copyright (C) %PYS%-%CURRENT_YEAR% by %PA%
SET INT_NAME=%PN%C++
SET ORIG_NAME=%PN%.exe
ECHO #define BUILD_DATE "%BUILDDATE%">> version.h
ECHO #define BUILD_TIME "%BUILDTIME%">> version.h
ECHO #define BUILD_DATETIME "%BUILD_DATETIME%">> version.h
ECHO #define GIT_DATE "%GIT_DATE%">> version.h
ECHO #define GIT_TIME "%GIT_TIME%">> version.h
ECHO #define GIT_DATETIME "%GIT_DATETIME%">> version.h
ECHO #define GIT_COUNT %GIT_COUNT% >> version.h
ECHO #define V_SECS %BUILDSECS% >> version.h
ECHO #define INTERNAL_NAME "%INT_NAME%">> version.h
ECHO #define ORIG_FILE_NAME "%ORIG_NAME%">> version.h
ECHO #define PRODUCT_NAME_FULL "%PNF%">> version.h
ECHO #define PRODUCT_COPYRIGHT "%PCF%">> version.h
ECHO #define VERSION_NUM %VN% >> version.h
ECHO #define VERSION_STR "%VS%">> version.h
ECHO #define VERSION_NUM_FULL %VNF% >> version.h
ECHO #define VERSION_STR_FULL "%VSF%">> version.h
ECHO #define BUILD_DATE "%BUILDDATE%">> VersionInfo.h
ECHO #define BUILD_TIME "%BUILDTIME%">> VersionInfo.h
ECHO #define BUILD_DATETIME "%BUILD_DATETIME%">> VersionInfo.h
IF EXIST ".git" (
ECHO #define GIT_DATE "%GIT_DATE%">> VersionInfo.h
ECHO #define GIT_TIME "%GIT_TIME%">> VersionInfo.h
ECHO #define GIT_DATETIME "%GIT_DATETIME%">> VersionInfo.h
ECHO #define GIT_COUNT %GIT_COUNT% >> VersionInfo.h
)
ECHO #define V_SECS %BUILDSECS% >> VersionInfo.h
ECHO #define INTERNAL_NAME "%INT_NAME%">> VersionInfo.h
ECHO #define ORIG_FILE_NAME "%ORIG_NAME%">> VersionInfo.h
ECHO #define PRODUCT_NAME_FULL "%PNF%">> VersionInfo.h
ECHO #define PRODUCT_COPYRIGHT "%PCF%">> VersionInfo.h
ECHO #define VERSION_NUM %VN% >> VersionInfo.h
ECHO #define VERSION_STR "%VS%">> VersionInfo.h
ECHO #define VERSION_NUM_FULL %VNF% >> VersionInfo.h
ECHO #define VERSION_STR_FULL "%VSF%">> VersionInfo.h
ENDLOCAL
TIMEOUT /T 1 >nul
EXIT

View File

@@ -1,10 +1,16 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31112.23
# Visual Studio Version 17
VisualStudioVersion = 17.5.33516.290
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wCenterWindow", "wCenterWindow\wCenterWindow.vcxproj", "{F1A1603A-F5D0-47B8-8E4B-CF17747BCFBA}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C7B4FD1E-DC1B-46A4-842C-5130F09EFCB5}"
ProjectSection(SolutionItems) = preProject
Update_version.bat = Update_version.bat
Version.h = Version.h
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64

View File

@@ -0,0 +1,28 @@
// wCenterWindow
// version.h
//
#pragma once
#define V_MAJOR 2
#define V_MINOR 3
#define V_PATCH 5
#define PRODUCT_NAME "wCenterWindow"
#define PRODUCT_AUTHORS "W0LF aka 'dreamforce'"
#define PRODUCT_YEAR_START 2020
#define PRODUCT_DESCRIPTION "Centers windows by hotkey"
#define BUILD_DATE "26.03.2023"
#define BUILD_TIME "21:26:13"
#define BUILD_DATETIME "Build time: 26.03.2023 21:26:13"
#define GIT_DATE "16.03.2022"
#define GIT_TIME "17:42:44"
#define GIT_DATETIME "Git time: Wed, 16-Mar-2022 17:42:44"
#define GIT_COUNT 71
#define V_SECS 77173
#define INTERNAL_NAME "wCenterWindowC++"
#define ORIG_FILE_NAME "wCenterWindow.exe"
#define PRODUCT_NAME_FULL "wCenterWindow v2.3.5 (C++)"
#define PRODUCT_COPYRIGHT "Copyright (C) 2020-2023 by W0LF aka 'dreamforce'"
#define VERSION_NUM 2,3,5
#define VERSION_STR "2.3.5"
#define VERSION_NUM_FULL 2,3,5,71
#define VERSION_STR_FULL "2.3.5.71"

Binary file not shown.

View File

@@ -6,7 +6,6 @@
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
// Windows Header Files
#include <iostream>
#include <fstream>
#include <filesystem>
#include <string>
@@ -17,3 +16,4 @@
// Project Specific Header Files
#include "Logger.h"
#include "VersionInfo.h"

View File

@@ -2,6 +2,10 @@
// Microsoft Visual C++ generated include file.
// Used by wCenterWindow.rc
//
#define V_MAJOR 2
#define V_MINOR 3
#define V_PATCH 4
#define GIT_COUNT 72
#define IDS_CLASSNAME 102
#define IDS_APP_TITLE 103
#define IDD_ABOUTBOX 104
@@ -33,6 +37,8 @@
#define IDC_BUTTON_CLOSE 1007
#define IDC_ABOUTHELP 1008
#define IDC_DONATIONLINK 1009
#define PRODUCT_YEAR_START 2020
#define V_SECS 52245
#define IDC_STATIC -1
// Next default values for new objects

Binary file not shown.

View File

@@ -73,16 +73,25 @@
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<EnableMicrosoftCodeAnalysis>false</EnableMicrosoftCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<CopyCppRuntimeToOutputDir>false</CopyCppRuntimeToOutputDir>
<CopyLocalDeploymentContent>false</CopyLocalDeploymentContent>
<CopyLocalProjectReference>false</CopyLocalProjectReference>
<CopyLocalDebugSymbols>false</CopyLocalDebugSymbols>
<EnableMicrosoftCodeAnalysis>false</EnableMicrosoftCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<CopyLocalDeploymentContent>false</CopyLocalDeploymentContent>
<CopyLocalProjectReference>false</CopyLocalProjectReference>
<CopyLocalDebugSymbols>false</CopyLocalDebugSymbols>
<CopyCppRuntimeToOutputDir>false</CopyCppRuntimeToOutputDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
@@ -103,7 +112,8 @@
</ManifestFromManagedAssembly>
</Manifest>
<PreBuildEvent>
<Command>"$(SolutionDir)Update_version.bat"</Command>
<Command>start "" /wait "$(SolutionDir)Update_version.bat" &amp;&amp; move /y "$(SolutionDir)VersionInfo.h" "$(ProjectDir)"
</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@@ -113,8 +123,8 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<ConformanceMode>false</ConformanceMode>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
@@ -128,7 +138,8 @@
<AdditionalManifestFiles>%(AdditionalManifestFiles)</AdditionalManifestFiles>
</Manifest>
<PreBuildEvent>
<Command>"$(SolutionDir)Update_version.bat"</Command>
<Command>start "" /wait "$(SolutionDir)Update_version.bat" &amp;&amp; move /y "$(SolutionDir)VersionInfo.h" "$(ProjectDir)"
</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
@@ -160,13 +171,13 @@
<PreprocessorDefinitions>NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp17</LanguageStandard>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateDebugInformation>false</GenerateDebugInformation>
<AdditionalDependencies>comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<Manifest>