Merge pull request #1137 from tgstation/MinorDMAPIOpt [DMDeploy]

Small DMAPI v3 Optimization
This commit is contained in:
Jordan Brown
2020-10-20 11:01:08 -04:00
committed by GitHub
9 changed files with 54 additions and 11 deletions
+1 -1
View File
@@ -236,7 +236,7 @@ Word commit names descriptively. Only submit work through pull requests. When do
At the time of this writing, the repository is configured to automate much of the deployment/release process.
When the new API or client is ready to be released, update the `Version.props` file appropriately and merge the pull request with the text `[APIDeploy]` or `[NuGetDeploy]` respectively in the commit message (or both!). The release will be published automatically.
When the new API, client, or DMAPI is ready to be released, update the `Version.props` file appropriately and merge the pull request with the text `[APIDeploy]`, `[NuGetDeploy]`, or `[DMDeploy]` respectively in the commit message (or all three!). The release will be published automatically.
That step should be taken for the latest API and client before releasing the core version that uses them if applicable.
+1 -1
View File
@@ -6,7 +6,7 @@
<TgsConfigVersion>2.1.0</TgsConfigVersion>
<TgsApiVersion>7.4.0</TgsApiVersion>
<TgsClientVersion>8.4.0</TgsClientVersion>
<TgsDmapiVersion>5.2.6</TgsDmapiVersion>
<TgsDmapiVersion>5.2.7</TgsDmapiVersion>
<TgsControlPanelVersion>0.4.0</TgsControlPanelVersion>
<TgsHostWatchdogVersion>1.1.0</TgsHostWatchdogVersion>
</PropertyGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
// tgstation-server DMAPI
#define TGS_DMAPI_VERSION "5.2.6"
#define TGS_DMAPI_VERSION "5.2.7"
// All functions and datums outside this document are subject to change with any version and should not be relied on.
+1 -1
View File
@@ -39,7 +39,7 @@
var/warned_custom_commands = FALSE
/datum/tgs_api/v3210/ApiVersion()
return new /datum/tgs_version("3.2.1.2")
return new /datum/tgs_version("3.2.1.3")
/datum/tgs_api/v3210/proc/trim_left(text)
for (var/i = 1 to length(text))
+1 -1
View File
@@ -45,7 +45,7 @@
// Discord hack, fix the mention if it's only numbers (fuck you IRC trolls)
var/regex/discord_id_regex = regex(@"^[0-9]+$")
if(discord_id_regex.Find(sender))
if(findtext(sender, discord_id_regex))
sender = "<@[sender]>"
user.mention = sender
+1 -1
View File
@@ -18,7 +18,7 @@
var/initialized = FALSE
/datum/tgs_api/v5/ApiVersion()
return new /datum/tgs_version("5.2.6")
return new /datum/tgs_version(TGS_DMAPI_VERSION)
/datum/tgs_api/v5/OnWorldNew(minimum_required_security_level)
server_port = world.params[DMAPI5_PARAM_SERVER_PORT]
@@ -1,6 +1,7 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using System;
using System.Reflection;
using Tgstation.Server.Host.Components.Interop.Converters;
namespace Tgstation.Server.Host.Components.Interop
@@ -33,7 +34,11 @@ namespace Tgstation.Server.Host.Components.Interop
/// <summary>
/// The DMAPI <see cref="Version"/> being used.
/// </summary>
public static readonly Version Version = new Version(5, 2, 6);
public static readonly Version Version = Version.Parse(
Assembly
.GetExecutingAssembly()
.GetCustomAttribute<DMApiVersionAtrribute>()
.RawDMApiVersion);
/// <summary>
/// <see cref="JsonSerializerSettings"/> for use when communicating with the DMAPI.
@@ -0,0 +1,25 @@
using System;
namespace Tgstation.Server.Host.Components.Interop
{
/// <summary>
/// Attribute for bringing in the <see cref="DMApiConstants.Version"/> from MSBuild.
/// </summary>
[AttributeUsage(AttributeTargets.Assembly)]
sealed class DMApiVersionAtrribute : Attribute
{
/// <summary>
/// The <see cref="Version"/> string of the DMAPI version built.
/// </summary>
public string RawDMApiVersion { get; }
/// <summary>
/// Initializes a new instance of the <see cref="DMApiVersionAtrribute"/> <see langword="class"/>.
/// </summary>
/// <param name="rawDMApiVersion">The value of <see cref="RawDMApiVersion"/>.</param>
public DMApiVersionAtrribute(string rawDMApiVersion)
{
RawDMApiVersion = rawDMApiVersion ?? throw new ArgumentNullException(nameof(rawDMApiVersion));
}
}
}
@@ -17,14 +17,14 @@
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningsAsErrors />
</PropertyGroup>
<PropertyGroup>
<NodeModulesFolder>ClientApp/node_modules</NodeModulesFolder>
<NpmInstallStampFile>ClientApp/node_modules/.install-stamp</NpmInstallStampFile>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>..\..</DockerfileContext>
</PropertyGroup>
<Target Name="NpmInstall" Inputs="ClientApp/package-lock.json" Outputs="$(NpmInstallStampFile)">
<Message Text="Restoring npm packages..." Importance="high" />
<Exec WorkingDirectory="ClientApp" Command="npm ci" />
@@ -35,12 +35,25 @@
<Message Text="Building web control panel..." Importance="high" />
<Exec WorkingDirectory="ClientApp" Command="npm run msbuild" />
</Target>
<Target Name="NpmClean" AfterTargets="Clean">
<Message Text="Cleaning web control panel..." Importance="high" />
<RemoveDir Directories="wwwroot" />
</Target>
<Target Name="GenerateBuildVersionsAttribute" BeforeTargets="CoreCompile">
<ItemGroup>
<AssemblyAttributes Include="Tgstation.Server.Host.Components.Interop.DMApiVersionAtrribute">
<_Parameter1>$(TgsDmapiVersion)</_Parameter1>
</AssemblyAttributes>
</ItemGroup>
<WriteCodeFragment AssemblyAttributes="@(AssemblyAttributes)" Language="C#" OutputDirectory="$(IntermediateOutputPath)" OutputFile="DMApiVersion.cs">
<Output TaskParameter="OutputFile" ItemName="Compile" />
<Output TaskParameter="OutputFile" ItemName="FileWrites" />
</WriteCodeFragment>
</Target>
<ItemGroup>
<PackageReference Include="BetterWin32Errors" Version="0.2.0" />
<PackageReference Include="Byond.TopicSender" Version="5.0.0" />
@@ -109,7 +122,7 @@
<ClientApp Include="ClientApp\src\**\*;ClientApp\public\**\*;ClientApp\tsconfig.json;ClientApp\package.json;ClientApp\package-lock.json" />
<AdditionalFiles Include="../../build/stylecop.json" />
</ItemGroup>
<ItemGroup>
<Content Update="appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>