From d72a49c0d8d394d3167b78468bc6714907d32e8a Mon Sep 17 00:00:00 2001 From: raul Date: Thu, 12 Oct 2023 20:53:15 +0200 Subject: [PATCH] Completely stripped away `ZipDevScriptProcessor` from release builds --- Carbon.Core/Carbon.Components/Carbon.Common | 2 +- Carbon.Core/Carbon.Components/Carbon.Compat | 2 +- Carbon.Core/Carbon/src/Community.cs | 7 ++++++- Carbon.Core/Carbon/src/Loaders/ScriptLoader.cs | 7 +++++-- Carbon.Core/Carbon/src/Processors/ZipDevScriptProcessor.cs | 4 +++- 5 files changed, 16 insertions(+), 6 deletions(-) diff --git a/Carbon.Core/Carbon.Components/Carbon.Common b/Carbon.Core/Carbon.Components/Carbon.Common index 5cf675cbe..369d4bc3f 160000 --- a/Carbon.Core/Carbon.Components/Carbon.Common +++ b/Carbon.Core/Carbon.Components/Carbon.Common @@ -1 +1 @@ -Subproject commit 5cf675cbeec1377f062e4f6d5bced3f8d3c31406 +Subproject commit 369d4bc3f2ee39d3443a17d47df7f724cf39995f diff --git a/Carbon.Core/Carbon.Components/Carbon.Compat b/Carbon.Core/Carbon.Components/Carbon.Compat index 9ef4caca2..1727b3e3c 160000 --- a/Carbon.Core/Carbon.Components/Carbon.Compat +++ b/Carbon.Core/Carbon.Components/Carbon.Compat @@ -1 +1 @@ -Subproject commit 9ef4caca291907ccc27674939762c643498e51cf +Subproject commit 1727b3e3c277785c5c0e0915990b159aada6121b diff --git a/Carbon.Core/Carbon/src/Community.cs b/Carbon.Core/Carbon/src/Community.cs index f0cf352db..d6e57dbe2 100644 --- a/Carbon.Core/Carbon/src/Community.cs +++ b/Carbon.Core/Carbon/src/Community.cs @@ -79,7 +79,9 @@ internal void _installProcessors() ScriptProcessor = gameObject.AddComponent(); WebScriptProcessor = gameObject.AddComponent(); ZipScriptProcessor = gameObject.AddComponent(); +#if DEBUG ZipDevScriptProcessor = gameObject.AddComponent(); +#endif CarbonProcessor = gameObject.AddComponent(); HookManager = gameObject.AddComponent(); ModuleProcessor = new ModuleProcessor(); @@ -94,7 +96,9 @@ internal void _registerProcessors() if (ScriptProcessor != null) ScriptProcessor?.Start(); if (WebScriptProcessor != null) WebScriptProcessor?.Start(); if (ZipScriptProcessor != null) ZipScriptProcessor?.Start(); +#if DEBUG if (ZipDevScriptProcessor != null) ZipDevScriptProcessor?.Start(); +#endif if (ScriptProcessor != null) ScriptProcessor.InvokeRepeating(() => { RefreshConsoleInfo(); }, 1f, 1f); Carbon.Logger.Log("Registered processors"); @@ -108,8 +112,9 @@ internal void _uninstallProcessors() if (ScriptProcessor != null) ScriptProcessor?.Dispose(); if (WebScriptProcessor != null) WebScriptProcessor?.Dispose(); if (ZipScriptProcessor != null) ZipScriptProcessor?.Dispose(); +#if DEBUG if (ZipDevScriptProcessor != null) ZipDevScriptProcessor?.Dispose(); - +#endif if (ModuleProcessor != null) ModuleProcessor?.Dispose(); if (CarbonProcessor != null) CarbonProcessor?.Dispose(); } diff --git a/Carbon.Core/Carbon/src/Loaders/ScriptLoader.cs b/Carbon.Core/Carbon/src/Loaders/ScriptLoader.cs index 643f4cbc5..ee941ec85 100644 --- a/Carbon.Core/Carbon/src/Loaders/ScriptLoader.cs +++ b/Carbon.Core/Carbon/src/Loaders/ScriptLoader.cs @@ -71,11 +71,14 @@ public static void LoadAll() var extensionPlugins = OsEx.Folder.GetFilesWithExtension(Defines.GetExtensionsFolder(), "cs"); var plugins = OsEx.Folder.GetFilesWithExtension(Defines.GetScriptFolder(), "cs", option: config.ScriptWatcherOption); var zipPlugins = OsEx.Folder.GetFilesWithExtension(Defines.GetScriptFolder(), "cszip", option: config.ScriptWatcherOption); - var zipDevPlugins = OsEx.Folder.GetFilesWithExtension(Defines.GetZipDevFolder(), "cs", option: SearchOption.AllDirectories); + ExecuteProcess(Community.Runtime.ScriptProcessor, false, extensionPlugins, plugins); ExecuteProcess(Community.Runtime.ZipScriptProcessor, false, zipPlugins); - ExecuteProcess(Community.Runtime.ZipDevScriptProcessor, true, zipDevPlugins); +#if DEBUG + var zipDevPlugins = OsEx.Folder.GetFilesWithExtension(Defines.GetZipDevFolder(), "cs", option: SearchOption.AllDirectories); + ExecuteProcess(Community.Runtime.ZipDevScriptProcessor, true, zipDevPlugins); +#endif void ExecuteProcess(IScriptProcessor processor, bool folderMode, params string[][] folders) { processor.Clear(); diff --git a/Carbon.Core/Carbon/src/Processors/ZipDevScriptProcessor.cs b/Carbon.Core/Carbon/src/Processors/ZipDevScriptProcessor.cs index ce9776f7b..f57e06905 100644 --- a/Carbon.Core/Carbon/src/Processors/ZipDevScriptProcessor.cs +++ b/Carbon.Core/Carbon/src/Processors/ZipDevScriptProcessor.cs @@ -1,4 +1,5 @@ -using System; +#if DEBUG +using System; using System.Collections; using System.IO; using System.IO.Compression; @@ -246,3 +247,4 @@ public override void Process(string file, string input, out string output) } } } +#endif