From 96222d80e4216d8df4f98e865eb180fc3942fcba Mon Sep 17 00:00:00 2001 From: Jordan Dominion Date: Fri, 20 Oct 2023 16:42:08 -0400 Subject: [PATCH] Switch to new packager --- .../Components/Engine/OpenDreamInstaller.cs | 89 +++++++------------ 1 file changed, 30 insertions(+), 59 deletions(-) diff --git a/src/Tgstation.Server.Host/Components/Engine/OpenDreamInstaller.cs b/src/Tgstation.Server.Host/Components/Engine/OpenDreamInstaller.cs index 81734db3d51..1e6f89226a3 100644 --- a/src/Tgstation.Server.Host/Components/Engine/OpenDreamInstaller.cs +++ b/src/Tgstation.Server.Host/Components/Engine/OpenDreamInstaller.cs @@ -31,7 +31,7 @@ class OpenDreamInstaller : EngineInstallerBase /// /// The OD server directory name. /// - const string ServerDir = "Content.Server"; + const string ServerDir = "server"; /// /// The name of the subdirectory in an installation's used to store the compiler binaries. @@ -216,15 +216,16 @@ public override async ValueTask Install(EngineVersion version, string installPat var dotnetPath = dotnetPaths[selectedPathIndex]; - // TODO: https://github.com/OpenDreamProject/OpenDream/issues/1495 + const string DeployDir = "tgs_deploy"; int? buildExitCode = null; await HandleExtremelyLongPathOperation( async shortenedPath => { + var shortenedDeployPath = IOManager.ConcatPath(shortenedPath, DeployDir); await using var buildProcess = ProcessExecutor.LaunchProcess( dotnetPath, shortenedPath, - "build -c Release /p:TgsEngineBuild=true", + $"run -c Release --project OpenDreamPackageTool -- --tgs -o {shortenedDeployPath}", null, true, true); @@ -241,68 +242,38 @@ await HandleExtremelyLongPathOperation( if (buildExitCode != 0) throw new JobException("OpenDream build failed!"); - async ValueTask MoveBinFiles() + var deployPath = IOManager.ConcatPath(sourcePath, DeployDir); + async ValueTask MoveDirs() { - var installBinPath = IOManager.ConcatPath(installPath, BinDir); - - await IOManager.CreateDirectory(installBinPath, cancellationToken); - - var serverMoveTask = IOManager.MoveDirectory( - IOManager.ConcatPath( - sourcePath, - BinDir, - ServerDir), - IOManager.ConcatPath( - installBinPath, - ServerDir), - cancellationToken); - - var compilerMoveTask = IOManager.MoveDirectory( - IOManager.ConcatPath( - sourcePath, - BinDir, - "DMCompiler"), - IOManager.ConcatPath( - installBinPath, - InstallationCompilerDirectory), - cancellationToken); - - await Task.WhenAll(serverMoveTask, compilerMoveTask); + var dirs = await IOManager.GetDirectories(deployPath, cancellationToken); + await Task.WhenAll( + dirs.Select( + dir => IOManager.MoveDirectory( + IOManager.ConcatPath( + deployPath, + dir), + IOManager.ConcatPath( + installPath, + dir), + cancellationToken))); } - async ValueTask MoveResources() + async ValueTask MoveFiles() { - const string RobustDir = "RobustToolbox"; - const string ResourcesDir = "Resources"; - - var rootMoveTask = IOManager.MoveDirectory( - IOManager.ConcatPath( - sourcePath, - ResourcesDir), - IOManager.ConcatPath( - installPath, - ResourcesDir), - cancellationToken); - var installRobustDir = IOManager.ConcatPath(installPath, RobustDir); - - await IOManager.CreateDirectory(installRobustDir, cancellationToken); - var robustMoveTask = IOManager.MoveDirectory( - IOManager.ConcatPath( - sourcePath, - RobustDir, - ResourcesDir), - IOManager.ConcatPath( - installRobustDir, - ResourcesDir), - cancellationToken); - - await Task.WhenAll(rootMoveTask, robustMoveTask); + var files = await IOManager.GetFiles(deployPath, cancellationToken); + await Task.WhenAll( + files.Select( + file => IOManager.MoveFile( + IOManager.ConcatPath( + deployPath, + file), + IOManager.ConcatPath( + installPath, + file), + cancellationToken))); } - var binSetupTask = MoveBinFiles(); - var resourcesMoveTask = MoveResources(); - - await ValueTaskExtensions.WhenAll(binSetupTask, resourcesMoveTask); + await ValueTaskExtensions.WhenAll(MoveDirs(), MoveFiles()); await IOManager.DeleteDirectory(sourcePath, cancellationToken); }