mirror of
https://github.com/space-wizards/space-station-14.git
synced 2026-02-14 19:29:53 +01:00
* Content.Packaging can now emit binlogs for the build I was checking why packaging is so much slower and it *seems* to be entirely the actual build being twice as slow as before .NET 10. Strange. Content.Packaging can now emit MSBuild binlogs that we can analyze to see why that's the case. * Enable --log-build on Test Packaging workflow, produce artifact with binlogs * Disable setup-dotnet in packaging workflow I have a suspicion...
98 lines
3.0 KiB
C#
98 lines
3.0 KiB
C#
using System.Diagnostics;
|
|
using System.IO.Compression;
|
|
using Robust.Packaging;
|
|
using Robust.Packaging.AssetProcessing;
|
|
using Robust.Packaging.AssetProcessing.Passes;
|
|
using Robust.Packaging.Utility;
|
|
using Robust.Shared.Timing;
|
|
|
|
namespace Content.Packaging;
|
|
|
|
public static class ClientPackaging
|
|
{
|
|
/// <summary>
|
|
/// Be advised this can be called from server packaging during a HybridACZ build.
|
|
/// </summary>
|
|
public static async Task PackageClient(bool skipBuild, bool logBuild, string configuration, IPackageLogger logger)
|
|
{
|
|
logger.Info("Building client...");
|
|
|
|
if (!skipBuild)
|
|
{
|
|
var startInfo = new ProcessStartInfo
|
|
{
|
|
FileName = "dotnet",
|
|
ArgumentList =
|
|
{
|
|
"build",
|
|
Path.Combine("Content.Client", "Content.Client.csproj"),
|
|
"-c", configuration,
|
|
"--nologo",
|
|
"/v:m",
|
|
"/t:Rebuild",
|
|
"/p:FullRelease=true",
|
|
"/m"
|
|
}
|
|
};
|
|
|
|
if (logBuild)
|
|
{
|
|
startInfo.ArgumentList.Add($"/bl:{Path.Combine("release", "client.binlog")}");
|
|
startInfo.ArgumentList.Add("/p:ReportAnalyzer=true");
|
|
}
|
|
|
|
await ProcessHelpers.RunCheck(startInfo);
|
|
}
|
|
|
|
logger.Info("Packaging client...");
|
|
|
|
var sw = RStopwatch.StartNew();
|
|
{
|
|
await using var zipFile =
|
|
File.Open(Path.Combine("release", "SS14.Client.zip"), FileMode.Create, FileAccess.ReadWrite);
|
|
using var zip = new ZipArchive(zipFile, ZipArchiveMode.Update);
|
|
var writer = new AssetPassZipWriter(zip);
|
|
|
|
await WriteResources("", writer, logger, default);
|
|
await writer.FinishedTask;
|
|
}
|
|
|
|
logger.Info($"Finished packaging client in {sw.Elapsed}");
|
|
}
|
|
|
|
public static async Task WriteResources(
|
|
string contentDir,
|
|
AssetPass pass,
|
|
IPackageLogger logger,
|
|
CancellationToken cancel)
|
|
{
|
|
var graph = new RobustClientAssetGraph();
|
|
pass.Dependencies.Add(new AssetPassDependency(graph.Output.Name));
|
|
|
|
var dropSvgPass = new AssetPassFilterDrop(f => f.Path.EndsWith(".svg"))
|
|
{
|
|
Name = "DropSvgPass",
|
|
};
|
|
dropSvgPass.AddDependency(graph.Input).AddBefore(graph.PresetPasses);
|
|
|
|
AssetGraph.CalculateGraph([pass, dropSvgPass, ..graph.AllPasses], logger);
|
|
|
|
var inputPass = graph.Input;
|
|
|
|
await RobustSharedPackaging.WriteContentAssemblies(
|
|
inputPass,
|
|
contentDir,
|
|
"Content.Client",
|
|
new[] { "Content.Client", "Content.Shared", "Content.Shared.Database" },
|
|
cancel: cancel);
|
|
|
|
await RobustClientPackaging.WriteClientResources(
|
|
contentDir,
|
|
inputPass,
|
|
SharedPackaging.AdditionalIgnoredResources,
|
|
cancel);
|
|
|
|
inputPass.InjectFinished();
|
|
}
|
|
}
|