Skip to content

Commit

Permalink
provide version as build parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
sieukrem committed Oct 3, 2024
1 parent 922069f commit ca7ed2f
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 44 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
22 changes: 17 additions & 5 deletions VersionInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,24 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#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

27 changes: 0 additions & 27 deletions VersionInfo_tmpl.h

This file was deleted.

13 changes: 8 additions & 5 deletions jN.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<ProjectGuid>{1590D7CD-7D3A-4AB7-A355-EE02F7FB987D}</ProjectGuid>
<RootNamespace>NppPluginTemplate</RootNamespace>
<Keyword>Win32Proj</Keyword>
<VersionDefinitions>VER=default</VersionDefinitions>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
Expand Down Expand Up @@ -67,7 +68,7 @@
<Optimization>MaxSpeed</Optimization>
<WholeProgramOptimization>true</WholeProgramOptimization>
<AdditionalIncludeDirectories>.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WINDOWS;_USRDLL;NPPPLUGINTEMPLATE_EXPORTS;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WINDOWS;_USRDLL;NPPPLUGINTEMPLATE_EXPORTS;UNICODE;%(PreprocessorDefinitions);$(VersionDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<PrecompiledHeader />
Expand Down Expand Up @@ -105,7 +106,7 @@
<Optimization>MaxSpeed</Optimization>
<WholeProgramOptimization>true</WholeProgramOptimization>
<AdditionalIncludeDirectories>.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WINDOWS;_USRDLL;NPPPLUGINTEMPLATE_EXPORTS;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WINDOWS;_USRDLL;NPPPLUGINTEMPLATE_EXPORTS;UNICODE;%(PreprocessorDefinitions);$(VersionDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<PrecompiledHeader>
Expand Down Expand Up @@ -142,7 +143,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;NPPPLUGINTEMPLATE_EXPORTS;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;NPPPLUGINTEMPLATE_EXPORTS;UNICODE;%(PreprocessorDefinitions);$(VersionDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
Expand Down Expand Up @@ -178,7 +179,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;NPPPLUGINTEMPLATE_EXPORTS;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;NPPPLUGINTEMPLATE_EXPORTS;UNICODE;%(PreprocessorDefinitions);$(VersionDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
Expand Down Expand Up @@ -238,7 +239,9 @@
<Image Include="jN.ico" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="res.rc" />
<ResourceCompile Include="res.rc">
<PreprocessorDefinitions>%(PreprocessorDefinitions);$(VersionDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="common\AcceleratorHook.h" />
Expand Down
10 changes: 5 additions & 5 deletions res.rc
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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)
Expand Down

0 comments on commit ca7ed2f

Please sign in to comment.