From dfc4894c8b6f19ca43907c0b11f198dfc41e457c Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Wed, 8 Jan 2025 02:19:27 +0100 Subject: [PATCH] Dependencies update & cleanup (#5590) * Dependencies update & cleanup Fixes security vuln warnings etc * Remove ILReader dependency RIP in piss FastAccessors. --- Directory.Packages.props | 87 ++++++++++--------- Robust.Analyzers.Tests/AccessAnalyzer_Test.cs | 8 +- .../DataDefinitionAnalyzerTest.cs | 5 +- .../DependencyAssignAnalyzerTest.cs | 5 +- .../DuplicateDependencyAnalyzerTest.cs | 5 +- .../MustCallBaseAnalyzerTest.cs | 5 +- .../NoUncachedRegexAnalyzerTest.cs | 5 +- .../PreferNonGenericVariantForTest.cs | 5 +- .../PreferOtherTypeAnalyzerTest.cs | 5 +- .../PreferOtherTypeFixerTest.cs | 5 +- .../Robust.Analyzers.Tests.csproj | 10 ++- Robust.Benchmarks/Robust.Benchmarks.csproj | 4 + .../XamlUiPartialClassGenerator.cs | 3 + Robust.Client/Robust.Client.csproj | 5 +- Robust.Server/Robust.Server.csproj | 4 + .../ComponentNetworkGenerator.cs | 3 + Robust.Shared.Scripting/ILCommand.cs | 8 +- .../Robust.Shared.Scripting.csproj | 4 +- .../ContentPack/AssemblyTypeChecker.cs | 6 +- Robust.Shared/Robust.Shared.csproj | 4 + .../Serialization/Markdown/NodeMark.cs | 3 +- 21 files changed, 104 insertions(+), 85 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index d5d38d218..0cc0f54e1 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -10,66 +10,69 @@ - + - - - + + - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - + + + + + + + + + - - - - + + + + - + - + - - - + + + - + - - - - + - - + + - + + + + + + + + diff --git a/Robust.Analyzers.Tests/AccessAnalyzer_Test.cs b/Robust.Analyzers.Tests/AccessAnalyzer_Test.cs index ab6e46111..9a8a8ccb8 100644 --- a/Robust.Analyzers.Tests/AccessAnalyzer_Test.cs +++ b/Robust.Analyzers.Tests/AccessAnalyzer_Test.cs @@ -1,12 +1,8 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.CSharp.Testing; using Microsoft.CodeAnalysis.Testing; -using Microsoft.CodeAnalysis.Testing.Verifiers; using NUnit.Framework; -using Robust.Analyzers; - -using VerifyCS = Microsoft.CodeAnalysis.CSharp.Testing.NUnit.AnalyzerVerifier; -using static Microsoft.CodeAnalysis.Testing.DiagnosticResult; +using VerifyCS = Microsoft.CodeAnalysis.CSharp.Testing.CSharpAnalyzerVerifier; namespace Robust.Analyzers.Tests; @@ -16,7 +12,7 @@ public sealed class AccessAnalyzer_Test { public Task Verifier(string code, params DiagnosticResult[] expected) { - var test = new CSharpAnalyzerTest() + var test = new CSharpAnalyzerTest() { TestState = { diff --git a/Robust.Analyzers.Tests/DataDefinitionAnalyzerTest.cs b/Robust.Analyzers.Tests/DataDefinitionAnalyzerTest.cs index ec16b0f25..d684340f1 100644 --- a/Robust.Analyzers.Tests/DataDefinitionAnalyzerTest.cs +++ b/Robust.Analyzers.Tests/DataDefinitionAnalyzerTest.cs @@ -1,10 +1,9 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.CSharp.Testing; using Microsoft.CodeAnalysis.Testing; -using Microsoft.CodeAnalysis.Testing.Verifiers; using NUnit.Framework; using VerifyCS = - Microsoft.CodeAnalysis.CSharp.Testing.NUnit.AnalyzerVerifier; + Microsoft.CodeAnalysis.CSharp.Testing.CSharpAnalyzerVerifier; namespace Robust.Analyzers.Tests; @@ -14,7 +13,7 @@ public sealed class DataDefinitionAnalyzerTest { private static Task Verifier(string code, params DiagnosticResult[] expected) { - var test = new CSharpAnalyzerTest() + var test = new CSharpAnalyzerTest() { TestState = { diff --git a/Robust.Analyzers.Tests/DependencyAssignAnalyzerTest.cs b/Robust.Analyzers.Tests/DependencyAssignAnalyzerTest.cs index f55a2cf65..c9c981ebf 100644 --- a/Robust.Analyzers.Tests/DependencyAssignAnalyzerTest.cs +++ b/Robust.Analyzers.Tests/DependencyAssignAnalyzerTest.cs @@ -1,10 +1,9 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.CSharp.Testing; using Microsoft.CodeAnalysis.Testing; -using Microsoft.CodeAnalysis.Testing.Verifiers; using NUnit.Framework; using VerifyCS = - Microsoft.CodeAnalysis.CSharp.Testing.NUnit.AnalyzerVerifier; + Microsoft.CodeAnalysis.CSharp.Testing.CSharpAnalyzerVerifier; namespace Robust.Analyzers.Tests; @@ -14,7 +13,7 @@ public sealed class DependencyAssignAnalyzerTest { private static Task Verifier(string code, params DiagnosticResult[] expected) { - var test = new CSharpAnalyzerTest() + var test = new CSharpAnalyzerTest() { TestState = { diff --git a/Robust.Analyzers.Tests/DuplicateDependencyAnalyzerTest.cs b/Robust.Analyzers.Tests/DuplicateDependencyAnalyzerTest.cs index 94d801cd4..5da90dd67 100644 --- a/Robust.Analyzers.Tests/DuplicateDependencyAnalyzerTest.cs +++ b/Robust.Analyzers.Tests/DuplicateDependencyAnalyzerTest.cs @@ -1,10 +1,9 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.CSharp.Testing; using Microsoft.CodeAnalysis.Testing; -using Microsoft.CodeAnalysis.Testing.Verifiers; using NUnit.Framework; using VerifyCS = - Microsoft.CodeAnalysis.CSharp.Testing.NUnit.AnalyzerVerifier; + Microsoft.CodeAnalysis.CSharp.Testing.CSharpAnalyzerVerifier; namespace Robust.Analyzers.Tests; @@ -15,7 +14,7 @@ public sealed class DuplicateDependencyAnalyzerTest { private static Task Verifier(string code, params DiagnosticResult[] expected) { - var test = new CSharpAnalyzerTest() + var test = new CSharpAnalyzerTest() { TestState = { diff --git a/Robust.Analyzers.Tests/MustCallBaseAnalyzerTest.cs b/Robust.Analyzers.Tests/MustCallBaseAnalyzerTest.cs index 96e6a5567..b017cf9e3 100644 --- a/Robust.Analyzers.Tests/MustCallBaseAnalyzerTest.cs +++ b/Robust.Analyzers.Tests/MustCallBaseAnalyzerTest.cs @@ -1,10 +1,9 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.CSharp.Testing; using Microsoft.CodeAnalysis.Testing; -using Microsoft.CodeAnalysis.Testing.Verifiers; using NUnit.Framework; using VerifyCS = - Microsoft.CodeAnalysis.CSharp.Testing.NUnit.AnalyzerVerifier; + Microsoft.CodeAnalysis.CSharp.Testing.CSharpAnalyzerVerifier; namespace Robust.Analyzers.Tests; @@ -14,7 +13,7 @@ public sealed class MustCallBaseAnalyzerTest { private static Task Verifier(string code, params DiagnosticResult[] expected) { - var test = new CSharpAnalyzerTest() + var test = new CSharpAnalyzerTest() { TestState = { diff --git a/Robust.Analyzers.Tests/NoUncachedRegexAnalyzerTest.cs b/Robust.Analyzers.Tests/NoUncachedRegexAnalyzerTest.cs index ab4c6b68b..5f946eca7 100644 --- a/Robust.Analyzers.Tests/NoUncachedRegexAnalyzerTest.cs +++ b/Robust.Analyzers.Tests/NoUncachedRegexAnalyzerTest.cs @@ -1,10 +1,9 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.CSharp.Testing; using Microsoft.CodeAnalysis.Testing; -using Microsoft.CodeAnalysis.Testing.Verifiers; using NUnit.Framework; using VerifyCS = - Microsoft.CodeAnalysis.CSharp.Testing.NUnit.AnalyzerVerifier; + Microsoft.CodeAnalysis.CSharp.Testing.CSharpAnalyzerVerifier; namespace Robust.Analyzers.Tests; @@ -14,7 +13,7 @@ public sealed class NoUncachedRegexAnalyzerTest { private static Task Verifier(string code, params DiagnosticResult[] expected) { - var test = new CSharpAnalyzerTest() + var test = new CSharpAnalyzerTest() { TestState = { diff --git a/Robust.Analyzers.Tests/PreferNonGenericVariantForTest.cs b/Robust.Analyzers.Tests/PreferNonGenericVariantForTest.cs index 2d8e4d5c5..b16f647c0 100644 --- a/Robust.Analyzers.Tests/PreferNonGenericVariantForTest.cs +++ b/Robust.Analyzers.Tests/PreferNonGenericVariantForTest.cs @@ -1,10 +1,9 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.CSharp.Testing; using Microsoft.CodeAnalysis.Testing; -using Microsoft.CodeAnalysis.Testing.Verifiers; using NUnit.Framework; using VerifyCS = - Microsoft.CodeAnalysis.CSharp.Testing.NUnit.AnalyzerVerifier; + Microsoft.CodeAnalysis.CSharp.Testing.CSharpAnalyzerVerifier; namespace Robust.Analyzers.Tests; @@ -14,7 +13,7 @@ public sealed class PreferNonGenericVariantForTest { private static Task Verifier(string code, params DiagnosticResult[] expected) { - var test = new CSharpAnalyzerTest() + var test = new CSharpAnalyzerTest() { TestState = { diff --git a/Robust.Analyzers.Tests/PreferOtherTypeAnalyzerTest.cs b/Robust.Analyzers.Tests/PreferOtherTypeAnalyzerTest.cs index f774c0f37..862d3f90e 100644 --- a/Robust.Analyzers.Tests/PreferOtherTypeAnalyzerTest.cs +++ b/Robust.Analyzers.Tests/PreferOtherTypeAnalyzerTest.cs @@ -1,10 +1,9 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.CSharp.Testing; using Microsoft.CodeAnalysis.Testing; -using Microsoft.CodeAnalysis.Testing.Verifiers; using NUnit.Framework; using VerifyCS = - Microsoft.CodeAnalysis.CSharp.Testing.NUnit.AnalyzerVerifier; + Microsoft.CodeAnalysis.CSharp.Testing.CSharpAnalyzerVerifier; namespace Robust.Analyzers.Tests; @@ -14,7 +13,7 @@ public sealed class PreferOtherTypeAnalyzerTest { private static Task Verifier(string code, params DiagnosticResult[] expected) { - var test = new CSharpAnalyzerTest() + var test = new CSharpAnalyzerTest() { TestState = { diff --git a/Robust.Analyzers.Tests/PreferOtherTypeFixerTest.cs b/Robust.Analyzers.Tests/PreferOtherTypeFixerTest.cs index b475c51bd..4b56878cf 100644 --- a/Robust.Analyzers.Tests/PreferOtherTypeFixerTest.cs +++ b/Robust.Analyzers.Tests/PreferOtherTypeFixerTest.cs @@ -1,10 +1,9 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.CSharp.Testing; using Microsoft.CodeAnalysis.Testing; -using Microsoft.CodeAnalysis.Testing.Verifiers; using NUnit.Framework; using VerifyCS = - Microsoft.CodeAnalysis.CSharp.Testing.NUnit.AnalyzerVerifier; + Microsoft.CodeAnalysis.CSharp.Testing.CSharpAnalyzerVerifier; namespace Robust.Analyzers.Tests; @@ -12,7 +11,7 @@ public sealed class PreferOtherTypeFixerTest { private static Task Verifier(string code, string fixedCode, params DiagnosticResult[] expected) { - var test = new CSharpCodeFixTest() + var test = new CSharpCodeFixTest() { TestState = { diff --git a/Robust.Analyzers.Tests/Robust.Analyzers.Tests.csproj b/Robust.Analyzers.Tests/Robust.Analyzers.Tests.csproj index 3eb6b7c1e..7cfb0d681 100644 --- a/Robust.Analyzers.Tests/Robust.Analyzers.Tests.csproj +++ b/Robust.Analyzers.Tests/Robust.Analyzers.Tests.csproj @@ -27,13 +27,17 @@ - - - + + + + + + + diff --git a/Robust.Benchmarks/Robust.Benchmarks.csproj b/Robust.Benchmarks/Robust.Benchmarks.csproj index d394cf53e..99f07a48d 100644 --- a/Robust.Benchmarks/Robust.Benchmarks.csproj +++ b/Robust.Benchmarks/Robust.Benchmarks.csproj @@ -19,6 +19,10 @@ all + + + + diff --git a/Robust.Client.NameGenerator/XamlUiPartialClassGenerator.cs b/Robust.Client.NameGenerator/XamlUiPartialClassGenerator.cs index 6eb544679..5c5e07333 100644 --- a/Robust.Client.NameGenerator/XamlUiPartialClassGenerator.cs +++ b/Robust.Client.NameGenerator/XamlUiPartialClassGenerator.cs @@ -15,6 +15,9 @@ using XamlX.Transform; using XamlX.Transform.Transformers; using XamlX.TypeSystem; +// Yes dude I know this source generator isn't incremental, I'll fix it eventually. +#pragma warning disable RS1035 + namespace Robust.Client.NameGenerator { /// diff --git a/Robust.Client/Robust.Client.csproj b/Robust.Client/Robust.Client.csproj index 9cc646e67..a16652ce6 100644 --- a/Robust.Client/Robust.Client.csproj +++ b/Robust.Client/Robust.Client.csproj @@ -21,12 +21,15 @@ - + + + + diff --git a/Robust.Server/Robust.Server.csproj b/Robust.Server/Robust.Server.csproj index 8787a0bff..71f64692c 100644 --- a/Robust.Server/Robust.Server.csproj +++ b/Robust.Server/Robust.Server.csproj @@ -31,6 +31,10 @@ + + + + diff --git a/Robust.Shared.CompNetworkGenerator/ComponentNetworkGenerator.cs b/Robust.Shared.CompNetworkGenerator/ComponentNetworkGenerator.cs index bc8f173a7..3f51e6cee 100644 --- a/Robust.Shared.CompNetworkGenerator/ComponentNetworkGenerator.cs +++ b/Robust.Shared.CompNetworkGenerator/ComponentNetworkGenerator.cs @@ -6,6 +6,9 @@ using Microsoft.CodeAnalysis.Text; using static Microsoft.CodeAnalysis.SymbolDisplayFormat; using static Microsoft.CodeAnalysis.SymbolDisplayMiscellaneousOptions; +// Yes dude I know this source generator isn't incremental, I'll fix it eventually. +#pragma warning disable RS1035 + namespace Robust.Shared.CompNetworkGenerator { [Generator] diff --git a/Robust.Shared.Scripting/ILCommand.cs b/Robust.Shared.Scripting/ILCommand.cs index 4d25cbd7e..20a6da330 100644 --- a/Robust.Shared.Scripting/ILCommand.cs +++ b/Robust.Shared.Scripting/ILCommand.cs @@ -1,13 +1,12 @@ -using System.Reflection; -using ILReader; -using ILReader.Readers; -using Robust.Shared.Toolshed; +using Robust.Shared.Toolshed; namespace Robust.Shared.Scripting; [ToolshedCommand] public sealed class ILCommand : ToolshedCommand { + // Disabled due to relying on external dependency ILReader. + /* [CommandImplementation("dumpil")] public void DumpIL( IInvocationContext ctx, @@ -30,5 +29,6 @@ public sealed class ILCommand : ToolshedCommand IILReaderConfiguration cfg = ILReader.Configuration.Resolve(method); return cfg.GetReader(method); } + */ } diff --git a/Robust.Shared.Scripting/Robust.Shared.Scripting.csproj b/Robust.Shared.Scripting/Robust.Shared.Scripting.csproj index 571a8af49..db95bfeb2 100644 --- a/Robust.Shared.Scripting/Robust.Shared.Scripting.csproj +++ b/Robust.Shared.Scripting/Robust.Shared.Scripting.csproj @@ -7,11 +7,13 @@ - + + + diff --git a/Robust.Shared/ContentPack/AssemblyTypeChecker.cs b/Robust.Shared/ContentPack/AssemblyTypeChecker.cs index e00ba9f9c..e96d2c024 100644 --- a/Robust.Shared/ContentPack/AssemblyTypeChecker.cs +++ b/Robust.Shared/ContentPack/AssemblyTypeChecker.cs @@ -244,7 +244,7 @@ namespace Robust.Shared.ContentPack Parallel.ForEach(partitioner.GetPartitions(Environment.ProcessorCount), handle => { var ver = new Verifier(resolver); - ver.SetSystemModuleName(new AssemblyName(SystemAssemblyName)); + ver.SetSystemModuleName(new AssemblyNameInfo(SystemAssemblyName)); while (handle.MoveNext()) { foreach (var result in ver.Verify(peReader, handle.Current, verifyMethods: true)) @@ -926,12 +926,12 @@ namespace Robust.Shared.ContentPack return null; } - public PEReader? ResolveAssembly(AssemblyName assemblyName) + public PEReader? ResolveAssembly(AssemblyNameInfo assemblyName) { return _dictionary.GetOrAdd(assemblyName.Name!, ResolveCore); } - public PEReader? ResolveModule(AssemblyName referencingAssembly, string fileName) + public PEReader? ResolveModule(AssemblyNameInfo referencingAssembly, string fileName) { throw new NotSupportedException(); } diff --git a/Robust.Shared/Robust.Shared.csproj b/Robust.Shared/Robust.Shared.csproj index 333cbd5a9..b6f11c450 100644 --- a/Robust.Shared/Robust.Shared.csproj +++ b/Robust.Shared/Robust.Shared.csproj @@ -24,6 +24,10 @@ + + + + diff --git a/Robust.Shared/Serialization/Markdown/NodeMark.cs b/Robust.Shared/Serialization/Markdown/NodeMark.cs index 525f5112e..bdf23185d 100644 --- a/Robust.Shared/Serialization/Markdown/NodeMark.cs +++ b/Robust.Shared/Serialization/Markdown/NodeMark.cs @@ -13,7 +13,8 @@ namespace Robust.Shared.Serialization.Markdown Column = column; } - public NodeMark(Mark mark) : this(mark.Line, mark.Column) + // TODO: Make Line/Column longs + public NodeMark(Mark mark) : this((int)mark.Line, (int)mark.Column) { }