diff --git a/Jenkinsfile b/Jenkinsfile
index aa222c8..841e5bc 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -1,6 +1,7 @@
node {
stage('Checkout') {
checkout scm
+ bat 'git pull --tags'
}
stage('Acquire SE') {
@@ -14,7 +15,7 @@ node {
}
stage('Build') {
- bat "\"${tool 'MSBuild'}msbuild\" Torch.sln /p:Configuration=Release /p:Platform=x64 /t:TransformOnBuild"
+ currentBuild.description = bat(returnStdout: true, script: '@powershell -File Versioning/version.ps1').trim()
bat "\"${tool 'MSBuild'}msbuild\" Torch.sln /p:Configuration=Release /p:Platform=x64"
}
@@ -37,9 +38,20 @@ node {
}
stage('Archive') {
- bat "IF EXIST bin\\torch-${BRANCH_NAME}.zip DEL bin\\torch-${BRANCH_NAME}.zip"
- bat "powershell -Command \"Add-Type -Assembly System.IO.Compression.FileSystem; [System.IO.Compression.ZipFile]::CreateFromDirectory(\\\"\$PWD\\bin\\x64\\Release\\\", \\\"\$PWD\\bin\\torch-${BRANCH_NAME}.zip\\\")\""
- archiveArtifacts artifacts: 'bin/torch-${BRANCH_NAME}.zip', caseSensitive: false, fingerprint: true, onlyIfSuccessful: true
+ bat '''IF EXIST bin\\torch-server.zip DEL bin\\torch-server.zip
+ IF EXIST bin\\package-server RMDIR /S /Q bin\\package-server
+ xcopy bin\\x64\\Release bin\\package-server\\
+ del bin\\package-server\\Torch.Client*'''
+ bat "powershell -Command \"Add-Type -Assembly System.IO.Compression.FileSystem; [System.IO.Compression.ZipFile]::CreateFromDirectory(\\\"\$PWD\\bin\\package-server\\\", \\\"\$PWD\\bin\\torch-server.zip\\\")\""
+ archiveArtifacts artifacts: 'bin/torch-server.zip', caseSensitive: false, onlyIfSuccessful: true
+
+ bat '''IF EXIST bin\\torch-client.zip DEL bin\\torch-client.zip
+ IF EXIST bin\\package-client RMDIR /S /Q bin\\package-client
+ xcopy bin\\x64\\Release bin\\package-client\\
+ del bin\\package-client\\Torch.Server*'''
+ bat "powershell -Command \"Add-Type -Assembly System.IO.Compression.FileSystem; [System.IO.Compression.ZipFile]::CreateFromDirectory(\\\"\$PWD\\bin\\package-client\\\", \\\"\$PWD\\bin\\torch-client.zip\\\")\""
+ archiveArtifacts artifacts: 'bin/torch-client.zip', caseSensitive: false, onlyIfSuccessful: true
+
archiveArtifacts artifacts: 'bin/x64/Release/Torch*', caseSensitive: false, fingerprint: true, onlyIfSuccessful: true
}
}
\ No newline at end of file
diff --git a/Torch.API/Properties/AssemblyInfoGen.tt b/Torch.API/Properties/AssemblyInfoGen.tt
deleted file mode 100644
index 4069a38..0000000
--- a/Torch.API/Properties/AssemblyInfoGen.tt
+++ /dev/null
@@ -1,12 +0,0 @@
-<#@ template debug="false" hostspecific="false" language="C#" #>
-<#@ output extension=".cs" #>
-using System.Reflection;
-
-<# var dt = DateTime.UtcNow;
- int major = 1;
- int minor = 0;
- int build = dt.DayOfYear;
- int rev = (int)dt.TimeOfDay.TotalMinutes / 2;
-#>
-[assembly: AssemblyVersion("<#= major #>.<#= minor #>.<#= build #>.<#= rev #>")]
-[assembly: AssemblyFileVersion("<#= major #>.<#= minor #>.<#= build #>.<#= rev #>")]
\ No newline at end of file
diff --git a/Torch.API/Torch.API.csproj b/Torch.API/Torch.API.csproj
index 8f2942b..99b4836 100644
--- a/Torch.API/Torch.API.csproj
+++ b/Torch.API/Torch.API.csproj
@@ -156,6 +156,9 @@
+
+ Properties\AssemblyVersion.cs
+
@@ -175,11 +178,6 @@
-
- AssemblyInfoGen.tt
- True
- True
-
@@ -188,12 +186,6 @@
-
-
- TextTemplatingFileGenerator
- AssemblyInfoGen.cs
-
-
diff --git a/Torch.Client.Tests/Properties/AssemblyInfoGen.tt b/Torch.Client.Tests/Properties/AssemblyInfoGen.tt
deleted file mode 100644
index 4069a38..0000000
--- a/Torch.Client.Tests/Properties/AssemblyInfoGen.tt
+++ /dev/null
@@ -1,12 +0,0 @@
-<#@ template debug="false" hostspecific="false" language="C#" #>
-<#@ output extension=".cs" #>
-using System.Reflection;
-
-<# var dt = DateTime.UtcNow;
- int major = 1;
- int minor = 0;
- int build = dt.DayOfYear;
- int rev = (int)dt.TimeOfDay.TotalMinutes / 2;
-#>
-[assembly: AssemblyVersion("<#= major #>.<#= minor #>.<#= build #>.<#= rev #>")]
-[assembly: AssemblyFileVersion("<#= major #>.<#= minor #>.<#= build #>.<#= rev #>")]
\ No newline at end of file
diff --git a/Torch.Client.Tests/Torch.Client.Tests.csproj b/Torch.Client.Tests/Torch.Client.Tests.csproj
index 0c86947..d73b8d4 100644
--- a/Torch.Client.Tests/Torch.Client.Tests.csproj
+++ b/Torch.Client.Tests/Torch.Client.Tests.csproj
@@ -60,12 +60,10 @@
-
-
- AssemblyInfoGen.tt
- True
- True
+
+ Properties\AssemblyVersion.cs
+
@@ -90,12 +88,6 @@
-
-
- TextTemplatingFileGenerator
- AssemblyInfoGen.cs
-
-
diff --git a/Torch.Client/Properties/AssemblyInfoGen.tt b/Torch.Client/Properties/AssemblyInfoGen.tt
deleted file mode 100644
index 4069a38..0000000
--- a/Torch.Client/Properties/AssemblyInfoGen.tt
+++ /dev/null
@@ -1,12 +0,0 @@
-<#@ template debug="false" hostspecific="false" language="C#" #>
-<#@ output extension=".cs" #>
-using System.Reflection;
-
-<# var dt = DateTime.UtcNow;
- int major = 1;
- int minor = 0;
- int build = dt.DayOfYear;
- int rev = (int)dt.TimeOfDay.TotalMinutes / 2;
-#>
-[assembly: AssemblyVersion("<#= major #>.<#= minor #>.<#= build #>.<#= rev #>")]
-[assembly: AssemblyFileVersion("<#= major #>.<#= minor #>.<#= build #>.<#= rev #>")]
\ No newline at end of file
diff --git a/Torch.Client/Torch.Client.csproj b/Torch.Client/Torch.Client.csproj
index 937b43a..abe6a5f 100644
--- a/Torch.Client/Torch.Client.csproj
+++ b/Torch.Client/Torch.Client.csproj
@@ -118,12 +118,10 @@
-
-
- AssemblyInfoGen.tt
- True
- True
+
+ Properties\AssemblyVersion.cs
+
@@ -169,12 +167,6 @@
-
-
- TextTemplatingFileGenerator
- AssemblyInfoGen.cs
-
-
diff --git a/Torch.Server.Tests/Properties/AssemblyInfoGen.tt b/Torch.Server.Tests/Properties/AssemblyInfoGen.tt
deleted file mode 100644
index 4cb8d7e..0000000
--- a/Torch.Server.Tests/Properties/AssemblyInfoGen.tt
+++ /dev/null
@@ -1,12 +0,0 @@
-<#@ template debug="false" hostspecific="false" language="C#" #>
-<#@ output extension=".cs" #>
-using System.Reflection;
-
-<# var dt = DateTime.UtcNow;
- int major = 1;
- int minor = 1;
- int build = dt.DayOfYear;
- int rev = (int)dt.TimeOfDay.TotalMinutes / 2;
-#>
-[assembly: AssemblyVersion("<#= major #>.<#= minor #>.<#= build #>.<#= rev #>")]
-[assembly: AssemblyFileVersion("<#= major #>.<#= minor #>.<#= build #>.<#= rev #>")]
\ No newline at end of file
diff --git a/Torch.Server.Tests/Torch.Server.Tests.csproj b/Torch.Server.Tests/Torch.Server.Tests.csproj
index 7ad592a..a3e28b1 100644
--- a/Torch.Server.Tests/Torch.Server.Tests.csproj
+++ b/Torch.Server.Tests/Torch.Server.Tests.csproj
@@ -60,12 +60,10 @@
-
-
- AssemblyInfoGen.tt
- True
- True
+
+ Properties\AssemblyVersion.cs
+
@@ -90,12 +88,6 @@
-
-
- TextTemplatingFileGenerator
- AssemblyInfoGen.cs
-
-
\ No newline at end of file
diff --git a/Torch.Server/Properties/AssemblyInfoGen.tt b/Torch.Server/Properties/AssemblyInfoGen.tt
deleted file mode 100644
index 4cb8d7e..0000000
--- a/Torch.Server/Properties/AssemblyInfoGen.tt
+++ /dev/null
@@ -1,12 +0,0 @@
-<#@ template debug="false" hostspecific="false" language="C#" #>
-<#@ output extension=".cs" #>
-using System.Reflection;
-
-<# var dt = DateTime.UtcNow;
- int major = 1;
- int minor = 1;
- int build = dt.DayOfYear;
- int rev = (int)dt.TimeOfDay.TotalMinutes / 2;
-#>
-[assembly: AssemblyVersion("<#= major #>.<#= minor #>.<#= build #>.<#= rev #>")]
-[assembly: AssemblyFileVersion("<#= major #>.<#= minor #>.<#= build #>.<#= rev #>")]
\ No newline at end of file
diff --git a/Torch.Server/Torch.Server.csproj b/Torch.Server/Torch.Server.csproj
index 1ce4b21..fbfab75 100644
--- a/Torch.Server/Torch.Server.csproj
+++ b/Torch.Server/Torch.Server.csproj
@@ -187,14 +187,12 @@
+
+ Properties\AssemblyVersion.cs
+
-
- True
- True
- AssemblyInfoGen.tt
-
@@ -361,12 +359,6 @@
-
-
- TextTemplatingFileGenerator
- AssemblyInfoGen.cs
-
-
diff --git a/Torch.Tests/Properties/AssemblyInfoGen.tt b/Torch.Tests/Properties/AssemblyInfoGen.tt
deleted file mode 100644
index 4069a38..0000000
--- a/Torch.Tests/Properties/AssemblyInfoGen.tt
+++ /dev/null
@@ -1,12 +0,0 @@
-<#@ template debug="false" hostspecific="false" language="C#" #>
-<#@ output extension=".cs" #>
-using System.Reflection;
-
-<# var dt = DateTime.UtcNow;
- int major = 1;
- int minor = 0;
- int build = dt.DayOfYear;
- int rev = (int)dt.TimeOfDay.TotalMinutes / 2;
-#>
-[assembly: AssemblyVersion("<#= major #>.<#= minor #>.<#= build #>.<#= rev #>")]
-[assembly: AssemblyFileVersion("<#= major #>.<#= minor #>.<#= build #>.<#= rev #>")]
\ No newline at end of file
diff --git a/Torch.Tests/Torch.Tests.csproj b/Torch.Tests/Torch.Tests.csproj
index 02fad1d..fc5f81a 100644
--- a/Torch.Tests/Torch.Tests.csproj
+++ b/Torch.Tests/Torch.Tests.csproj
@@ -60,12 +60,10 @@
-
-
- AssemblyInfoGen.tt
- True
- True
+
+ Properties\AssemblyVersion.cs
+
@@ -85,12 +83,6 @@
-
-
- TextTemplatingFileGenerator
- AssemblyInfoGen.cs
-
-
diff --git a/Torch.sln b/Torch.sln
index d99ed03..a1a48ba 100644
--- a/Torch.sln
+++ b/Torch.sln
@@ -22,6 +22,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Torch.Server.Tests", "Torch
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Torch.Client.Tests", "Torch.Client.Tests\Torch.Client.Tests.csproj", "{632E78C0-0DAC-4B71-B411-2F1B333CC310}"
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Versioning", "Versioning", "{762F6A0D-55EF-4173-8CDE-309D183F40C4}"
+ ProjectSection(SolutionItems) = preProject
+ Versioning\AssemblyVersion.cs = Versioning\AssemblyVersion.cs
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
@@ -60,6 +65,9 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ {762F6A0D-55EF-4173-8CDE-309D183F40C4} = {7AD02A71-1D4C-48F9-A8C1-789A5512424F}
+ EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {BB51D91F-958D-4B63-A897-3C40642ACD3E}
EndGlobalSection
diff --git a/Torch/Properties/AssemblyInfoGen.tt b/Torch/Properties/AssemblyInfoGen.tt
deleted file mode 100644
index 4069a38..0000000
--- a/Torch/Properties/AssemblyInfoGen.tt
+++ /dev/null
@@ -1,12 +0,0 @@
-<#@ template debug="false" hostspecific="false" language="C#" #>
-<#@ output extension=".cs" #>
-using System.Reflection;
-
-<# var dt = DateTime.UtcNow;
- int major = 1;
- int minor = 0;
- int build = dt.DayOfYear;
- int rev = (int)dt.TimeOfDay.TotalMinutes / 2;
-#>
-[assembly: AssemblyVersion("<#= major #>.<#= minor #>.<#= build #>.<#= rev #>")]
-[assembly: AssemblyFileVersion("<#= major #>.<#= minor #>.<#= build #>.<#= rev #>")]
\ No newline at end of file
diff --git a/Torch/Torch.csproj b/Torch/Torch.csproj
index 2d4d9d2..77002b8 100644
--- a/Torch/Torch.csproj
+++ b/Torch/Torch.csproj
@@ -149,16 +149,14 @@
+
+ Properties\AssemblyVersion.cs
+
-
- AssemblyInfoGen.tt
- True
- True
-
@@ -222,12 +220,6 @@
Designer
-
-
- TextTemplatingFileGenerator
- AssemblyInfoGen.cs
-
-
diff --git a/Torch/TorchBase.cs b/Torch/TorchBase.cs
index b038b72..b9b997e 100644
--- a/Torch/TorchBase.cs
+++ b/Torch/TorchBase.cs
@@ -107,7 +107,7 @@ namespace Torch
Instance = this;
- TorchVersion = Assembly.GetExecutingAssembly().GetName().Version;
+ TorchVersion = Assembly.GetExecutingAssembly().GetName().Version;
RunArgs = new string[0];
Managers = new DependencyManager();
@@ -156,7 +156,7 @@ namespace Torch
{
callback?.Invoke(SaveGameStatus.GameNotReady);
}
- else if(MyAsyncSaving.InProgress)
+ else if (MyAsyncSaving.InProgress)
{
callback?.Invoke(SaveGameStatus.SaveInProgress);
}
@@ -246,10 +246,12 @@ namespace Torch
SpaceEngineersGame.SetupPerGameSettings();
TorchVersion = Assembly.GetEntryAssembly().GetName().Version;
+ string verboseVersion = Assembly.GetEntryAssembly().GetCustomAttribute()?.InformationalVersion ?? TorchVersion.ToString();
GameVersion = new Version(new MyVersion(MyPerGameSettings.BasicGameInfo.GameVersion.Value).FormattedText.ToString().Replace("_", "."));
var verInfo = $"{Config.InstanceName} - Torch {TorchVersion}, SE {GameVersion}";
try { Console.Title = verInfo; }
- catch {
+ catch
+ {
///Running as service
}
@@ -317,19 +319,19 @@ namespace Torch
///
public virtual void Start()
{
-
+
}
///
public virtual void Stop()
{
-
+
}
///
public virtual void Restart()
{
-
+
}
///
diff --git a/Versioning/AssemblyVersion.cs b/Versioning/AssemblyVersion.cs
new file mode 100644
index 0000000..9407927
--- /dev/null
+++ b/Versioning/AssemblyVersion.cs
@@ -0,0 +1,4 @@
+using System.Reflection;
+
+[assembly: AssemblyVersion("1.1.4818.229")]
+[assembly: AssemblyInformationalVersion("1.1.229.265-52-gabf26c9")]
diff --git a/Versioning/version.ps1 b/Versioning/version.ps1
new file mode 100644
index 0000000..00de9fc
--- /dev/null
+++ b/Versioning/version.ps1
@@ -0,0 +1,20 @@
+$gitVersion = git describe --tags
+$gitSimpleVersion = git describe --tags --abbrev=0
+if ($gitSimpleVersion.Equals($gitVersion)) {
+ $buildSalt = 0
+} else {
+ $gitLatestCommit = git rev-parse HEAD
+ $buildSalt = [System.Numerics.BigInteger]::Abs([System.Numerics.BigInteger]::Parse($gitLatestCommit, [System.Globalization.NumberStyles]::HexNumber) % 9988) + 1
+}
+$dotNetVersion = echo $gitSimpleVersion | Select-String -Pattern "([0-9]+)\.([0-9]+)\.([0-9]+)" | % {$_.Matches} | %{$_.Groups[1].Value+"."+$_.Groups[2].Value+".$buildSalt."+$_.Groups[3].Value}
+
+$fileContent = @"
+using System.Reflection;
+
+[assembly: AssemblyVersion("$dotNetVersion")]
+[assembly: AssemblyInformationalVersion("$gitVersion")]
+"@
+
+echo $fileContent | Set-Content "$PSScriptRoot/AssemblyVersion.cs"
+
+echo "$gitVersion / $dotNetVersion"
\ No newline at end of file