From ca7ed2f852cd5dfe504d35cdd662b542a55a61c4 Mon Sep 17 00:00:00 2001 From: Eugen Kremer Date: Thu, 3 Oct 2024 13:46:10 +0000 Subject: [PATCH] provide version as build parameter --- .github/workflows/main.yml | 5 +++-- VersionInfo.h | 22 +++++++++++++++++----- VersionInfo_tmpl.h | 27 --------------------------- jN.vcxproj | 13 ++++++++----- res.rc | 10 +++++----- 5 files changed, 33 insertions(+), 44 deletions(-) delete mode 100644 VersionInfo_tmpl.h diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 87e0ef2..b81440e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,15 +16,16 @@ jobs: with: fetch-depth: 0 # avoid shallow clone so nbgv can do its work. - - uses: dotnet/nbgv@master + - name: get-version id: nbgv + run: nbgv.exe get-version -f json -p . - name: Setup MSBuild uses: microsoft/setup-msbuild@v2 - name: Build with MSBuild run: | - msbuild jN.vcxproj /p:Configuration=${{ matrix.configuration }} /p:Platform=${{ matrix.platform }} + msbuild jN.vcxproj /p:Configuration=${{ matrix.configuration }} /p:Platform=${{ matrix.platform }} /p:VersionDefinitions="VERSION_MA=${{steps.nbgv.outputs.VersionMajor}}3;VERSION_MI=${{steps.nbgv.outputs.VersionMinor}};REVISION=${{steps.nbgv.outputs.BuildNumber}};VERSION_REVISION=${{steps.nbgv.outputs.VersionRevision}}" - name: Create zip file run: | diff --git a/VersionInfo.h b/VersionInfo.h index fefd822..32eddf2 100644 --- a/VersionInfo.h +++ b/VersionInfo.h @@ -16,12 +16,24 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#ifndef VERSION_MA #define VERSION_MA 2 -#define VERSION_MI 2 +#endif +#ifndef VERSION_MI +#define VERSION_MI 2 +#endif + +#ifndef REVISION // increment revision in case of modification -#define REVISION 185 - #define xstr(s) str(s) - #define str(s) #s -#define _VERSION_STR VERSION_MA ## . ## REVISION +#define REVISION 185 +#endif + +#ifndef VERSION_REVISION +#define VERSION_REVISION 0 +#endif + +#define xstr(s) str(s) +#define str(s) #s +#define _VERSION_STR VERSION_MA ## . ## VERSION_MI ## . ## REVISION diff --git a/VersionInfo_tmpl.h b/VersionInfo_tmpl.h deleted file mode 100644 index 5a9d6b6..0000000 --- a/VersionInfo_tmpl.h +++ /dev/null @@ -1,27 +0,0 @@ -/* -This file is part of jN, a plugin for Notepad++ -Copyright (C)2013 Eugen Kremer - -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 . -*/ - -#define VERSION_MA 2 -#define VERSION_MI 0 - -// increment revision in case of modification -#define REVISION $WCREV$ - #define xstr(s) str(s) - #define str(s) #s -#define _VERSION_STR VERSION_MA ## . ## REVISION - diff --git a/jN.vcxproj b/jN.vcxproj index b1a34f3..a4f0d0d 100644 --- a/jN.vcxproj +++ b/jN.vcxproj @@ -22,6 +22,7 @@ {1590D7CD-7D3A-4AB7-A355-EE02F7FB987D} NppPluginTemplate Win32Proj + VER=default @@ -67,7 +68,7 @@ MaxSpeed true .\;%(AdditionalIncludeDirectories) - WIN32;_WINDOWS;_USRDLL;NPPPLUGINTEMPLATE_EXPORTS;UNICODE;%(PreprocessorDefinitions) + WIN32;_WINDOWS;_USRDLL;NPPPLUGINTEMPLATE_EXPORTS;UNICODE;%(PreprocessorDefinitions);$(VersionDefinitions) MultiThreaded false @@ -105,7 +106,7 @@ MaxSpeed true .\;%(AdditionalIncludeDirectories) - WIN32;_WINDOWS;_USRDLL;NPPPLUGINTEMPLATE_EXPORTS;UNICODE;%(PreprocessorDefinitions) + WIN32;_WINDOWS;_USRDLL;NPPPLUGINTEMPLATE_EXPORTS;UNICODE;%(PreprocessorDefinitions);$(VersionDefinitions) MultiThreaded false @@ -142,7 +143,7 @@ Disabled .\;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;_USRDLL;NPPPLUGINTEMPLATE_EXPORTS;UNICODE;%(PreprocessorDefinitions) + WIN32;_DEBUG;_WINDOWS;_USRDLL;NPPPLUGINTEMPLATE_EXPORTS;UNICODE;%(PreprocessorDefinitions);$(VersionDefinitions) false Default MultiThreadedDebug @@ -178,7 +179,7 @@ Disabled .\;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;_USRDLL;NPPPLUGINTEMPLATE_EXPORTS;UNICODE;%(PreprocessorDefinitions) + WIN32;_DEBUG;_WINDOWS;_USRDLL;NPPPLUGINTEMPLATE_EXPORTS;UNICODE;%(PreprocessorDefinitions);$(VersionDefinitions) false Default MultiThreadedDebug @@ -238,7 +239,9 @@ - + + %(PreprocessorDefinitions);$(VersionDefinitions) + diff --git a/res.rc b/res.rc index 5415afa..50544ff 100644 --- a/res.rc +++ b/res.rc @@ -7,12 +7,12 @@ STRINGTABLE BEGIN -1 "jN Plugin for Notepad++\n© Eugen Kremer, 2023\ngithub.com/sieukrem/jn-npp-plugin" +1 "jN Plugin for Notepad++\n© Eugen Kremer, 2024\ngithub.com/sieukrem/jn-npp-plugin" END 1 VERSIONINFO -FILEVERSION VERSION_MA,VERSION_MI,REVISION,10 -PRODUCTVERSION VERSION_MA,VERSION_MI,REVISION,10 +FILEVERSION VERSION_MA,VERSION_MI,REVISION,VERSION_REVISION +PRODUCTVERSION VERSION_MA,VERSION_MI,REVISION,VERSION_REVISION FILEOS 0x40004 FILETYPE 0x1 { @@ -21,10 +21,10 @@ BLOCK "StringFileInfo" BLOCK "040904b0" { VALUE "CompanyName", "Eugen Kremer" - VALUE "FileDescription", "jN Plugin for Notepad++ that allows you to automate certain Tasks with JavaScript" + VALUE "FileDescription", "jN Plugin for Notepad++ that allows you to automate tasks with JavaScript" VALUE "FileVersion", xstr(_VERSION_STR) VALUE "InternalName", "jN.dll" - VALUE "LegalCopyright", "Copyleft 2023 by Eugen Kremer" + VALUE "LegalCopyright", "Copyleft 2024 by Eugen Kremer" VALUE "OriginalFilename", "jN.dll" VALUE "ProductName", "jN" VALUE "ProductVersion", xstr(_VERSION_STR)