From 3aa4095d9671da91cf02a819bcbad1cffa0ab3a3 Mon Sep 17 00:00:00 2001 From: "Denis Kuzmin [ github.com/3F ]" Date: Fri, 18 Aug 2017 13:50:26 +0300 Subject: [PATCH] added additional info for releases via revBuild & sha1 --- .version | 1 + .vssbe | 85 ++++++++++++++++++++++++++++++++++++++++++----- build.bat | 7 +++- compress.bat | 12 ------- embedded/sha1.cmd | 9 ++--- logic.targets | 2 +- packing.bat | 15 --------- 7 files changed, 89 insertions(+), 42 deletions(-) create mode 100644 .version delete mode 100644 compress.bat delete mode 100644 packing.bat diff --git a/.version b/.version new file mode 100644 index 0000000..dc39e58 --- /dev/null +++ b/.version @@ -0,0 +1 @@ +1.6 \ No newline at end of file diff --git a/.vssbe b/.vssbe index 413498b..d0d26c4 100644 --- a/.vssbe +++ b/.vssbe @@ -13,7 +13,7 @@ { "Enabled": true, "Name": "ActDir", - "Caption": "Prepare output directory", + "Caption": "To prepare directories", "SupportMSBuild": true, "SupportSBEScripts": true, "IgnoreIfBuildFailed": false, @@ -28,14 +28,17 @@ "$(odir = \"$(dbin)raw/\")", "", "#[IO delete.directory(\"$(dbin)\", true)]", - "#[IO copy.directory(\"\", \"$(dbin)\", true)]" + "#[IO copy.directory(\"\", \"$(dbin)\", true)]", + "", + "#[$(dobj = \"obj/\")]", + "#[IO copy.directory(\"\", \"$(dobj)\", true)]" ] } }, { "Enabled": true, "Name": "ActBuild", - "Caption": "Building", + "Caption": "Build core", "SupportMSBuild": true, "SupportSBEScripts": true, "BuildType": "Common", @@ -43,7 +46,69 @@ "$type": "net.r_eg.vsSBE.Events.ModeScript, vsSolutionBuildEvent", "Type": "Script", "Command__": [ - "#[IO writeLine(STDOUT):#[File sout(\"packing.bat\", \"\", 400)]]" + "#[$(revDeltaBase = \"2017/08/12\")]", + "#[$(revDeltaMin = $([System.Math]::Pow(10, 3)))]", + "#[$(revDeltaMax = 65534)] #[\" limit of AssemblyVersion (2^16 - 2) - i.e. 65534 max allowed \"]", + "", + "#[var pVer = #[File get(\".version\")]]", + "", + "#[\" ", + " Calculate revision", + "\"]", + "#[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)", + " ))", + " ))", + " )", + " )]", + "]", + "", + "#[$(pVerPrintFile = \"$(pVer).$(revBuild)\"))]", + "", + "#[\" ", + " Checking of the git folder +tool & define sha1, branch name, etc.", + "\"]", + "#[( #[IO exists.directory(\".git\")] && #[IO exists.file(\"git.exe\", true)] )", + "{", + " #[var bSha1 = #[IO sout(\"git\", \"rev-parse --short HEAD\")]]", + " ", + " #[$(pVerPrintFile = \"$(pVerPrintFile)_$(bSha1)\")]", + "}", + "else {", + " #[$(bSha1 = '-')]", + "}]", + "", + "#[( $(reltype) == \"PublicRelease\" ) {", + " #[$(pVerPrintApp = \"$(pVer).$(revBuild)_$(bSha1)\")]", + "}", + "else {", + " #[$(pVerPrintApp = $(pVer))]", + "}]", + "", + "#[\" obj \"]", + "", + "#[IO copy.file(\"logic.targets\", \"$(dobj)core\", true)]", + "#[IO replace.Regex(\"$(dobj)core\", \".+?\", \"$(pVerPrintApp)\")]", + "", + "#[IO writeLine(STDOUT):#[File sout(\"netmsb.bat\", \"minified/.compressor /p:core=\\\"../$(dobj)core\\\" /p:output=\\\"../$(dobj)gnt.min.core\\\" /nologo /v:m /m:4\", 400)]]", + "", + "#[IO writeLine(STDOUT):#[File sout(\"netmsb.bat\", \"embedded/.packer /p:core=\\\"../$(dobj)gnt.min.core\\\" /p:output=\\\"../$(dobj)gnt.bat\\\" /nologo /v:m /m:4\", 400)]]", + "", + "#[IO copy.file(\"embedded/sha1*\", \"$(dobj)\", true)]", + "#[IO writeLine(STDOUT):#[File sout(\"$(dobj)sha1.cmd\", \"\", 400)]]" ] } } @@ -61,12 +126,12 @@ "$type": "net.r_eg.vsSBE.Events.ModeScript, vsSolutionBuildEvent", "Type": "Script", "Command__": [ - "#[IO copy.file(\"logic.targets\", \"$(odir)core/gnt.core\", true)]", - "#[IO copy.file(\"minified/gnt.core\", \"$(odir)core-minified/gnt.core\", true)]", - "#[IO copy.file(\"embedded/gnt.bat\", \"$(odir)versions/01. executable/gnt.bat\", true)]", + "#[IO copy.file(\"$(dobj)core\", \"$(odir)core/gnt.core\", true)]", + "#[IO copy.file(\"$(dobj)gnt.min.core\", \"$(odir)core-minified/gnt.core\", true)]", + "#[IO copy.file(\"$(dobj)gnt.bat\", \"$(odir)versions/01. executable/gnt.bat\", true)]", "", "#[IO copy.file({", - " \"minified/gnt.core\", ", + " \"$(odir)core-minified/gnt.core\", ", " \"caller/gnt.bat\"", " }, ", " \"$(odir)versions/02. wrapper/\", true)]", @@ -106,7 +171,9 @@ "$type": "net.r_eg.vsSBE.Events.ModeScript, vsSolutionBuildEvent", "Type": "Script", "Command__": [ - "#[7z pack.directory(\"$(dbin)raw\", \"$(dbin)GetNuTool.zip\")]" + "#[7z pack.directory(\"$(dbin)raw\", \"$(dbin)GetNuTool_v$(pVerPrintFile).zip\")]", + "", + "#[IO copy.file(\"$(odir)versions/01. executable/gnt.bat\", \"$(dbin)gnt.bat\", true)]" ] } } diff --git a/build.bat b/build.bat index 22cf9b0..b3de9c1 100644 --- a/build.bat +++ b/build.bat @@ -1,10 +1,15 @@ @echo off +set reltype=%1 set msbuild=netmsb +set cimdll=packages\vsSBE.CI.MSBuild\bin\CI.MSBuild.dll +if "%reltype%"=="" ( + set reltype=Release +) call %msbuild% logic.targets /p:ngconfig="packages.config" /nologo /v:m /m:4 || goto err -call %msbuild% "gnt.sln" /l:"packages\vsSBE.CI.MSBuild\bin\CI.MSBuild.dll" /v:m /m:4 || goto err +call %msbuild% "gnt.sln" /l:"%cimdll%" /v:m /m:4 || goto err exit /B 0 diff --git a/compress.bat b/compress.bat deleted file mode 100644 index 28dbf6a..0000000 --- a/compress.bat +++ /dev/null @@ -1,12 +0,0 @@ -@echo off - -set msbuild=netmsb - -call %msbuild% minified/.compressor /p:core="../logic.targets" /p:output="gnt.core" /nologo /v:m /m:4 %* || goto err - -exit /B 0 - -:err - -echo. Build failed. 1>&2 -exit /B 1 \ No newline at end of file diff --git a/embedded/sha1.cmd b/embedded/sha1.cmd index 3d0edc2..1ff113b 100644 --- a/embedded/sha1.cmd +++ b/embedded/sha1.cmd @@ -1,15 +1,16 @@ @echo off -set msbuild="%~dp0\..\netmsb.bat" - +if not exist "%~dp0\gnt.bat" goto err echo SHA-1 test has been started. +set msbuild="%~dp0\..\netmsb.bat" + call "%~dp0\gnt" -unpack || goto err -call %msbuild% "%~dp0\sha1_comparer.targets" /p:core1="%~dp0\../minified/gnt.core" /p:core2="%~dp0\gnt.core" /nologo /v:m /m:4 || goto err +call %msbuild% "%~dp0\sha1_comparer.targets" /p:core1="%~dp0\gnt.min.core" /p:core2="%~dp0\gnt.core" /nologo /v:m /m:4 || goto err exit /B 0 :err -echo. Build failed. 1>&2 +echo Failed. 1>&2 exit /B 1 \ No newline at end of file diff --git a/logic.targets b/logic.targets index 7aff258..2110cd3 100644 --- a/logic.targets +++ b/logic.targets @@ -378,7 +378,7 @@ - 1.6 + 1 $(MSBuildProjectDirectory) diff --git a/packing.bat b/packing.bat deleted file mode 100644 index 02e330a..0000000 --- a/packing.bat +++ /dev/null @@ -1,15 +0,0 @@ -@echo off - -set msbuild=netmsb - -call compress || goto err -call %msbuild% embedded/.packer /p:core="../minified/gnt.core" /p:output="gnt.bat" /nologo /v:m /m:4 %* || goto err - -embedded/sha1 - -exit /B 0 - -:err - -echo. Build failed. 1>&2 -exit /B 1 \ No newline at end of file