diff --git a/src/Tgstation.Server.Api/Models/CompilerStatus.cs b/src/Tgstation.Server.Api/Models/CompilerStatus.cs
deleted file mode 100644
index 9cb0a7a5ed..0000000000
--- a/src/Tgstation.Server.Api/Models/CompilerStatus.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-namespace Tgstation.Server.Api.Models
-{
- ///
- /// Status of the for an
- ///
-#pragma warning disable CA1717 // Only FlagsAttribute enums should have plural names
- public enum CompilerStatus
-#pragma warning restore CA1717 // Only FlagsAttribute enums should have plural names
- {
- ///
- /// The is idle
- ///
- Idle,
- ///
- /// The is being copied
- ///
- Copying,
- ///
- /// Pre-compile scripts are running
- ///
- PreCompile,
- ///
- /// The .dme is having it's server side modifications applied
- ///
- Modifying,
- ///
- /// DreamMaker is running
- ///
- Compiling,
- ///
- /// The DMAPI is being verified
- ///
- Verifying,
- ///
- /// Post-compile scripts are running
- ///
- PostCompile,
- ///
- /// The compile results are being duplicated
- ///
- Duplicating,
- ///
- /// The configuration is being linked to the compile results
- ///
- Symlinking,
- ///
- /// A failed compile job is being erased
- ///
- Cleanup
- }
-}
\ No newline at end of file
diff --git a/src/Tgstation.Server.Api/Models/DreamMaker.cs b/src/Tgstation.Server.Api/Models/DreamMaker.cs
index 93c44bf71e..690cc90e09 100644
--- a/src/Tgstation.Server.Api/Models/DreamMaker.cs
+++ b/src/Tgstation.Server.Api/Models/DreamMaker.cs
@@ -1,15 +1,21 @@
-using Tgstation.Server.Api.Models.Internal;
+using System.ComponentModel.DataAnnotations;
namespace Tgstation.Server.Api.Models
{
///
/// Represents the state of the DreamMaker compiler. Create action starts a new compile. Delete action cancels the current compile
///
- public sealed class DreamMaker : DreamMakerSettings
+ public class DreamMaker
{
///
- /// The of the compiler
+ /// The .dme file tries to compile with without the extension
///
- public CompilerStatus Status { get; set; }
+ public string ProjectName { get; set; }
+
+ ///
+ /// The port used during compilation to validate the DMAPI
+ ///
+ [Required]
+ public ushort? ApiValidationPort { get; set; }
}
}
diff --git a/src/Tgstation.Server.Api/Models/Internal/DreamMakerSettings.cs b/src/Tgstation.Server.Api/Models/Internal/DreamMakerSettings.cs
deleted file mode 100644
index a7b649d80c..0000000000
--- a/src/Tgstation.Server.Api/Models/Internal/DreamMakerSettings.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-using System.ComponentModel.DataAnnotations;
-
-namespace Tgstation.Server.Api.Models.Internal
-{
- ///
- /// Configurable settings for
- ///
- public class DreamMakerSettings
- {
- ///
- /// The .dme file tries to compile with without the extension
- ///
- public string ProjectName { get; set; }
-
- ///
- /// The port used during compilation to validate the DMAPI
- ///
- [Required]
- public ushort? ApiValidationPort { get; set; }
- }
-}
diff --git a/src/Tgstation.Server.Api/Rights/DreamMakerRights.cs b/src/Tgstation.Server.Api/Rights/DreamMakerRights.cs
index 439a13d81c..0c4612b834 100644
--- a/src/Tgstation.Server.Api/Rights/DreamMakerRights.cs
+++ b/src/Tgstation.Server.Api/Rights/DreamMakerRights.cs
@@ -25,11 +25,11 @@ namespace Tgstation.Server.Api.Rights
///
CancelCompile = 4,
///
- /// User may modify
+ /// User may modify
///
SetDme = 8,
///
- /// User may modify
+ /// User may modify
///
SetApiValidationPort = 16,
///
diff --git a/src/Tgstation.Server.Host/Components/Compiler/DreamMaker.cs b/src/Tgstation.Server.Host/Components/Compiler/DreamMaker.cs
index 1088833d24..104f541931 100644
--- a/src/Tgstation.Server.Host/Components/Compiler/DreamMaker.cs
+++ b/src/Tgstation.Server.Host/Components/Compiler/DreamMaker.cs
@@ -37,9 +37,6 @@ namespace Tgstation.Server.Host.Components.Compiler
///
const string DmeExtension = "dme";
- ///
- public CompilerStatus Status { get; private set; }
-
///
/// The for
///
@@ -85,6 +82,11 @@ namespace Tgstation.Server.Host.Components.Compiler
///
readonly ILogger logger;
+ ///
+ /// If a compile job is running
+ ///
+ bool compiling;
+
///
/// Construct
///
@@ -241,7 +243,7 @@ namespace Tgstation.Server.Host.Components.Compiler
}
///
- public async Task Compile(Models.RevisionInformation revisionInformation, DreamMakerSettings dreamMakerSettings, DreamDaemonSecurity securityLevel, uint apiValidateTimeout, IRepository repository, CancellationToken cancellationToken)
+ public async Task Compile(Models.RevisionInformation revisionInformation, Api.Models.DreamMaker dreamMakerSettings, DreamDaemonSecurity securityLevel, uint apiValidateTimeout, IRepository repository, CancellationToken cancellationToken)
{
if (revisionInformation == null)
throw new ArgumentNullException(nameof(revisionInformation));
@@ -268,10 +270,9 @@ namespace Tgstation.Server.Host.Components.Compiler
lock (this)
{
- if (Status != CompilerStatus.Idle)
- throw new JobException("There is already a compile in progress!");
-
- Status = CompilerStatus.Copying;
+ if (compiling)
+ throw new JobException("There is already a compile job in progress!");
+ compiling = true;
}
try
@@ -302,7 +303,6 @@ namespace Tgstation.Server.Host.Components.Compiler
async Task CleanupFailedCompile(bool cancelled)
{
logger.LogTrace("Cleaning compile directory...");
- Status = CompilerStatus.Cleanup;
var chatTask = chat.SendUpdateMessage(cancelled ? "Deploy cancelled!" : "Deploy failed!", cancellationToken);
try
{
@@ -330,13 +330,11 @@ namespace Tgstation.Server.Host.Components.Compiler
using (repository)
await repository.CopyTo(fullDirA, cancellationToken).ConfigureAwait(false);
- Status = CompilerStatus.PreCompile;
-
+ //run precompile scripts
var resolvedGameDirectory = ioManager.ResolvePath(ioManager.ConcatPath(job.DirectoryName.ToString(), ADirectoryName));
await eventConsumer.HandleEvent(EventType.CompileStart, new List { resolvedGameDirectory, repoOrigin }, cancellationToken).ConfigureAwait(false);
- Status = CompilerStatus.Modifying;
-
+ //determine the dme
if (job.DmeName == null)
{
logger.LogTrace("Searching for available .dmes...");
@@ -351,20 +349,12 @@ namespace Tgstation.Server.Host.Components.Compiler
await ModifyDme(job, cancellationToken).ConfigureAwait(false);
- Status = CompilerStatus.Compiling;
-
//run compiler, verify api
job.ByondVersion = byondLock.Version.ToString();
var exitCode = await RunDreamMaker(byondLock.DreamMakerPath, job, cancellationToken).ConfigureAwait(false);
- var apiValidated = false;
- if (exitCode == 0)
- {
- Status = CompilerStatus.Verifying;
-
- apiValidated = await VerifyApi(apiValidateTimeout, securityLevel, job, byondLock, dreamMakerSettings.ApiValidationPort.Value, cancellationToken).ConfigureAwait(false);
- }
+ var apiValidated = exitCode == 0 && await VerifyApi(apiValidateTimeout, securityLevel, job, byondLock, dreamMakerSettings.ApiValidationPort.Value, cancellationToken).ConfigureAwait(false);
if (!apiValidated)
{
@@ -374,17 +364,14 @@ namespace Tgstation.Server.Host.Components.Compiler
}
logger.LogTrace("Running post compile event...");
- Status = CompilerStatus.PostCompile;
await eventConsumer.HandleEvent(EventType.CompileComplete, new List { ioManager.ResolvePath(ioManager.ConcatPath(job.DirectoryName.ToString(), ADirectoryName)) }, cancellationToken).ConfigureAwait(false);
logger.LogTrace("Duplicating compiled game...");
- Status = CompilerStatus.Duplicating;
//duplicate the dmb et al
await ioManager.CopyDirectory(dirA, dirB, null, cancellationToken).ConfigureAwait(false);
logger.LogTrace("Applying static game file symlinks...");
- Status = CompilerStatus.Symlinking;
//symlink in the static data
var symATask = configuration.SymlinkStaticFilesTo(fullDirA, cancellationToken);
@@ -411,7 +398,7 @@ namespace Tgstation.Server.Host.Components.Compiler
}
finally
{
- Status = CompilerStatus.Idle;
+ compiling = false;
}
}
}
diff --git a/src/Tgstation.Server.Host/Components/Compiler/IDreamMaker.cs b/src/Tgstation.Server.Host/Components/Compiler/IDreamMaker.cs
index c2d1f3fb6c..dce21e8194 100644
--- a/src/Tgstation.Server.Host/Components/Compiler/IDreamMaker.cs
+++ b/src/Tgstation.Server.Host/Components/Compiler/IDreamMaker.cs
@@ -1,7 +1,6 @@
using System.Threading;
using System.Threading.Tasks;
using Tgstation.Server.Api.Models;
-using Tgstation.Server.Api.Models.Internal;
using Tgstation.Server.Host.Components.Repository;
namespace Tgstation.Server.Host.Components.Compiler
@@ -11,21 +10,16 @@ namespace Tgstation.Server.Host.Components.Compiler
///
public interface IDreamMaker
{
- ///
- /// The of
- ///
- CompilerStatus Status { get; }
-
///
/// Starts a compile
///
/// The being compiled from the
- /// The for the compile
+ /// The for the compile
/// The level allowed for API validation
/// The time in seconds to wait while validating the API
/// The to copy from
/// The for the operation
/// A resulting in the partially populated for the operation. In particular, note the field will only have it's field populated
- Task Compile(Models.RevisionInformation revisionInformation, DreamMakerSettings dreamMakerSettings, DreamDaemonSecurity securityLevel, uint apiValidateTimeout, IRepository repository, CancellationToken cancellationToken);
+ Task Compile(Models.RevisionInformation revisionInformation, Api.Models.DreamMaker dreamMakerSettings, DreamDaemonSecurity securityLevel, uint apiValidateTimeout, IRepository repository, CancellationToken cancellationToken);
}
}
\ No newline at end of file
diff --git a/src/Tgstation.Server.Host/Controllers/DreamMakerController.cs b/src/Tgstation.Server.Host/Controllers/DreamMakerController.cs
index 33b8549e47..823a3700da 100644
--- a/src/Tgstation.Server.Host/Controllers/DreamMakerController.cs
+++ b/src/Tgstation.Server.Host/Controllers/DreamMakerController.cs
@@ -55,7 +55,6 @@ namespace Tgstation.Server.Host.Controllers
return Json(new Api.Models.DreamMaker
{
ProjectName = dreamMakerSettings.ProjectName,
- Status = instance.DreamMaker.Status,
ApiValidationPort = dreamMakerSettings.ApiValidationPort
});
}
diff --git a/src/Tgstation.Server.Host/Models/DreamMakerSettings.cs b/src/Tgstation.Server.Host/Models/DreamMakerSettings.cs
index 81f8312926..6520d92f52 100644
--- a/src/Tgstation.Server.Host/Models/DreamMakerSettings.cs
+++ b/src/Tgstation.Server.Host/Models/DreamMakerSettings.cs
@@ -3,7 +3,7 @@
namespace Tgstation.Server.Host.Models
{
///
- public sealed class DreamMakerSettings : Api.Models.Internal.DreamMakerSettings
+ public sealed class DreamMakerSettings : Api.Models.DreamMaker
{
///
/// The row Id