From 1a18c7f6d36cd882afe135dad95e754ead72fcc2 Mon Sep 17 00:00:00 2001 From: Lokilife Date: Thu, 1 Aug 2024 23:09:53 +0300 Subject: [PATCH] Presenting EXODUS secrets --- .gitignore | 7 ++- Content.Client/Content.Client.csproj | 1 + Content.Packaging/ClientPackaging.cs | 50 ++++++++++++++++++- Content.Packaging/ServerPackaging.cs | 31 ++++++++++++ Content.Server/Content.Server.csproj | 1 + .../Content.Exodus.Interfaces.Client.csproj | 13 +++++ .../Content.Exodus.Interfaces.Server.csproj | 13 +++++ .../Content.Exodus.Interfaces.Shared.csproj | 10 ++++ SpaceStation14.sln | 42 ++++++++++++++-- 9 files changed, 158 insertions(+), 10 deletions(-) create mode 100644 Exodus/Content.Exodus.Interfaces.Client/Content.Exodus.Interfaces.Client.csproj create mode 100644 Exodus/Content.Exodus.Interfaces.Server/Content.Exodus.Interfaces.Server.csproj create mode 100644 Exodus/Content.Exodus.Interfaces.Shared/Content.Exodus.Interfaces.Shared.csproj diff --git a/.gitignore b/.gitignore index df4947fd4b..026abde1cd 100644 --- a/.gitignore +++ b/.gitignore @@ -12,10 +12,9 @@ # Secret Secrets -Resources/Prototypes/CorvaxSecrets -Resources/Prototypes/CorvaxSecretsServer -Resources/Textures/CorvaxSecrets -Resources/Locale/ru-RU/corvax-secrets +Resources/Prototypes/ExodusSecrets +Resources/Textures/ExodusSecrets +Resources/Locale/ru-RU/exodus-secrets # Build results [Dd]ebug/ diff --git a/Content.Client/Content.Client.csproj b/Content.Client/Content.Client.csproj index 956f2fd035..1306e9addb 100644 --- a/Content.Client/Content.Client.csproj +++ b/Content.Client/Content.Client.csproj @@ -22,6 +22,7 @@ + diff --git a/Content.Packaging/ClientPackaging.cs b/Content.Packaging/ClientPackaging.cs index a66d4ec5b9..bf20fab9c9 100644 --- a/Content.Packaging/ClientPackaging.cs +++ b/Content.Packaging/ClientPackaging.cs @@ -10,6 +10,7 @@ namespace Content.Packaging; public static class ClientPackaging { + private static readonly bool UseSecrets = File.Exists(Path.Combine("Exodus", "ExodusSecrets.sln")); // Exodus-Secrets /// /// Be advised this can be called from server packaging during a HybridACZ build. /// @@ -34,6 +35,26 @@ await ProcessHelpers.RunCheck(new ProcessStartInfo "/m" } }); + // Exodus-Secrets-Start + if (UseSecrets) + { + await ProcessHelpers.RunCheck(new ProcessStartInfo + { + FileName = "dotnet", + ArgumentList = + { + "build", + Path.Combine("Secrets","Content.Exodus.Client", "Content.Exodus.Client.csproj"), + "-c", "Release", + "--nologo", + "/v:m", + "/t:Rebuild", + "/p:FullRelease=true", + "/m" + } + }); + } + // Exodus-Secrets-End } logger.Info("Packaging client..."); @@ -65,15 +86,42 @@ public static async Task WriteResources( var inputPass = graph.Input; + // Exodus-Secrets-Start: Add Corvax interfaces to Magic ACZ + var assemblies = new List { "Content.Client", "Content.Shared", "Content.Shared.Database", "Content.Exodus.Interfaces.Client", "Content.Exodus.Interfaces.Shared" }; + if (UseSecrets) + assemblies.AddRange(["Content.Exodus.Shared", "Content.Exodus.Client"]); + // Exodus-Secrets-End + await RobustSharedPackaging.WriteContentAssemblies( inputPass, contentDir, "Content.Client", - new[] { "Content.Client", "Content.Shared", "Content.Shared.Database" }, + assemblies, // Exodus-Secrets cancel: cancel); + await WriteClientResources(contentDir, pass, cancel); // Exodus-Secrets: Support content resource ignore to ignore server-only prototypes + await RobustClientPackaging.WriteClientResources(contentDir, pass, cancel); inputPass.InjectFinished(); } + + // Exodus-Secrets-Start + public static IReadOnlySet ContentClientIgnoredResources { get; } = new HashSet + { + "ExodusSecretsServer" + }; + + private static async Task WriteClientResources( + string contentDir, + AssetPass pass, + CancellationToken cancel = default) + { + var ignoreSet = RobustClientPackaging.ClientIgnoredResources + .Union(RobustSharedPackaging.SharedIgnoredResources) + .Union(ContentClientIgnoredResources).ToHashSet(); + + await RobustSharedPackaging.DoResourceCopy(Path.Combine(contentDir, "Resources"), pass, ignoreSet, cancel: cancel); + } + // Exodus-Secrets-End } diff --git a/Content.Packaging/ServerPackaging.cs b/Content.Packaging/ServerPackaging.cs index d9ca57c4d1..f6a13c1713 100644 --- a/Content.Packaging/ServerPackaging.cs +++ b/Content.Packaging/ServerPackaging.cs @@ -33,6 +33,10 @@ public static class ServerPackaging private static readonly List ServerContentAssemblies = new() { + // Exodus-Secrets-Start + "Content.Exodus.Interfaces.Shared", + "Content.Exodus.Interfaces.Server", + // Exodus-Secrets-End "Content.Server.Database", "Content.Server", "Content.Shared", @@ -69,6 +73,7 @@ public static class ServerPackaging "zh-Hant" }; + private static readonly bool UseSecrets = File.Exists(Path.Combine("Secrets", "ExodusSecrets.sln")); // Exodus-Secrets public static async Task PackageServer(bool skipBuild, bool hybridAcz, IPackageLogger logger, string configuration, List? platforms = null) { if (platforms == null) @@ -117,6 +122,28 @@ await ProcessHelpers.RunCheck(new ProcessStartInfo "/m" } }); + // Exodus-Secrets-Start + if (UseSecrets) + { + logger.Info($"Secrets found. Building secret project for {platform}..."); + await ProcessHelpers.RunCheck(new ProcessStartInfo + { + FileName = "dotnet", + ArgumentList = + { + "build", + Path.Combine("Secrets","Content.Exodus.Server", "Content.Exodus.Server.csproj"), + "-c", "Release", + "--nologo", + "/v:m", + $"/p:TargetOs={platform.TargetOs}", + "/t:Rebuild", + "/p:FullRelease=true", + "/m" + } + }); + } + // Exodus-Secrets-End await PublishClientServer(platform.Rid, platform.TargetOs, configuration); } @@ -175,6 +202,10 @@ private static async Task WriteServerResources( var inputPassCore = graph.InputCore; var inputPassResources = graph.InputResources; var contentAssemblies = new List(ServerContentAssemblies); + // Exodus-Secrets-Start + if (UseSecrets) + contentAssemblies.AddRange(["Content.Exodus.Shared", "Content.Exodus.Server"]); + // Exodus-Secrets-End // Additional assemblies that need to be copied such as EFCore. var sourcePath = Path.Combine(contentDir, "bin", "Content.Server"); diff --git a/Content.Server/Content.Server.csproj b/Content.Server/Content.Server.csproj index 70e404fdef..c41c4bd1ea 100644 --- a/Content.Server/Content.Server.csproj +++ b/Content.Server/Content.Server.csproj @@ -25,6 +25,7 @@ + diff --git a/Exodus/Content.Exodus.Interfaces.Client/Content.Exodus.Interfaces.Client.csproj b/Exodus/Content.Exodus.Interfaces.Client/Content.Exodus.Interfaces.Client.csproj new file mode 100644 index 0000000000..87053f20ee --- /dev/null +++ b/Exodus/Content.Exodus.Interfaces.Client/Content.Exodus.Interfaces.Client.csproj @@ -0,0 +1,13 @@ + + + net8.0 + enable + enable + + + + false + + + + diff --git a/Exodus/Content.Exodus.Interfaces.Server/Content.Exodus.Interfaces.Server.csproj b/Exodus/Content.Exodus.Interfaces.Server/Content.Exodus.Interfaces.Server.csproj new file mode 100644 index 0000000000..6c583ebef5 --- /dev/null +++ b/Exodus/Content.Exodus.Interfaces.Server/Content.Exodus.Interfaces.Server.csproj @@ -0,0 +1,13 @@ + + + net8.0 + enable + enable + + + + false + + + + diff --git a/Exodus/Content.Exodus.Interfaces.Shared/Content.Exodus.Interfaces.Shared.csproj b/Exodus/Content.Exodus.Interfaces.Shared/Content.Exodus.Interfaces.Shared.csproj new file mode 100644 index 0000000000..312aad436d --- /dev/null +++ b/Exodus/Content.Exodus.Interfaces.Shared/Content.Exodus.Interfaces.Shared.csproj @@ -0,0 +1,10 @@ + + + net8.0 + enable + enable + + + + + diff --git a/SpaceStation14.sln b/SpaceStation14.sln index 76c338da06..8278580e40 100644 --- a/SpaceStation14.sln +++ b/SpaceStation14.sln @@ -135,6 +135,14 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Roslyn", "Roslyn", "{7844DA RobustToolbox\Robust.Roslyn.Shared\Robust.Roslyn.Shared.props = RobustToolbox\Robust.Roslyn.Shared\Robust.Roslyn.Shared.props EndProjectSection EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Exodus", "Exodus", "{3A6F6EA7-C7CB-401C-ADAA-A176C09CB063}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Content.Exodus.Interfaces.Client", "Exodus\Content.Exodus.Interfaces.Client\Content.Exodus.Interfaces.Client.csproj", "{C47BA283-2900-431E-A31A-1FAB639A5BDC}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Content.Exodus.Interfaces.Shared", "Exodus\Content.Exodus.Interfaces.Shared\Content.Exodus.Interfaces.Shared.csproj", "{FC64C642-7FC2-4263-950D-858F4D37706C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Content.Exodus.Interfaces.Server", "Exodus\Content.Exodus.Interfaces.Server\Content.Exodus.Interfaces.Server.csproj", "{4FB4F181-B718-4221-B9E9-1C603DA4408A}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -454,6 +462,30 @@ Global {6D63F2DA-D300-4439-89C4-9EB744D0E47C}.Release|Any CPU.Build.0 = Release|Any CPU {6D63F2DA-D300-4439-89C4-9EB744D0E47C}.Tools|Any CPU.ActiveCfg = Debug|Any CPU {6D63F2DA-D300-4439-89C4-9EB744D0E47C}.Tools|Any CPU.Build.0 = Debug|Any CPU + {C47BA283-2900-431E-A31A-1FAB639A5BDC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C47BA283-2900-431E-A31A-1FAB639A5BDC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C47BA283-2900-431E-A31A-1FAB639A5BDC}.DebugOpt|Any CPU.ActiveCfg = Debug|Any CPU + {C47BA283-2900-431E-A31A-1FAB639A5BDC}.DebugOpt|Any CPU.Build.0 = Debug|Any CPU + {C47BA283-2900-431E-A31A-1FAB639A5BDC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C47BA283-2900-431E-A31A-1FAB639A5BDC}.Release|Any CPU.Build.0 = Release|Any CPU + {C47BA283-2900-431E-A31A-1FAB639A5BDC}.Tools|Any CPU.ActiveCfg = Debug|Any CPU + {C47BA283-2900-431E-A31A-1FAB639A5BDC}.Tools|Any CPU.Build.0 = Debug|Any CPU + {FC64C642-7FC2-4263-950D-858F4D37706C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FC64C642-7FC2-4263-950D-858F4D37706C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FC64C642-7FC2-4263-950D-858F4D37706C}.DebugOpt|Any CPU.ActiveCfg = Debug|Any CPU + {FC64C642-7FC2-4263-950D-858F4D37706C}.DebugOpt|Any CPU.Build.0 = Debug|Any CPU + {FC64C642-7FC2-4263-950D-858F4D37706C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FC64C642-7FC2-4263-950D-858F4D37706C}.Release|Any CPU.Build.0 = Release|Any CPU + {FC64C642-7FC2-4263-950D-858F4D37706C}.Tools|Any CPU.ActiveCfg = Debug|Any CPU + {FC64C642-7FC2-4263-950D-858F4D37706C}.Tools|Any CPU.Build.0 = Debug|Any CPU + {4FB4F181-B718-4221-B9E9-1C603DA4408A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4FB4F181-B718-4221-B9E9-1C603DA4408A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4FB4F181-B718-4221-B9E9-1C603DA4408A}.DebugOpt|Any CPU.ActiveCfg = Debug|Any CPU + {4FB4F181-B718-4221-B9E9-1C603DA4408A}.DebugOpt|Any CPU.Build.0 = Debug|Any CPU + {4FB4F181-B718-4221-B9E9-1C603DA4408A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4FB4F181-B718-4221-B9E9-1C603DA4408A}.Release|Any CPU.Build.0 = Release|Any CPU + {4FB4F181-B718-4221-B9E9-1C603DA4408A}.Tools|Any CPU.ActiveCfg = Debug|Any CPU + {4FB4F181-B718-4221-B9E9-1C603DA4408A}.Tools|Any CPU.Build.0 = Debug|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -482,13 +514,13 @@ Global {A965CB3B-FD31-44AF-8872-85ABA436098D} = {83B4CBBA-547A-42F0-A7CD-8A67D93196CE} {7844DA69-B0F0-49FB-A05E-ECA37372277A} = {83B4CBBA-547A-42F0-A7CD-8A67D93196CE} {3CFEB7DB-12C6-46F3-89FC-1450F3016FFA} = {7844DA69-B0F0-49FB-A05E-ECA37372277A} - {6FBF108E-5CB5-47DE-8D7E-B496ABA9E3E2} = {7844DA69-B0F0-49FB-A05E-ECA37372277A} - {07CA34A1-1D37-4771-A2E3-495A1044AE0B} = {7844DA69-B0F0-49FB-A05E-ECA37372277A} - {88B0FC0F-7209-40E2-AF16-EB90AF727C5B} = {7844DA69-B0F0-49FB-A05E-ECA37372277A} - {83F510FE-9B50-4D96-AFAB-CC13998D6AFE} = {7844DA69-B0F0-49FB-A05E-ECA37372277A} - {07CA34A1-1D37-4771-A2E3-495A1044AE0B} = {83B4CBBA-547A-42F0-A7CD-8A67D93196CE} {6FBF108E-5CB5-47DE-8D7E-B496ABA9E3E2} = {83B4CBBA-547A-42F0-A7CD-8A67D93196CE} + {07CA34A1-1D37-4771-A2E3-495A1044AE0B} = {83B4CBBA-547A-42F0-A7CD-8A67D93196CE} + {88B0FC0F-7209-40E2-AF16-EB90AF727C5B} = {7844DA69-B0F0-49FB-A05E-ECA37372277A} {83F510FE-9B50-4D96-AFAB-CC13998D6AFE} = {83B4CBBA-547A-42F0-A7CD-8A67D93196CE} + {C47BA283-2900-431E-A31A-1FAB639A5BDC} = {3A6F6EA7-C7CB-401C-ADAA-A176C09CB063} + {FC64C642-7FC2-4263-950D-858F4D37706C} = {3A6F6EA7-C7CB-401C-ADAA-A176C09CB063} + {4FB4F181-B718-4221-B9E9-1C603DA4408A} = {3A6F6EA7-C7CB-401C-ADAA-A176C09CB063} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {AA37ED9F-F8D6-468E-A101-658AD605B09A}