From 0a7e3d0fa7aebf460cf3726c443e66768f59ff29 Mon Sep 17 00:00:00 2001 From: Emma Date: Fri, 16 Oct 2026 14:18:48 -0400 Subject: [PATCH] fix: Exclude unreleated binaries from our standards checks --- .../Runtime/Components/Helpers/UnifiedBootstrap.cs | 10 +++++----- .../netcode.standards/ExcludeGenerators.targets | 7 +++++++ dotnet-tools/netcode.standards/Program.cs | 1 + .../netcode.standards/netcode.standards.csproj | 6 +++++- 4 files changed, 18 insertions(+), 6 deletions(-) create mode 100644 dotnet-tools/netcode.standards/ExcludeGenerators.targets diff --git a/com.unity.netcode.gameobjects/Runtime/Components/Helpers/UnifiedBootstrap.cs b/com.unity.netcode.gameobjects/Runtime/Components/Helpers/UnifiedBootstrap.cs index 47297d30b4..cce0bdd989 100644 --- a/com.unity.netcode.gameobjects/Runtime/Components/Helpers/UnifiedBootstrap.cs +++ b/com.unity.netcode.gameobjects/Runtime/Components/Helpers/UnifiedBootstrap.cs @@ -29,16 +29,16 @@ internal class UnifiedBootstrap : ClientServerBootstrap // Every ClientServerBootstrap constructor clears N4E's ServerWorlds and ClientWorlds, and each NetworkManager // creates its own bootstrap, so the worlds created for other NetworkManagers are registered again. - private static readonly List s_CreatedWorlds = new List(); + private static readonly List k_CreatedWorlds = new List(); private static void RegisterCreatedWorlds() { - for (int i = s_CreatedWorlds.Count - 1; i >= 0; i--) + for (int i = k_CreatedWorlds.Count - 1; i >= 0; i--) { - var world = s_CreatedWorlds[i]; + var world = k_CreatedWorlds[i]; if (!world.IsCreated) { - s_CreatedWorlds.RemoveAt(i); + k_CreatedWorlds.RemoveAt(i); continue; } // A single world host is registered as both a server and a client world, the same as N4E does. @@ -94,7 +94,7 @@ public override bool Initialize(string defaultWorldName) } networkManager.NetcodeWorld = (NetcodeWorld)world; - s_CreatedWorlds.Add(networkManager.NetcodeWorld); + k_CreatedWorlds.Add(networkManager.NetcodeWorld); } else { diff --git a/dotnet-tools/netcode.standards/ExcludeGenerators.targets b/dotnet-tools/netcode.standards/ExcludeGenerators.targets new file mode 100644 index 0000000000..4ed1380127 --- /dev/null +++ b/dotnet-tools/netcode.standards/ExcludeGenerators.targets @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dotnet-tools/netcode.standards/Program.cs b/dotnet-tools/netcode.standards/Program.cs index f2f9ef41d1..ecc5384016 100644 --- a/dotnet-tools/netcode.standards/Program.cs +++ b/dotnet-tools/netcode.standards/Program.cs @@ -33,6 +33,7 @@ private static int Main( foreach (var file in Directory.GetFiles(project, pattern)) { var procInfo = new ProcessStartInfo("dotnet"); + procInfo.Environment["CustomAfterMicrosoftCommonTargets"] = Path.Combine(AppContext.BaseDirectory, "ExcludeGenerators.targets"); procInfo.Arguments = check ? $"format whitespace {file} --no-restore --verify-no-changes --verbosity {verbosity}" diff --git a/dotnet-tools/netcode.standards/netcode.standards.csproj b/dotnet-tools/netcode.standards/netcode.standards.csproj index ece14dcc49..66836e2507 100644 --- a/dotnet-tools/netcode.standards/netcode.standards.csproj +++ b/dotnet-tools/netcode.standards/netcode.standards.csproj @@ -12,4 +12,8 @@ - \ No newline at end of file + + + + +