Merge pull request #438 from tgstation/336-StagedStaging

BYOND updates block compiles and recompile the game using the staged version
This commit is contained in:
Jordan Brown
2017-12-06 12:05:25 -05:00
committed by GitHub
3 changed files with 27 additions and 4 deletions
+4
View File
@@ -55,6 +55,10 @@ namespace TGS.Interface
/// Revision is being applied
/// </summary>
Updating,
/// <summary>
/// Running game code is being recompiled under staged update
/// </summary>
CompilingStaged,
}
/// <summary>
/// Type of byond version
+6 -2
View File
@@ -118,6 +118,7 @@ namespace TGS.Server
case ByondStatus.Downloading:
case ByondStatus.Staging:
case ByondStatus.Updating:
case ByondStatus.CompilingStaged:
return true;
case ByondStatus.Idle:
case ByondStatus.Staged:
@@ -204,7 +205,7 @@ namespace TGS.Server
return;
updateStat = ByondStatus.Downloading;
}
bool staged = false;
try
{
CleanByondStaging();
@@ -266,10 +267,11 @@ namespace TGS.Server
lastError = "Failed to apply update!";
break;
default:
RequestRestart();
//Compile() will call RequestRestart()
lastError = "Update staged. Awaiting server restart...";
SendMessage(String.Format("BYOND: Staging complete. Awaiting server restart...", major, minor), MessageType.DeveloperInfo);
WriteInfo(String.Format("BYOND update {0}.{1} staged", major, minor), EventID.BYONDUpdateStaged);
staged = true;
break;
}
}
@@ -287,6 +289,8 @@ namespace TGS.Server
RevisionStaging = null;
}
}
if(staged)
Compile();
}
/// <inheritdoc />
public bool UpdateToVersion(int major, int minor)
+17 -2
View File
@@ -421,7 +421,14 @@ namespace TGS.Server
using (var DM = new Process()) //will kill the process if the thread is terminated
{
DM.StartInfo.FileName = RelativePath(ByondDirectory + "/bin/dm.exe");
bool stagedBuild;
lock (ByondLock)
{
stagedBuild = updateStat == ByondStatus.Staged;
if (stagedBuild)
updateStat = ByondStatus.CompilingStaged;
}
DM.StartInfo.FileName = RelativePath(Path.Combine(stagedBuild ? StagingDirectoryInner : ByondDirectory, "bin/dm.exe"));
DM.StartInfo.Arguments = String.Format("-clean {0}", dmePath);
DM.StartInfo.RedirectStandardOutput = true;
DM.StartInfo.UseShellExecute = false;
@@ -469,6 +476,12 @@ namespace TGS.Server
{
canCancelCompilation = false;
}
if (stagedBuild)
{
lock (ByondLock)
updateStat = ByondStatus.Staged;
RequestRestart();
}
}
if (DM.ExitCode == 0)
@@ -525,7 +538,6 @@ namespace TGS.Server
}
}
}
}
catch (ThreadAbortException)
{
@@ -564,6 +576,9 @@ namespace TGS.Server
{
if (compilerCurrentStatus != CompilerStatus.Initialized)
return false;
lock (ByondLock)
if (updateStat == ByondStatus.Staged)
return false;
silentCompile = silent;
lastCompilerError = null;
compilerCurrentStatus = CompilerStatus.Compiling;