Skip to content

Commit

Permalink
+RXWVersion.h & PublicRelease cfg
Browse files Browse the repository at this point in the history
NOTE: API versionString() marked as obsolete due to RXWVersion
  • Loading branch information
3F committed Aug 9, 2020
1 parent 5d25213 commit de927c7
Show file tree
Hide file tree
Showing 8 changed files with 207 additions and 20 deletions.
162 changes: 149 additions & 13 deletions .vssbe
Original file line number Diff line number Diff line change
Expand Up @@ -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\", \"<version>.+?</version>\", \"<version>$(pVer)</version>\")]",
"#[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)]\\\");\")]",
"",
""
]
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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)]",
Expand All @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions regXwild.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>regXwild</id>
<version>1.2.0</version>
<version>$-version-$</version>
<title>[ regXwild ] Fast Advanced wildcards</title>
<authors>github.com/3F/regXwild</authors>
<license type="file">LICENSE</license>
Expand Down Expand Up @@ -117,10 +117,10 @@
- - - - - - - - - - - - - - - -

=======================================
gnt /p:ngpackages="regXwild/1.2.0"
gnt /p:ngpackages="regXwild/$-version-$"
================== https://github.com/3F/GetNuTool

</description>
{build-info}</description>
<summary>Small and super Fast advanced wildcards! `*,|,?,^,$,+,#,&gt;` in addition to slow regex engines and more. https://github.com/3F/regXwild</summary>
<tags>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</tags>
<releaseNotes> changelog: https://github.com/3F/regXwild/blob/master/changelog.txt </releaseNotes>
Expand Down
18 changes: 18 additions & 0 deletions regXwild.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
29 changes: 29 additions & 0 deletions regXwild/RXWVersion.h
Original file line number Diff line number Diff line change
@@ -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");
};
}}}
1 change: 1 addition & 0 deletions regXwild/regXwild.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "stdafx.h"
#include "regXwildConf.h"
#include "typedefs.h"
#include "RXWVersion.h"

namespace net { namespace r_eg { namespace regXwild
{
Expand Down
1 change: 1 addition & 0 deletions regXwild/regXwild.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@
<ClInclude Include="regXwild.h" />
<ClInclude Include="regXwildAPI.h" />
<ClInclude Include="regXwildConf.h" />
<ClInclude Include="RXWVersion.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
<ClInclude Include="typedefs.h" />
Expand Down
3 changes: 3 additions & 0 deletions regXwild/regXwild.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@
<ClInclude Include="core\EXT\AlgorithmExt.h">
<Filter>Header Files\core\EXT</Filter>
</ClInclude>
<ClInclude Include="RXWVersion.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
Expand Down
7 changes: 3 additions & 4 deletions regXwild/regXwildAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

}}}

0 comments on commit de927c7

Please sign in to comment.