tgstation-server 6.12.0
The /tg/station 13 server suite
Loading...
Searching...
No Matches
CompileJob.cs
Go to the documentation of this file.
1using System;
2using System.ComponentModel.DataAnnotations;
3
6
8{
10 public sealed class CompileJob : Api.Models.Internal.CompileJob, ILegacyApiTransformable<CompileJobResponse>
11 {
15 [Required]
16 public Job Job { get; set; }
17
21 public long JobId { get; set; }
22
26 [Required]
28
32 [Required]
33 public string EngineVersion { get; set; }
34
38 public int? DMApiMajorVersion { get; set; }
39
43 public int? DMApiMinorVersion { get; set; }
44
48 public int? DMApiPatchVersion { get; set; }
49
53 public string? RepositoryOrigin { get; set; }
54
58 public long? GitHubRepoId { get; set; }
59
63 public long? GitHubDeploymentId { get; set; }
64
66 public override Version? DMApiVersion
67 {
68 get
69 {
70 if (!DMApiMajorVersion.HasValue)
71 return null;
72
73 return new Version(DMApiMajorVersion.Value, DMApiMinorVersion!.Value, DMApiPatchVersion!.Value);
74 }
75
76 set
77 {
78 DMApiMajorVersion = value?.Major;
79 DMApiMinorVersion = value?.Minor;
80 DMApiPatchVersion = value?.Build;
81 }
82 }
83
87 [Obsolete("For use by EFCore only", true)]
88 public CompileJob()
89 : this(null!, null!, null!, false)
90 {
91 }
92
99 public CompileJob(Job job, RevisionInformation revisionInformation, string engineVersion)
100 : this(job, revisionInformation, engineVersion, true)
101 {
102 }
103
111 CompileJob(Job job, RevisionInformation revisionInformation, string engineVersion, bool nullChecks)
112 {
113 if (nullChecks)
114 {
115 ArgumentNullException.ThrowIfNull(job);
116 ArgumentNullException.ThrowIfNull(revisionInformation);
117 ArgumentNullException.ThrowIfNull(engineVersion);
118 }
119
120 Job = job;
121 RevisionInformation = revisionInformation;
122 EngineVersion = engineVersion;
123 }
124
126 public CompileJobResponse ToApi() => new()
127 {
130 Id = Id,
131 Job = Job.ToApi(),
132 Output = Output,
134 EngineVersion = Api.Models.EngineVersion.TryParse(EngineVersion, out var version)
135 ? version
136 : throw new InvalidOperationException($"Failed to parse engine version: {EngineVersion}"),
139 RepositoryOrigin = RepositoryOrigin != null ? new Uri(RepositoryOrigin) : null,
140 };
141 }
142}
Information about an engine installation.
virtual ? long Id
The ID of the entity.
Definition EntityId.cs:13
string? DmeName
The .dme file used for compilation.
Definition CompileJob.cs:16
DreamDaemonSecurity? MinimumSecurityLevel
The minimum DreamDaemonSecurity required to run the CompileJob's output.
Definition CompileJob.cs:34
Guid? DirectoryName
The Game folder the results were compiled into.
Definition CompileJob.cs:28
int? DMApiMinorVersion
Backing field for Version.Minor of DMApiVersion.
Definition CompileJob.cs:43
string? RepositoryOrigin
The origin Uri of the repository the compile job was built from.
Definition CompileJob.cs:53
int? DMApiPatchVersion
Backing field for Version.Build of DMApiVersion.
Definition CompileJob.cs:48
long? GitHubDeploymentId
The GitHub deployment ID associated with the CompileJob if any.
Definition CompileJob.cs:63
CompileJob(Job job, RevisionInformation revisionInformation, string engineVersion, bool nullChecks)
Initializes a new instance of the CompileJob class.
CompileJob(Job job, RevisionInformation revisionInformation, string engineVersion)
Initializes a new instance of the CompileJob class.
Definition CompileJob.cs:99
int? DMApiMajorVersion
Backing field for Version.Major of DMApiVersion.
Definition CompileJob.cs:38
long? GitHubRepoId
The source GitHub repository the deployment came from if any.
Definition CompileJob.cs:58
CompileJob()
Initializes a new instance of the CompileJob class.
Definition CompileJob.cs:88
long JobId
The EntityId.Id of Job.
Definition CompileJob.cs:21
Api.Models.RevisionInformation ToApi()
Represents a host-side model that may be transformed into a TApiModel .
@ Required
DMAPI validation must suceed for the deployment to succeed.