Skip to content

Commit

Permalink
Remove the TGS3 migrator
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyberboss committed Nov 16, 2024
1 parent 15f11c3 commit eb137ad
Show file tree
Hide file tree
Showing 17 changed files with 39 additions and 1,084 deletions.
1 change: 0 additions & 1 deletion build/Version.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
<TgsHostWatchdogVersion>1.6.0</TgsHostWatchdogVersion>
<TgsSwarmProtocolVersion>8.0.0</TgsSwarmProtocolVersion>
<TgsContainerScriptVersion>1.2.1</TgsContainerScriptVersion>
<TgsMigratorVersion>2.0.0</TgsMigratorVersion>
<TgsNugetNetFramework>netstandard2.0</TgsNugetNetFramework>
<TgsNetMajorVersion>8</TgsNetMajorVersion>
<!-- Update this frequently with dotnet runtime patches. MAJOR MUST MATCH ABOVE! -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.IO;
using System.ServiceProcess;

using Tgstation.Server.Common;
using Tgstation.Server.Host.Common;

using WixToolset.Dtf.WindowsInstaller;
Expand All @@ -13,12 +14,6 @@
/// </summary>
public static class InstallationExtensions
{
/// <summary>
/// Package name
/// </summary>
/// <remarks>As much as I'd like to use Tgstation.Server.Common.Constants.CanonicalPackageName here, attempting to reference it makes Tgstation.Server.Migrator.Comms fail due to referencing the net2.0 version of that library. EVEN THOUGH IT'S A TRANSITIVE DEPENDENCY OF Tgstation.Server.Client!!!!! If that dead-ass tool has been removed, feel free to do this.</remarks>
const string CanonicalPackageName = "tgstation-server";

/// <summary>
/// Attempts to detach stop the existing tgstation-server service if it exists.
/// </summary>
Expand All @@ -35,35 +30,35 @@ public static ActionResult DetachStopTgsServiceIfRunning(Session session)
session.Log("Begin DetachStopTgsServiceIfRunning");
ServiceController serviceController = null;

session.Log($"Searching for {CanonicalPackageName} service...");
session.Log($"Searching for {Constants.CanonicalPackageName} service...");
try
{
foreach (var controller in ServiceController.GetServices())
if (controller.ServiceName == CanonicalPackageName)
if (controller.ServiceName == Constants.CanonicalPackageName)
serviceController = controller;
else
controller.Dispose();

if (serviceController == null || serviceController.Status != ServiceControllerStatus.Running)
{
session.Log($"{CanonicalPackageName} service not found. Continuing.");
session.Log($"{Constants.CanonicalPackageName} service not found. Continuing.");
return ActionResult.Success;
}

var commandId = PipeCommands.GetServiceCommandId(
PipeCommands.CommandDetachingShutdown)
.Value;

session.Log($"{CanonicalPackageName} service found. Sending command \"{PipeCommands.CommandDetachingShutdown}\" ({commandId})...");
session.Log($"{Constants.CanonicalPackageName} service found. Sending command \"{PipeCommands.CommandDetachingShutdown}\" ({commandId})...");

serviceController.ExecuteCommand(commandId);

session.Log($"Command sent. Waiting for {CanonicalPackageName} service to stop...");
session.Log($"Command sent. Waiting for {Constants.CanonicalPackageName} service to stop...");

serviceController.WaitForStatus(ServiceControllerStatus.Stopped, TimeSpan.FromMinutes(1));

var stopped = serviceController.Status == ServiceControllerStatus.Stopped;
session.Log($"{CanonicalPackageName} stopped {(stopped ? String.Empty : "un")}successfully.");
session.Log($"{Constants.CanonicalPackageName} stopped {(stopped ? String.Empty : "un")}successfully.");

return stopped
? ActionResult.Success
Expand Down Expand Up @@ -97,7 +92,7 @@ public static ActionResult ApplyProductionAppsettingsIfNonExistant(Session sessi
session.Log("Begin ApplyProductionAppsettingsIfNonExistant");
var programDataDirectory = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData),
CanonicalPackageName);
Constants.CanonicalPackageName);
var initialAppSettingsPath = Path.Combine(programDataDirectory, "appsettings.Initial.yml");
var productionAppSettingsPath = Path.Combine(programDataDirectory, "appsettings.Production.yml");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\..\src\Tgstation.Server.Common\Tgstation.Server.Common.csproj" />
<ProjectReference Include="..\..\..\..\src\Tgstation.Server.Host.Common\Tgstation.Server.Host.Common.csproj">
<Private>True</Private>
</ProjectReference>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
#if NETSTANDARD2_0_OR_GREATER
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading.Tasks;
Expand Down Expand Up @@ -155,3 +156,4 @@ public static async ValueTask WhenAll(IReadOnlyList<ValueTask> tasks)
public static ValueTask WhenAll(params ValueTask[] tasks) => WhenAll((IReadOnlyList<ValueTask>)tasks);
}
}
#endif
4 changes: 3 additions & 1 deletion src/Tgstation.Server.Common/Extensions/VersionExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
#if NETSTANDARD2_0_OR_GREATER
using System;

namespace Tgstation.Server.Common.Extensions
{
Expand All @@ -24,3 +25,4 @@ public static Version Semver(this Version version)
}
}
}
#endif
4 changes: 3 additions & 1 deletion src/Tgstation.Server.Common/Http/CachedResponseStream.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
#if NETSTANDARD2_0_OR_GREATER
using System;
using System.IO;
using System.Net.Http;
using System.Threading.Tasks;
Expand Down Expand Up @@ -105,3 +106,4 @@ protected override void Dispose(bool disposing)
}
}
}
#endif
4 changes: 3 additions & 1 deletion src/Tgstation.Server.Common/Http/HttpClient.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
#if NETSTANDARD2_0_OR_GREATER
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading;
Expand Down Expand Up @@ -49,3 +50,4 @@ public Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, HttpCompl
=> httpClient.SendAsync(request, completionOption, cancellationToken);
}
}
#endif
4 changes: 3 additions & 1 deletion src/Tgstation.Server.Common/Http/HttpClientFactory.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
#if NETSTANDARD2_0_OR_GREATER
using System;
using System.Net.Http.Headers;

namespace Tgstation.Server.Common.Http
Expand Down Expand Up @@ -39,3 +40,4 @@ public HttpClientFactory(ProductInfoHeaderValue userAgent)
}
}
}
#endif
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
namespace Tgstation.Server.Common.Http
#if NETSTANDARD2_0_OR_GREATER
namespace Tgstation.Server.Common.Http
{
/// <summary>
/// Creates <see cref="IHttpClient"/>s.
Expand All @@ -12,3 +13,4 @@ public interface IAbstractHttpClientFactory
IHttpClient CreateClient();
}
}
#endif
4 changes: 3 additions & 1 deletion src/Tgstation.Server.Common/Http/IHttpClient.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
#if NETSTANDARD2_0_OR_GREATER
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading;
Expand Down Expand Up @@ -31,3 +32,4 @@ public interface IHttpClient : IDisposable
Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken);
}
}
#endif
11 changes: 9 additions & 2 deletions src/Tgstation.Server.Common/Tgstation.Server.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
<Import Project="../../build/NugetCommon.props" />

<PropertyGroup>
<TargetFrameworks>$(TgsNugetNetFramework)</TargetFrameworks>
<TargetFrameworks>$(TgsNugetNetFramework);net2.0</TargetFrameworks>
<Version>$(TgsCommonLibraryVersion)</Version>
<Nullable>enable</Nullable>
<Description>Common functions for tgstation-server.</Description>
<PackageTags>web tgstation-server tgstation ss13 byond client http</PackageTags>
<PackageReleaseNotes>$(TGS_NUGET_RELEASE_NOTES_COMMON)</PackageReleaseNotes>
</PropertyGroup>

<ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' != 'net2.0'">
<!-- Usage: ValueTask netstandard backport -->
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.6.0" />
</ItemGroup>
Expand All @@ -24,4 +24,11 @@
<Message Text="Cleaning icons..." Importance="high" />
<Delete Files="../../artifacts/tgs.ico;../../artifacts/tgs.png" />
</Target>

<ItemGroup Condition="'$(TargetFramework)' == 'net2.022'">
<Compile Remove="Extensions\*.cs" />
<Compile Remove="Http\*.cs" />
<None Include="Extensions\*.cs" />
<None Include="Http\*.cs" />
</ItemGroup>
</Project>
33 changes: 0 additions & 33 deletions tgstation-server.sln
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ISSUE_TEMPLATE", "ISSUE_TEM
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tgstation.Server.Host.Tests.Signals", "tests\Tgstation.Server.Host.Tests.Signals\Tgstation.Server.Host.Tests.Signals.csproj", "{5813CC33-B16C-485D-A74D-20204DDF6542}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tgstation.Server.Migrator", "tools\Tgstation.Server.Migrator\Tgstation.Server.Migrator.csproj", "{CE499888-B22B-457C-891E-0EA9DC317228}"
ProjectSection(ProjectDependencies) = postProject
{07ED0FD5-E46B-4841-931D-BA2B673E16B2} = {07ED0FD5-E46B-4841-931D-BA2B673E16B2}
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tgstation.Server.Migrator.Comms", "tools\Tgstation.Server.Migrator.Comms\Tgstation.Server.Migrator.Comms.csproj", "{07ED0FD5-E46B-4841-931D-BA2B673E16B2}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tgstation.Server.Host.Common", "src\Tgstation.Server.Host.Common\Tgstation.Server.Host.Common.csproj", "{CF3968A0-EA81-4464-B2D4-C7D40F6B5BCB}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tgstation.Server.Common", "src\Tgstation.Server.Common\Tgstation.Server.Common.csproj", "{70CD9A98-D31A-44A4-81D1-D02764CEEEFD}"
Expand Down Expand Up @@ -448,30 +441,6 @@ Global
{5813CC33-B16C-485D-A74D-20204DDF6542}.ReleaseNoWindows|Any CPU.Build.0 = Release|Any CPU
{5813CC33-B16C-485D-A74D-20204DDF6542}.ReleaseNoWix|Any CPU.ActiveCfg = Release|Any CPU
{5813CC33-B16C-485D-A74D-20204DDF6542}.ReleaseNoWix|Any CPU.Build.0 = Release|Any CPU
{CE499888-B22B-457C-891E-0EA9DC317228}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CE499888-B22B-457C-891E-0EA9DC317228}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CE499888-B22B-457C-891E-0EA9DC317228}.DebugNoWindows|Any CPU.ActiveCfg = Debug|Any CPU
{CE499888-B22B-457C-891E-0EA9DC317228}.DebugNoWindows|Any CPU.Build.0 = Debug|Any CPU
{CE499888-B22B-457C-891E-0EA9DC317228}.DebugNoWix|Any CPU.ActiveCfg = Debug|Any CPU
{CE499888-B22B-457C-891E-0EA9DC317228}.DebugNoWix|Any CPU.Build.0 = Debug|Any CPU
{CE499888-B22B-457C-891E-0EA9DC317228}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CE499888-B22B-457C-891E-0EA9DC317228}.Release|Any CPU.Build.0 = Release|Any CPU
{CE499888-B22B-457C-891E-0EA9DC317228}.ReleaseNoWindows|Any CPU.ActiveCfg = Release|Any CPU
{CE499888-B22B-457C-891E-0EA9DC317228}.ReleaseNoWindows|Any CPU.Build.0 = Release|Any CPU
{CE499888-B22B-457C-891E-0EA9DC317228}.ReleaseNoWix|Any CPU.ActiveCfg = Release|Any CPU
{CE499888-B22B-457C-891E-0EA9DC317228}.ReleaseNoWix|Any CPU.Build.0 = Release|Any CPU
{07ED0FD5-E46B-4841-931D-BA2B673E16B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{07ED0FD5-E46B-4841-931D-BA2B673E16B2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{07ED0FD5-E46B-4841-931D-BA2B673E16B2}.DebugNoWindows|Any CPU.ActiveCfg = Debug|Any CPU
{07ED0FD5-E46B-4841-931D-BA2B673E16B2}.DebugNoWindows|Any CPU.Build.0 = Debug|Any CPU
{07ED0FD5-E46B-4841-931D-BA2B673E16B2}.DebugNoWix|Any CPU.ActiveCfg = Debug|Any CPU
{07ED0FD5-E46B-4841-931D-BA2B673E16B2}.DebugNoWix|Any CPU.Build.0 = Debug|Any CPU
{07ED0FD5-E46B-4841-931D-BA2B673E16B2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{07ED0FD5-E46B-4841-931D-BA2B673E16B2}.Release|Any CPU.Build.0 = Release|Any CPU
{07ED0FD5-E46B-4841-931D-BA2B673E16B2}.ReleaseNoWindows|Any CPU.ActiveCfg = Release|Any CPU
{07ED0FD5-E46B-4841-931D-BA2B673E16B2}.ReleaseNoWindows|Any CPU.Build.0 = Release|Any CPU
{07ED0FD5-E46B-4841-931D-BA2B673E16B2}.ReleaseNoWix|Any CPU.ActiveCfg = Release|Any CPU
{07ED0FD5-E46B-4841-931D-BA2B673E16B2}.ReleaseNoWix|Any CPU.Build.0 = Release|Any CPU
{CF3968A0-EA81-4464-B2D4-C7D40F6B5BCB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CF3968A0-EA81-4464-B2D4-C7D40F6B5BCB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CF3968A0-EA81-4464-B2D4-C7D40F6B5BCB}.DebugNoWindows|Any CPU.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -605,8 +574,6 @@ Global
{103C61AB-67D6-46FE-AA47-CC633B88EE0F} = {82066812-6C73-4360-943B-B23F2F491261}
{CFFD7992-E73A-4D1F-9D7A-C817C07B7BEB} = {E82104F4-F5C4-4786-ACD4-B635166CDB21}
{5813CC33-B16C-485D-A74D-20204DDF6542} = {316141B0-CD21-4769-A013-D53DA9B9EC09}
{CE499888-B22B-457C-891E-0EA9DC317228} = {A55C1117-5808-4AB2-BEA6-4D4A3E66A2F2}
{07ED0FD5-E46B-4841-931D-BA2B673E16B2} = {A55C1117-5808-4AB2-BEA6-4D4A3E66A2F2}
{2648A85F-61AE-428E-95E1-66D06C7A3768} = {6FF654E6-3E2C-46D4-872D-D528F77D6973}
{457A1F89-6201-4430-BCC6-2F4438A54B9E} = {2648A85F-61AE-428E-95E1-66D06C7A3768}
{08E7C650-A447-4DE2-974E-ED123B50F8D6} = {457A1F89-6201-4430-BCC6-2F4438A54B9E}
Expand Down
Loading

0 comments on commit eb137ad

Please sign in to comment.