Skip to content

Commit

Permalink
Dependency update / fixes / skrungle bungle (#23745)
Browse files Browse the repository at this point in the history
* Give .props files 2-space indents.

* Move to Central Package Management.

Allows us to store NuGet package versions all in one place. Yay!

* Update NuGet packages and fix code for changes.

Notable:

Changes to ILVerify.
Npgsql doesn't need hacks for inet anymore, now we need hacks to make the old code work with this new reality.
NUnit's analyzers are already complaining and I didn't even update it to 4.x yet.
TerraFX changed to GetLastSystemError so error handling had to be changed.
Buncha APIs have more NRT annotations.

* Remove dotnet-eng NuGet package source.

I genuinely don't know what this was for, and Central Package Management starts throwing warnings about it, so YEET.

* Remove Robust.Physics project.

Never used.

* Remove erroneous NVorbis reference.

Should be VorbisPizza and otherwise wasn't used.

* Sandbox fixes

* Remove unused unit test package references.

Castle.Core and NUnit.ConsoleRunner.

* Update NUnit to 4.0.1

This requires replacing all the old assertion methods because they removed them 🥲

* Oh so that's what dotnet-eng was used for. Yeah ok that makes sense.

* Add Robust.Analyzers.Test

* Update submodule

* commit to re-run CI

(cherry picked from commit a6c9c36)
  • Loading branch information
PJB3005 authored and DebugOk committed Jan 26, 2024
1 parent 54a9bea commit 1c54b75
Show file tree
Hide file tree
Showing 44 changed files with 265 additions and 292 deletions.
5 changes: 4 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,10 @@ dotnet_naming_symbols.type_parameters_symbols.applicable_kinds = type_parameter
resharper_braces_for_ifelse = required_for_multiline
resharper_keep_existing_attribute_arrangement = true

[*.{csproj,xml,yml,yaml,dll.config,msbuildproj,targets}]
[*.{csproj,xml,yml,yaml,dll.config,msbuildproj,targets,props}]
indent_size = 2

[nuget.config]
indent_size = 2

[{*.yaml,*.yml}]
Expand Down
2 changes: 1 addition & 1 deletion Content.Benchmarks/Content.Benchmarks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<LangVersion>12</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.1" />
<PackageReference Include="BenchmarkDotNet" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Content.Client\Content.Client.csproj" />
Expand Down
4 changes: 2 additions & 2 deletions Content.Client/Content.Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
<Platforms>AnyCPU</Platforms>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Nett" Version="0.15.0" />
<PackageReference Include="JetBrains.Annotations" Version="2022.1.0" PrivateAssets="All" />
<PackageReference Include="Nett" />
<PackageReference Include="JetBrains.Annotations" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\RobustToolbox\Lidgren.Network\Lidgren.Network.csproj" />
Expand Down
6 changes: 3 additions & 3 deletions Content.IntegrationTests/Content.IntegrationTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
<LangVersion>11</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
<PackageReference Include="NUnit" />
<PackageReference Include="NUnit3TestAdapter" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Content.Client\Content.Client.csproj" />
Expand Down
12 changes: 6 additions & 6 deletions Content.IntegrationTests/Pair/TestPair.Recycle.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#nullable enable
#nullable enable
using System.IO;
using System.Linq;
using Content.Server.GameTicking;
Expand Down Expand Up @@ -203,17 +203,17 @@ public void ValidateSettings(PoolSettings settings)

if (settings.InLobby)
{
Assert.Null(session.AttachedEntity);
Assert.That(session.AttachedEntity, Is.Null);
return;
}

Assert.NotNull(session.AttachedEntity);
Assert.That(session.AttachedEntity, Is.Not.Null);
Assert.That(entMan.EntityExists(session.AttachedEntity));
Assert.That(entMan.HasComponent<MindContainerComponent>(session.AttachedEntity));
var mindCont = entMan.GetComponent<MindContainerComponent>(session.AttachedEntity!.Value);
Assert.NotNull(mindCont.Mind);
Assert.True(entMan.TryGetComponent(mindCont.Mind, out MindComponent? mind));
Assert.Null(mind!.VisitingEntity);
Assert.That(mindCont.Mind, Is.Not.Null);
Assert.That(entMan.TryGetComponent(mindCont.Mind, out MindComponent? mind));
Assert.That(mind!.VisitingEntity, Is.Null);
Assert.That(mind.OwnedEntity, Is.EqualTo(session.AttachedEntity!.Value));
Assert.That(mind.UserId, Is.EqualTo(session.UserId));
}
Expand Down
4 changes: 2 additions & 2 deletions Content.IntegrationTests/PoolManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -337,10 +337,10 @@ private static void DieIfPoolFailure()
{
// If the _poolFailureReason is not null, we can assume at least one test failed.
// So we say inconclusive so we don't add more failed tests to search through.
Assert.Inconclusive(@"
Assert.Inconclusive(@$"
In a different test, the pool manager had an exception when trying to create a server/client pair.
Instead of risking that the pool manager will fail at creating a server/client pairs for every single test,
we are just going to end this here to save a lot of time. This is the exception that started this:\n {0}", _poolFailureReason);
we are just going to end this here to save a lot of time. This is the exception that started this:\n {_poolFailureReason}");
}

if (_dead)
Expand Down
6 changes: 3 additions & 3 deletions Content.IntegrationTests/Tests/Actions/ActionsAddedTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public async Task TestCombatActionsAdded()
var cActionSystem = client.System<SharedActionsSystem>();

// Dummy ticker is disabled - client should be in control of a normal mob.
Assert.NotNull(serverSession.AttachedEntity);
Assert.That(serverSession.AttachedEntity, Is.Not.Null);
var serverEnt = serverSession.AttachedEntity!.Value;
var clientEnt = clientSession!.AttachedEntity!.Value;
Assert.That(sEntMan.EntityExists(serverEnt));
Expand Down Expand Up @@ -57,8 +57,8 @@ public async Task TestCombatActionsAdded()
var sAct = sActions[0].Comp;
var cAct = cActions[0].Comp;

Assert.NotNull(sAct);
Assert.NotNull(cAct);
Assert.That(sAct, Is.Not.Null);
Assert.That(cAct, Is.Not.Null);

// Finally, these two actions are not the same object
// required, because integration tests do not respect the [NonSerialized] attribute and will simply events by reference.
Expand Down
2 changes: 1 addition & 1 deletion Content.IntegrationTests/Tests/Buckle/BuckleTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ await server.WaitAssertion(() =>
// Side effects of buckling for the strap
Assert.That(strap.BuckledEntities, Does.Contain(human));
Assert.That(strap.OccupiedSize, Is.EqualTo(buckle.Size));
Assert.Positive(strap.OccupiedSize);
Assert.That(strap.OccupiedSize, Is.Positive);
});

#pragma warning disable NUnit2045 // Interdependent asserts.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ await server.WaitAssertion(() =>

await server.WaitAssertion(() =>
{
CollectionAssert.AreEquivalent(deviceNetTestSystem.LastPayload, payload);
Assert.That(payload, Is.EquivalentTo(deviceNetTestSystem.LastPayload));
});
await pair.CleanReturnAsync();
}
Expand Down Expand Up @@ -170,7 +170,7 @@ await server.WaitAssertion(() =>

await server.WaitAssertion(() =>
{
CollectionAssert.AreEqual(deviceNetTestSystem.LastPayload, payload);
Assert.That(payload, Is.EqualTo(deviceNetTestSystem.LastPayload).AsCollection);

payload = new NetworkPayload
{
Expand All @@ -187,7 +187,7 @@ await server.WaitAssertion(() =>

await server.WaitAssertion(() =>
{
CollectionAssert.AreNotEqual(deviceNetTestSystem.LastPayload, payload);
Assert.That(payload, Is.Not.EqualTo(deviceNetTestSystem.LastPayload).AsCollection);
});

await pair.CleanReturnAsync();
Expand Down Expand Up @@ -270,7 +270,7 @@ await server.WaitAssertion(() =>

await server.WaitAssertion(() =>
{
CollectionAssert.AreEqual(deviceNetTestSystem.LastPayload, payload);
Assert.That(payload, Is.EqualTo(deviceNetTestSystem.LastPayload).AsCollection);
});

await pair.CleanReturnAsync();
Expand Down
10 changes: 5 additions & 5 deletions Content.IntegrationTests/Tests/Minds/GhostRoleTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ await server.WaitPost(() =>
Assert.That(session.AttachedEntity, Is.EqualTo(originalMob));
var originalMind = entMan.GetComponent<MindComponent>(originalMindId);
Assert.That(originalMind.OwnedEntity, Is.EqualTo(originalMob));
Assert.Null(originalMind.VisitingEntity);
Assert.That(originalMind.VisitingEntity, Is.Null);

// Use the ghost command
conHost.ExecuteCommand("ghost");
Expand Down Expand Up @@ -90,11 +90,11 @@ await server.WaitPost(() =>
Assert.That(newMindId, Is.Not.EqualTo(originalMindId));
Assert.That(session.AttachedEntity, Is.EqualTo(ghostRole));
Assert.That(newMind.OwnedEntity, Is.EqualTo(ghostRole));
Assert.Null(newMind.VisitingEntity);
Assert.That(newMind.VisitingEntity, Is.Null);

// Original mind should be unaffected, but the ghost will have deleted itself.
Assert.That(originalMind.OwnedEntity, Is.EqualTo(originalMob));
Assert.Null(originalMind.VisitingEntity);
Assert.That(originalMind.VisitingEntity, Is.Null);
Assert.That(entMan.Deleted(ghost));

// Ghost again.
Expand All @@ -113,11 +113,11 @@ await server.WaitPost(() =>
await pair.RunTicksSync(10);
Assert.That(session.AttachedEntity, Is.EqualTo(originalMob));
Assert.That(originalMind.OwnedEntity, Is.EqualTo(originalMob));
Assert.Null(originalMind.VisitingEntity);
Assert.That(originalMind.VisitingEntity, Is.Null);

// the ghost-role mind is unaffected, though the ghost will have deleted itself
Assert.That(newMind.OwnedEntity, Is.EqualTo(ghostRole));
Assert.Null(newMind.VisitingEntity);
Assert.That(newMind.VisitingEntity, Is.Null);
Assert.That(entMan.Deleted(otherGhost));

await pair.CleanReturnAsync();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ public async Task DeleteAllThenGhost()
await pair.RunTicksSync(5);

// Client is not attached to anything
Assert.Null(pair.Client.Player?.ControlledEntity);
Assert.Null(pair.PlayerData?.Mind);
Assert.That(pair.Client.Player?.ControlledEntity, Is.Null);
Assert.That(pair.PlayerData?.Mind, Is.Null);

// Attempt to ghost
var cConHost = pair.Client.ResolveDependency<IConsoleHost>();
Expand Down
10 changes: 5 additions & 5 deletions Content.IntegrationTests/Tests/Minds/MindTests.ReconnectTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Linq;
using System.Linq;
using Content.Shared.Ghost;
using Content.Shared.Mind;
using Robust.Server.Player;
Expand Down Expand Up @@ -127,7 +127,7 @@ public async Task TestVisitingReconnect()
var mindSys = entMan.System<SharedMindSystem>();
var mind = GetMind(pair);

Assert.Null(mind.Comp.VisitingEntity);
Assert.That(mind.Comp.VisitingEntity, Is.Null);

// Make player visit a new mob
var original = mind.Comp.OwnedEntity;
Expand Down Expand Up @@ -165,8 +165,8 @@ public async Task TestReconnect()
await using var pair = await SetupPair();
var mind = GetMind(pair);

Assert.Null(mind.Comp.VisitingEntity);
Assert.NotNull(mind.Comp.OwnedEntity);
Assert.That(mind.Comp.VisitingEntity, Is.Null);
Assert.That(mind.Comp.OwnedEntity, Is.Not.Null);
var entity = mind.Comp.OwnedEntity;

await pair.RunTicksSync(5);
Expand All @@ -175,7 +175,7 @@ public async Task TestReconnect()

var newMind = GetMind(pair);

Assert.Null(newMind.Comp.VisitingEntity);
Assert.That(newMind.Comp.VisitingEntity, Is.Null);
Assert.That(newMind.Comp.OwnedEntity, Is.EqualTo(entity));
Assert.That(newMind.Id, Is.EqualTo(mind.Id));

Expand Down
2 changes: 1 addition & 1 deletion Content.IntegrationTests/Tests/PostMapInitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ public async Task AllMapsTested()

Assert.That(gameMaps.Remove(PoolManager.TestMap));

CollectionAssert.AreEquivalent(GameMaps.ToHashSet(), gameMaps, "Game map prototype missing from test cases.");
Assert.That(gameMaps, Is.EquivalentTo(GameMaps.ToHashSet()), "Game map prototype missing from test cases.");

await pair.CleanReturnAsync();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public async Task TestUserDoesNotExist()
var pair = await PoolManager.GetServerClient();
var db = GetDb(pair.Server);
// Database should be empty so a new GUID should do it.
Assert.Null(await db.GetPlayerPreferencesAsync(NewUserId()));
Assert.That(await db.GetPlayerPreferencesAsync(NewUserId()), Is.Null);

await pair.CleanReturnAsync();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public async Task SerializeGenericEnums()

var node = seriMan.WriteValue(value, notNullableOverride:true);
var valueNode = node as ValueDataNode;
Assert.NotNull(valueNode);
Assert.That(valueNode, Is.Not.Null);

var expected = refMan.GetEnumReference(value);
Assert.That(valueNode!.Value, Is.EqualTo(expected));
Expand Down
4 changes: 2 additions & 2 deletions Content.IntegrationTests/Tests/Toolshed/ToolshedTest.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#nullable enable
#nullable enable
using System.Collections.Generic;
using Content.IntegrationTests.Pair;
using Content.Server.Administration.Managers;
Expand Down Expand Up @@ -38,7 +38,7 @@ public async Task TearDownInternal()

protected virtual async Task TearDown()
{
Assert.IsEmpty(_expectedErrors);
Assert.That(_expectedErrors, Is.Empty);
ClearErrors();
}

Expand Down
4 changes: 2 additions & 2 deletions Content.MapRenderer/Content.MapRenderer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="SixLabors.ImageSharp" Version="2.1.3" />
<PackageReference Include="NUnit" />
<PackageReference Include="SixLabors.ImageSharp" />
</ItemGroup>

<Import Project="..\RobustToolbox\MSBuild\Robust.Properties.targets" />
Expand Down
2 changes: 1 addition & 1 deletion Content.MapRenderer/Painters/EntityPainter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public void Run(Image canvas, EntityData entity, SharedTransformSystem xformSyst
var (x, y, width, height) = GetRsiFrame(rsi, image, entity, layer, dir);

var rect = new Rectangle(x, y, width, height);
if (!new Rectangle(Point.Empty, image.Size()).Contains(rect))
if (!new Rectangle(Point.Empty, image.Size).Contains(rect))
{
Console.WriteLine($"Invalid layer {rsi!.Path}/{layer.RsiState.Name}.png for entity {_sEntityManager.ToPrettyString(entity.Owner)} at ({entity.X}, {entity.Y})");
return;
Expand Down
3 changes: 0 additions & 3 deletions Content.Packaging/Content.Packaging.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
<ServerGarbageCollection>True</ServerGarbageCollection>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NVorbis" Version="0.10.5" PrivateAssets="compile" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\RobustToolbox\Robust.Packaging\Robust.Packaging.csproj" />
</ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion Content.PatreonParser/Content.PatreonParser.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CsvHelper" Version="30.0.1" />
<PackageReference Include="CsvHelper" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions Content.Replay/Content.Replay.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Nett" Version="0.15.0" />
<PackageReference Include="JetBrains.Annotations" Version="2020.1.0" PrivateAssets="All" />
<PackageReference Include="Nett" />
<PackageReference Include="JetBrains.Annotations" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\RobustToolbox\Lidgren.Network\Lidgren.Network.csproj" />
Expand Down
12 changes: 6 additions & 6 deletions Content.Server.Database/Content.Server.Database.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<!-- Work around https://github.com/dotnet/project-system/issues/4314 -->
<TargetFramework>$(TargetFramework)</TargetFramework>
Expand All @@ -12,16 +12,16 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.4">
<PackageReference Include="Microsoft.EntityFrameworkCore.Design">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="7.0.4" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" />

<!-- Necessary at design time -->
<PackageReference Include="SQLitePCLRaw.provider.e_sqlite3" Version="2.1.4" Condition="'$(UseSystemSqlite)' != 'True' and '$(Configuration)' != 'Release'" />
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.1.4" Condition="'$(UseSystemSqlite)' != 'True' and '$(Configuration)' != 'Release'" />
<PackageReference Include="SQLitePCLRaw.provider.sqlite3" Condition="'$(UseSystemSqlite)' == 'True' and '$(Configuration)' != 'Release'" />
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Condition="'$(UseSystemSqlite)' != 'True' and '$(Configuration)' != 'Release'" />
</ItemGroup>

<ItemGroup>
Expand Down
8 changes: 4 additions & 4 deletions Content.Server.Database/Model.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Text.Json;
using Content.Shared.Database;
using Microsoft.EntityFrameworkCore;
using NpgsqlTypes;

namespace Content.Server.Database
{
Expand Down Expand Up @@ -550,7 +551,7 @@ public interface IBanCommon<TUnban> where TUnban : IUnbanCommon
{
int Id { get; set; }
Guid? PlayerUserId { get; set; }
(IPAddress, int)? Address { get; set; }
NpgsqlInet? Address { get; set; }
byte[]? HWId { get; set; }
DateTime BanTime { get; set; }
DateTime? ExpirationTime { get; set; }
Expand Down Expand Up @@ -618,8 +619,7 @@ public class ServerBan : IBanCommon<ServerUnban>
/// <summary>
/// CIDR IP address range of the ban. The whole range can match the ban.
/// </summary>
[Column(TypeName = "inet")]
public (IPAddress, int)? Address { get; set; }
public NpgsqlInet? Address { get; set; }

/// <summary>
/// Hardware ID of the banned player.
Expand Down Expand Up @@ -808,7 +808,7 @@ public sealed class ServerRoleBan : IBanCommon<ServerRoleUnban>
public Round? Round { get; set; }
public Guid? PlayerUserId { get; set; }
[Required] public TimeSpan PlaytimeAtNote { get; set; }
[Column(TypeName = "inet")] public (IPAddress, int)? Address { get; set; }
public NpgsqlInet? Address { get; set; }
public byte[]? HWId { get; set; }

public DateTime BanTime { get; set; }
Expand Down
Loading

0 comments on commit 1c54b75

Please sign in to comment.