diff --git a/.vssbe b/.vssbe index 16a01d1..210746c 100644 --- a/.vssbe +++ b/.vssbe @@ -9,28 +9,133 @@ "PreBuild": [ { "Enabled": true, - "Name": "ActVersion", - "Caption": "Update version of regXwild", + "Name": "ActVar", + "Caption": "Prepare data", "Mode": { "$type": "net.r_eg.vsSBE.Events.ModeScript, vsSolutionBuildEvent", "Type": "Script", "Command__": [ + "#[($(Configuration) == \"PublicRelease\") {", + " #[$(cfgname = 'Release')]", + " $(isPubRel = true)", + "}", + "else{", + " #[$(cfgname = $(Configuration))]", + " $(isPubRel = false)", + "}]", + "", + "$(revDeltaBase = \"2020/08/09\")", + "$(revDeltaMin = $([System.Math]::Pow(10, 3)))", + "$(revDeltaMax = 65534)", + "", "$(oraw = \"bin\\raw\")", - "$(orawApp = \"$(oraw)\\$(Configuration)\\$(Platform)/\")", + "$(orawApp = \"$(oraw)\\$(cfgname)\\$(Platform)/\")", "$(odir = \"bin/Releases/\")", "$(onupkg = \"bin/nupkg/\")", "", "#[$(pDir = \"regXwild\")]", "#[$(pConari = \"Conari\")]", "", + "#[var pVer = #[File get(\".version\")]]" + ] + } + }, + { + "Enabled": true, + "Name": "ActVersion", + "Caption": "Update version of regXwild", + "Mode": { + "$type": "net.r_eg.vsSBE.Events.ModeScript, vsSolutionBuildEvent", + "Type": "Script", + "Command__": [ + "#[($(isPubRel)) ", + "{", + " #[var tBase = $([System.DateTime]::Parse('$(revDeltaBase)').ToBinary())]", + " #[var tNow = $([System.DateTime]::UtcNow.Ticks)]", + " #[var revBuild = #[$(", + " [System.TimeSpan]::FromTicks('$(", + " [MSBuild]::Subtract($(tNow), $(tBase))", + " )')", + " .TotalMinutes.ToString('0')", + " )]]", + " ", + " #[var revBuild = #[$(", + " ", + " [MSBuild]::Add(", + " $(revDeltaMin), ", + " $([MSBuild]::Modulo(", + " $(revBuild), ", + " $([MSBuild]::Subtract(", + " $(revDeltaMax), $(revDeltaMin)", + " ))", + " ))", + " )", + " ", + " )]]", + " ", + " #[$(pVerBuild = \"$(pVer).$(revBuild)\")]", + "}", + "else", + "{", + " #[$(revBuild = 0)]", + " #[$(pVerBuild = \"$(pVer)\")]", + "}]", + "", + "#[\" ", + " Checking of the git to define sha1, branch name, etc.", + "\"]", + "#[($(isPubRel) ) { #[var isGit = #[IO cmd(\"git rev-parse 2>&1\")]] }else{ #[var -isGit] }]", + "#[( $(isGit) == \"\" )", + "{", + " #[var bSha1 = #[IO sout(\"git\", \"rev-parse --short HEAD\")]]", + " ", + " #[$(rxwPrintVersion = \"$(pVerBuild)+$(bSha1)\")]", + " #[$(buildCfg = $(Configuration))]", + "}", + "else {", + " #[$(bSha1 = '')]", + " #[$(buildCfg = '')]", + " #[$(rxwPrintVersion = \"$(pVerBuild)\")]", + "}]", "", - "#[var pVer = #[File get(\".version\")]]", + "#[var tpl = #[$(tpl.Replace(\"%B_SHA1%\", \"#[var bSha1]\"))]]", "", - "#[IO replace.Regexp(\"$(pDir)/regXwildAPI.cpp\", \"(vsSBE.+?_T\\().+?;\", \"$1\\\"$(pVer)\\\");\")]", "", - "#[IO replace.Regexp(\"regXwild.nuspec\", \".+?\", \"$(pVer)\")]", - "#[IO replace.Regexp(\"regXwild.nuspec\", \"\\\"regXwild/[0-9.]+\\\"\", \"\\\"regXwild/$(pVer)\\\"\")]", + "#[var tpl =#pragma once", + "// This code was generated by a vsSolutionBuildEvent.", + "// Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.", "", + "#include \"stdafx.h\"", + "", + "namespace net { namespace r_eg { namespace regXwild", + "{", + " struct RXWVersion", + " {", + " struct TNum", + " {", + " const int major;", + " const int minor;", + " const int patch;", + " const int build;", + "", + " TNum(int major, int minor, int patch, int build = 0)", + " : major(major), minor(minor), patch(patch), build(build) { }", + "", + " TNum() : TNum(#[$(pVer.Replace('.', ', '))], #[$(revBuild)]) { }", + "", + " } number;", + "", + " const TCHAR* bSha1 = _T(\"#[$(bSha1)]\");", + " const TCHAR* config = _T(\"#[$(buildCfg)]\");", + " const TCHAR* product = _T(\"#[$(rxwPrintVersion)]\");", + " };", + "}}}", + "]", + "", + "#[File write(\"$(pDir)/RXWVersion.h\"):#[$(tpl.Replace('\\n', '\\r\\n'))]]", + "", + "", + "#[IO replace.Regex(\"$(pDir)/regXwildAPI.cpp\", \"(vsSBE.+?_T\\().+?;\", \"$1\\\"#[$(pVerBuild)]\\\");\")]", "", "" ] @@ -74,6 +179,7 @@ "", "copy /B/Y packages\\Conari.%ConariVersion%\\lib\\%platform%\\%Conari% \"%cd%\"", "snet.exe", + "exit /B 0", "", ":notfound", "echo You need %Conari% v%ConariVersion% to continue. But even GetNuTool was not found to get it automatically. 1>&2", @@ -174,12 +280,13 @@ " \"$(onupkgBin)\", true)]", " ", "#[IO copy.file({ ", - " \"regXwild.nuspec\", ", - " \"Readme.md\", ", - " \"LICENSE\", ", - " \"changelog.txt\" ", - " }, ", - " \"$(onupkg)\", true)]", + " \"regXwild.nuspec\", ", + " \"Readme.md\", ", + " \"LICENSE\", ", + " \"changelog.txt\" ", + " }, ", + " \"$(onupkg)\", true)]", + "#[IO replace(\"$(onupkg)regXwild.nuspec\", \"$-version-$\", \"$(pVer)\")]", "", "#[IO copy.directory(\"\", \"$(onupkg)build\\native\", true)]", "#[IO copy.file(\"regXwild_native.targets\", \"$(onupkg)build\\native/regXwild.targets\", true)]", @@ -196,6 +303,35 @@ ] } }, + { + "Enabled": true, + "Name": "BuildInfo", + "IgnoreIfBuildFailed": true, + "Mode": { + "$type": "net.r_eg.vsSBE.Events.ModeScript, vsSolutionBuildEvent", + "Type": "Script", + "Command__": [ + "#[var buildInfo = $([System.String]::Concat(\" \"))", + " regXwild #[$(rxwPrintVersion)]", + " ", + " ", + " Configuration: #[$(Configuration)]", + " ", + " Build version: #[$(revBuild)]", + " ", + " Branch Sha1: #[$(bSha1)]", + " ", + " ", + " :: generated by a vsSolutionBuildEvent #[$(vsSolutionBuildEvent)]", + "]", + "", + "#[IO writeLine(\"$(onupkg)/build-info.txt\"):#[$(buildInfo.Replace('\\n', '\\r\\n'))]]", + "", + "", + "#[IO replace(\"$(onupkg)regXwild.nuspec\", \"{build-info}\", \"$(buildInfo)\")]" + ] + } + }, { "Enabled": false, "Name": "ActConari", diff --git a/regXwild.nuspec b/regXwild.nuspec index b30c2bf..e50d09a 100644 --- a/regXwild.nuspec +++ b/regXwild.nuspec @@ -2,7 +2,7 @@ regXwild - 1.2.0 + $-version-$ [ regXwild ] Fast Advanced wildcards github.com/3F/regXwild LICENSE @@ -117,10 +117,10 @@ - - - - - - - - - - - - - - - - ======================================= - gnt /p:ngpackages="regXwild/1.2.0" + gnt /p:ngpackages="regXwild/$-version-$" ================== https://github.com/3F/GetNuTool - + {build-info} Small and super Fast advanced wildcards! `*,|,?,^,$,+,#,>` in addition to slow regex engines and more. https://github.com/3F/regXwild wildcards advanced-wildcards fast-wildcards fast-regex extended-wildcards strings text filter search matching search-in-text regex glob filters powerful-wildcards regexp cpp c dotnet dotnetcore csharp Conari regXwild native changelog: https://github.com/3F/regXwild/blob/master/changelog.txt diff --git a/regXwild.sln b/regXwild.sln index cae4c3e..f906b81 100644 --- a/regXwild.sln +++ b/regXwild.sln @@ -36,6 +36,8 @@ Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 + PublicRelease|Win32 = PublicRelease|Win32 + PublicRelease|x64 = PublicRelease|x64 Release|Win32 = Release|Win32 Release|x64 = Release|x64 EndGlobalSection @@ -44,6 +46,10 @@ Global {74660324-42AA-41B6-9FDB-E0ED0D0144CE}.Debug|Win32.Build.0 = Debug|Win32 {74660324-42AA-41B6-9FDB-E0ED0D0144CE}.Debug|x64.ActiveCfg = Debug|x64 {74660324-42AA-41B6-9FDB-E0ED0D0144CE}.Debug|x64.Build.0 = Debug|x64 + {74660324-42AA-41B6-9FDB-E0ED0D0144CE}.PublicRelease|Win32.ActiveCfg = Release|Win32 + {74660324-42AA-41B6-9FDB-E0ED0D0144CE}.PublicRelease|Win32.Build.0 = Release|Win32 + {74660324-42AA-41B6-9FDB-E0ED0D0144CE}.PublicRelease|x64.ActiveCfg = Release|x64 + {74660324-42AA-41B6-9FDB-E0ED0D0144CE}.PublicRelease|x64.Build.0 = Release|x64 {74660324-42AA-41B6-9FDB-E0ED0D0144CE}.Release|Win32.ActiveCfg = Release|Win32 {74660324-42AA-41B6-9FDB-E0ED0D0144CE}.Release|Win32.Build.0 = Release|Win32 {74660324-42AA-41B6-9FDB-E0ED0D0144CE}.Release|x64.ActiveCfg = Release|x64 @@ -52,6 +58,10 @@ Global {B43C60C4-7B0D-466B-BE85-11298000062A}.Debug|Win32.Build.0 = Debug|Win32 {B43C60C4-7B0D-466B-BE85-11298000062A}.Debug|x64.ActiveCfg = Debug|x64 {B43C60C4-7B0D-466B-BE85-11298000062A}.Debug|x64.Build.0 = Debug|x64 + {B43C60C4-7B0D-466B-BE85-11298000062A}.PublicRelease|Win32.ActiveCfg = Release|Win32 + {B43C60C4-7B0D-466B-BE85-11298000062A}.PublicRelease|Win32.Build.0 = Release|Win32 + {B43C60C4-7B0D-466B-BE85-11298000062A}.PublicRelease|x64.ActiveCfg = Release|x64 + {B43C60C4-7B0D-466B-BE85-11298000062A}.PublicRelease|x64.Build.0 = Release|x64 {B43C60C4-7B0D-466B-BE85-11298000062A}.Release|Win32.ActiveCfg = Release|Win32 {B43C60C4-7B0D-466B-BE85-11298000062A}.Release|Win32.Build.0 = Release|Win32 {B43C60C4-7B0D-466B-BE85-11298000062A}.Release|x64.ActiveCfg = Release|x64 @@ -60,6 +70,10 @@ Global {7571CD36-4A3C-446F-96B1-951261274B78}.Debug|Win32.Build.0 = Debug|Win32 {7571CD36-4A3C-446F-96B1-951261274B78}.Debug|x64.ActiveCfg = Debug|x64 {7571CD36-4A3C-446F-96B1-951261274B78}.Debug|x64.Build.0 = Debug|x64 + {7571CD36-4A3C-446F-96B1-951261274B78}.PublicRelease|Win32.ActiveCfg = Release|Win32 + {7571CD36-4A3C-446F-96B1-951261274B78}.PublicRelease|Win32.Build.0 = Release|Win32 + {7571CD36-4A3C-446F-96B1-951261274B78}.PublicRelease|x64.ActiveCfg = Release|x64 + {7571CD36-4A3C-446F-96B1-951261274B78}.PublicRelease|x64.Build.0 = Release|x64 {7571CD36-4A3C-446F-96B1-951261274B78}.Release|Win32.ActiveCfg = Release|Win32 {7571CD36-4A3C-446F-96B1-951261274B78}.Release|Win32.Build.0 = Release|Win32 {7571CD36-4A3C-446F-96B1-951261274B78}.Release|x64.ActiveCfg = Release|x64 @@ -68,6 +82,10 @@ Global {12B25935-229F-4128-B66B-7561A77ABC54}.Debug|Win32.Build.0 = Debug|x86 {12B25935-229F-4128-B66B-7561A77ABC54}.Debug|x64.ActiveCfg = Debug|x64 {12B25935-229F-4128-B66B-7561A77ABC54}.Debug|x64.Build.0 = Debug|x64 + {12B25935-229F-4128-B66B-7561A77ABC54}.PublicRelease|Win32.ActiveCfg = Release|x86 + {12B25935-229F-4128-B66B-7561A77ABC54}.PublicRelease|Win32.Build.0 = Release|x86 + {12B25935-229F-4128-B66B-7561A77ABC54}.PublicRelease|x64.ActiveCfg = Release|x64 + {12B25935-229F-4128-B66B-7561A77ABC54}.PublicRelease|x64.Build.0 = Release|x64 {12B25935-229F-4128-B66B-7561A77ABC54}.Release|Win32.ActiveCfg = Release|x86 {12B25935-229F-4128-B66B-7561A77ABC54}.Release|Win32.Build.0 = Release|x86 {12B25935-229F-4128-B66B-7561A77ABC54}.Release|x64.ActiveCfg = Release|x64 diff --git a/regXwild/RXWVersion.h b/regXwild/RXWVersion.h new file mode 100644 index 0000000..d45a395 --- /dev/null +++ b/regXwild/RXWVersion.h @@ -0,0 +1,29 @@ +#pragma once +// This code was generated by a vsSolutionBuildEvent. +// Changes to this file may cause incorrect behavior and will be lost if the code is regenerated. + +#include "stdafx.h" + +namespace net { namespace r_eg { namespace regXwild +{ + struct RXWVersion + { + struct TNum + { + const int major; + const int minor; + const int patch; + const int build; + + TNum(int major, int minor, int patch, int build = 0) + : major(major), minor(minor), patch(patch), build(build) { } + + TNum() : TNum(1, 2, 0, 0) { } + + } number; + + const TCHAR* bSha1 = _T(""); + const TCHAR* config = _T(""); + const TCHAR* product = _T("1.2.0"); + }; +}}} diff --git a/regXwild/regXwild.h b/regXwild/regXwild.h index f5663ff..e4f0e8a 100644 --- a/regXwild/regXwild.h +++ b/regXwild/regXwild.h @@ -27,6 +27,7 @@ #include "stdafx.h" #include "regXwildConf.h" #include "typedefs.h" +#include "RXWVersion.h" namespace net { namespace r_eg { namespace regXwild { diff --git a/regXwild/regXwild.vcxproj b/regXwild/regXwild.vcxproj index bc7215f..0bad6c8 100644 --- a/regXwild/regXwild.vcxproj +++ b/regXwild/regXwild.vcxproj @@ -157,6 +157,7 @@ + diff --git a/regXwild/regXwild.vcxproj.filters b/regXwild/regXwild.vcxproj.filters index b7a762c..e34b9e6 100644 --- a/regXwild/regXwild.vcxproj.filters +++ b/regXwild/regXwild.vcxproj.filters @@ -60,6 +60,9 @@ Header Files\core\EXT + + Header Files + diff --git a/regXwild/regXwildAPI.cpp b/regXwild/regXwildAPI.cpp index 53d2ddc..572f25a 100644 --- a/regXwild/regXwildAPI.cpp +++ b/regXwild/regXwildAPI.cpp @@ -64,13 +64,12 @@ namespace net { namespace r_eg { namespace regXwild } /** - * To get current version of regXwild library as a string. - * @return Returns version as Major.Minor [.Revision] etc. + * obsolete due to RXWVersion + * @return Returns current RXWVersion.product version of regXwild library. */ REGXWILD_API const TCHAR* versionString() { - // Please use '.version' file. It will be automatically updated by vssbe script. - return /*vsSBE*/_T("1.2.0"); //TODO: additional structure etc. of version data. + return /*vsSBE*/_T("1.2.0"); } }}} \ No newline at end of file