Tweaks to versioning scheme

Nuke staging
This commit is contained in:
Westin Miller
2017-12-02 12:14:48 -08:00
parent 039c5d9244
commit 72b6d0e7bb
7 changed files with 21 additions and 28 deletions

12
Jenkinsfile vendored
View File

@@ -71,16 +71,4 @@ node {
]] ]]
]) ])
} }
if (env.BRANCH_NAME == "master") {
gitVersion = bat(returnStdout: true, script: "@git describe --tags").trim()
gitSimpleVersion = bat(returnStdout: true, script: "@git describe --tags --abbrev=0").trim()
if (gitVersion == gitSimpleVersion) {
stage('${buildMode}') {
withCredentials([usernamePassword(credentialsId: 'torch-github', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
powershell "& ./Jenkins/${buildMode}.ps1 \"https://api.github.com/repos/TorchAPI/Torch/\" \"$gitSimpleVersion\" \"$USERNAME:$PASSWORD\" @(\"bin/torch-server.zip\", \"bin/torch-client.zip\")"
}
}
}
}
} }

View File

@@ -103,7 +103,6 @@ namespace Torch.Server
private ServerState _state; private ServerState _state;
private TimeSpan _elapsedPlayTime; private TimeSpan _elapsedPlayTime;
private float _simRatio; private float _simRatio;
private readonly AutoResetEvent _stopHandle = new AutoResetEvent(false);
private Timer _watchdog; private Timer _watchdog;
private Stopwatch _uptime; private Stopwatch _uptime;
@@ -169,8 +168,6 @@ namespace Torch.Server
Log.Info("Stopping server."); Log.Info("Stopping server.");
base.Stop(); base.Stop();
Log.Info("Server stopped."); Log.Info("Server stopped.");
LogManager.Flush();
_stopHandle.Set();
State = ServerState.Stopped; State = ServerState.Stopped;
IsRunning = false; IsRunning = false;

View File

@@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection; using System.Reflection;
using Torch.Utils; using Torch.Utils;
@@ -42,8 +43,15 @@ namespace Torch.Tests
public ReflectionTestManager Init(Assembly asm) public ReflectionTestManager Init(Assembly asm)
{ {
foreach (Type type in asm.GetTypes()) try
Init(type); {
foreach (Type type in asm.GetTypes())
Init(type);
}
catch (ReflectionTypeLoadException e)
{
throw e.LoaderExceptions[0];
}
return this; return this;
} }

View File

@@ -1,7 +1,9 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Reflection;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Torch.Utils; using Torch.Utils;
@@ -32,4 +34,4 @@ namespace Torch.Tests
private static TorchAssemblyResolver _torchResolver; private static TorchAssemblyResolver _torchResolver;
} }
} }

View File

@@ -394,6 +394,7 @@ namespace Torch
/// <inheritdoc /> /// <inheritdoc />
public virtual void Stop() public virtual void Stop()
{ {
LogManager.Flush();
_game.SignalStop(); _game.SignalStop();
if (!_game.WaitFor(VRageGame.GameState.Stopped, TimeSpan.FromSeconds(15))) if (!_game.WaitFor(VRageGame.GameState.Stopped, TimeSpan.FromSeconds(15)))
Log.Warn("Failed to wait for the game to be stopped"); Log.Warn("Failed to wait for the game to be stopped");

View File

@@ -223,7 +223,7 @@ namespace Torch
StateChange(GameState.Stopped); StateChange(GameState.Stopped);
} }
} }
private void LoadSession(string sessionPath) private void LoadSession(string sessionPath)
{ {
// ? // ?

View File

@@ -1,20 +1,17 @@
$buildSalt = $Env:BUILD_NUMBER
$gitVersion = git describe --tags $gitVersion = git describe --tags
$gitSimpleVersion = git describe --tags --abbrev=0 $gitSimpleVersion = git describe --tags --abbrev=0
if ($gitSimpleVersion.Equals($gitVersion)) { $simpleVersionStandard = echo $gitSimpleVersion | Select-String -Pattern "([0-9]+)\.([0-9]+)\.([0-9]+)" | % {$_.Matches} | %{$_.Groups[1].Value+"."+$_.Groups[2].Value+"."+$_.Groups[3].Value}
$buildSalt = 0 $dotNetVersion = "$simpleVersionStandard.$buildSalt"
} else { $infoVersion = "$gitVersion" -replace "([0-9]+)\.([0-9]+)\.([0-9]+)","$dotNetVersion"
$gitLatestCommit = git rev-parse --short HEAD
$buildSalt = [System.Numerics.BigInteger]::Abs([System.Numerics.BigInteger]::Parse($gitLatestCommit, [System.Globalization.NumberStyles]::HexNumber) % 16383) + 1
}
$dotNetVersion = echo $gitSimpleVersion | Select-String -Pattern "([0-9]+)\.([0-9]+)\.([0-9]+)" | % {$_.Matches} | %{$_.Groups[1].Value+"."+$_.Groups[2].Value+"."+$_.Groups[3].Value+".$buildSalt"}
$fileContent = @" $fileContent = @"
using System.Reflection; using System.Reflection;
[assembly: AssemblyVersion("$dotNetVersion")] [assembly: AssemblyVersion("$dotNetVersion")]
[assembly: AssemblyInformationalVersion("$gitVersion")] [assembly: AssemblyInformationalVersion("$infoVersion")]
"@ "@
echo $fileContent | Set-Content "$PSScriptRoot/AssemblyVersion.cs" echo $fileContent | Set-Content "$PSScriptRoot/AssemblyVersion.cs"
echo "$gitVersion / $dotNetVersion" echo "$infoVersion"