Refactor MSBuild spaghetti, new configurations. (#3807)

This commit is contained in:
Pieter-Jan Briers
2023-03-06 20:12:08 +01:00
committed by GitHub
parent fb3c783fc4
commit 23fd4e1843
34 changed files with 191 additions and 169 deletions

View File

@@ -1,3 +1,3 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\MSBuild\Robust.Properties.targets" />
<Import Project="..\MSBuild\Robust.Engine.props" />
</Project>

View File

@@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<AssemblyName>SpaceWizards.Lidgren.Network</AssemblyName>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
@@ -9,6 +8,8 @@
<DefaultItemExcludes>Lidgren.Network/**/*</DefaultItemExcludes>
<DefineConstants>$(DefineConstants);USE_RELEASE_STATISTICS</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<SkipRobustAnalyzer>true</SkipRobustAnalyzer>
</PropertyGroup>
<ItemGroup>
@@ -18,4 +19,5 @@
<Compile Remove="Lidgren.Network\Lidgren.Network\obj\**\*.cs" />
</ItemGroup>
<Import Project="../MSBuild/Robust.Properties.targets" />
</Project>

View File

@@ -0,0 +1,37 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Build configurations -->
<PropertyGroup>
<!-- Avoid SDK defining DEBUG/RELEASE/DEBUGOPT/TOOLS itself. -->
<DisableImplicitConfigurationDefines>true</DisableImplicitConfigurationDefines>
<!-- Project configurations -->
<Configurations>Debug;Release;Tools;DebugOpt</Configurations>
<Platforms>AnyCPU</Platforms>
</PropertyGroup>
<!-- Debug configuration: asserts, tools, no optimizations -->
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<DebugSymbols Condition="'$(DebugSymbols)' == ''">true</DebugSymbols>
<Optimize Condition="'$(Optimize)' == ''">false</Optimize>
<RobustToolsBuild Condition="'$(RobustToolsBuild)' == ''">true</RobustToolsBuild>
<DefineConstants>DEBUG;$(DefineConstants)</DefineConstants>
</PropertyGroup>
<!-- DebugOpt configuration: asserts, tools, optimizations -->
<PropertyGroup Condition="'$(Configuration)' == 'DebugOpt'">
<DebugSymbols Condition="'$(DebugSymbols)' == ''">true</DebugSymbols>
<Optimize Condition="'$(Optimize)' == ''">true</Optimize>
<RobustToolsBuild Condition="'$(RobustToolsBuild)' == ''">true</RobustToolsBuild>
<DefineConstants>DEBUG;$(DefineConstants)</DefineConstants>
</PropertyGroup>
<!-- Tools configuration: no asserts, tools, optimizations -->
<PropertyGroup Condition="'$(Configuration)' == 'Tools'">
<DebugSymbols Condition="'$(DebugSymbols)' == ''">true</DebugSymbols>
<Optimize Condition="'$(Optimize)' == ''">true</Optimize>
<RobustToolsBuild Condition="'$(RobustToolsBuild)' == ''">true</RobustToolsBuild>
</PropertyGroup>
<!-- Release configuration: no asserts, no tools, optimizations -->
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<Optimize Condition="'$(Optimize)' == ''">true</Optimize>
<RobustToolsBuild Condition="'$(RobustToolsBuild)' == ''">false</RobustToolsBuild>
<DefineConstants>RELEASE;$(DefineConstants)</DefineConstants>
</PropertyGroup>
</Project>

View File

@@ -32,4 +32,7 @@
<PropertyGroup Condition="'$(UseSystemSqlite)' == 'True'">
<DefineConstants>$(DefineConstants);USE_SYSTEM_SQLITE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(RobustToolsBuild)' == 'true'">
<DefineConstants>$(DefineConstants);TOOLS</DefineConstants>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,35 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- MSBuild hurts and I can't find a foolproof way to detect platform. -->
<PropertyGroup>
<OS Condition="'$(OS)' == ''">Windows_NT</OS>
</PropertyGroup>
<Choose>
<When Condition="'$(OS)' != 'Unix'">
<PropertyGroup>
<ActualOS>Windows</ActualOS>
</PropertyGroup>
</When>
<!-- Folders that *probably* only exist on MacOS and not Linux. -->
<When Condition="Exists('/Volumes') And Exists('/System') And Exists('/Library')" >
<PropertyGroup>
<ActualOS>MacOS</ActualOS>
</PropertyGroup>
</When>
<When Condition="$([MSBuild]::IsOSPlatform('FreeBSD'))">
<PropertyGroup>
<ActualOS>FreeBSD</ActualOS>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<ActualOS>Linux</ActualOS>
</PropertyGroup>
</Otherwise>
</Choose>
<PropertyGroup>
<TargetOS Condition="'$(TargetOS)' == ''">$(ActualOS)</TargetOS>
<Python>python3</Python>
<Python Condition="'$(ActualOS)' == 'Windows'">py -3</Python>
<UseSystemSqlite Condition="'$(TargetOS)' == 'FreeBSD'">True</UseSystemSqlite>
</PropertyGroup>
</Project>

View File

@@ -1,40 +1,28 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
<Import Project="Robust.Custom.targets" Condition="Exists('Robust.Custom.targets')"/>
<!-- MSBuild hurts and I can't find a foolproof way to detect platform. -->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Properties for both engine and content. -->
<!-- Import this at the end of any project files in Robust and Content. -->
<PropertyGroup>
<OS Condition="'$(OS)' == ''">Windows_NT</OS>
</PropertyGroup>
<Choose>
<When Condition="'$(OS)' != 'Unix'">
<PropertyGroup>
<ActualOS>Windows</ActualOS>
</PropertyGroup>
</When>
<!-- Folders that *probably* only exist on MacOS and not Linux. -->
<When Condition="Exists('/Volumes') And Exists('/System') And Exists('/Library')" >
<PropertyGroup>
<ActualOS>MacOS</ActualOS>
</PropertyGroup>
</When>
<When Condition="$([MSBuild]::IsOSPlatform('FreeBSD'))">
<PropertyGroup>
<ActualOS>FreeBSD</ActualOS>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<ActualOS>Linux</ActualOS>
</PropertyGroup>
</Otherwise>
</Choose>
<PropertyGroup>
<TargetOS Condition="'$(TargetOS)' == ''">$(ActualOS)</TargetOS>
<Python>python3</Python>
<Python Condition="'$(ActualOS)' == 'Windows'">py -3</Python>
<TargetFramework>net7.0</TargetFramework>
<EnableClientScripting>True</EnableClientScripting>
<!-- Client scripting is disabled on full release builds for security and size reasons. -->
<EnableClientScripting Condition="'$(FullRelease)' == 'True'">False</EnableClientScripting>
<UseSystemSqlite Condition="'$(TargetOS)' == 'FreeBSD'">True</UseSystemSqlite>
</PropertyGroup>
<Import Project="Robust.Custom.targets" Condition="Exists('Robust.Custom.targets')"/>
<!-- Configuration logic -->
<Import Project="Robust.Configurations.props" />
<!-- Some platform management logic -->
<Import Project="Robust.Platform.props" />
<PropertyGroup>
<EnableClientScripting>False</EnableClientScripting>
<!-- Client scripting is only enabled on tools builds for security and size reasons. -->
<EnableClientScripting Condition="'$(RobustToolsBuild)' == 'true'">True</EnableClientScripting>
</PropertyGroup>
<!-- built-in define constants -->
<Import Project="Robust.DefineConstants.targets" />
<!-- analyzer -->
<Import Project="Robust.Analyzers.targets" Condition="'$(SkipRobustAnalyzer)' != 'true'" />
</Project>

View File

@@ -19,10 +19,17 @@
<ProjectReference Include="$(MSBuildThisFileDirectory)\..\Robust.Client.Injectors\Robust.Client.Injectors.csproj" ReferenceOutputAssembly="false"/>
</ItemGroup>
<!-- XamlIL does not make use of special Robust configurations like DebugOpt. Convert these down. -->
<PropertyGroup>
<RobustInjectorsConfiguration>$(Configuration)</RobustInjectorsConfiguration>
<RobustInjectorsConfiguration Condition="'$(Configuration)' == 'DebugOpt'">Debug</RobustInjectorsConfiguration>
<RobustInjectorsConfiguration Condition="'$(Configuration)' == 'Tools'">Release</RobustInjectorsConfiguration>
</PropertyGroup>
<UsingTask
Condition="'$(_RobustUseExternalMSBuild)' != 'true' And $(DesignTimeBuild) != true"
TaskName="CompileRobustXamlTask"
AssemblyFile="$(MSBuildThisFileDirectory)\..\Robust.Client.Injectors\bin\$(Configuration)\netstandard2.0\Robust.Client.Injectors.dll"/>
AssemblyFile="$(MSBuildThisFileDirectory)\..\Robust.Client.Injectors\bin\$(RobustInjectorsConfiguration)\netstandard2.0\Robust.Client.Injectors.dll"/>
<Target
Name="CompileRobustXaml"
Condition="Exists('@(IntermediateAssembly)')"

View File

@@ -1,17 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\MSBuild\Robust.Properties.targets" />
<PropertyGroup>
<!-- Work around https://github.com/dotnet/project-system/issues/4314 -->
<TargetFramework>$(TargetFramework)</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>9.0</LangVersion>
<SkipRobustAnalyzer>true</SkipRobustAnalyzer>
</PropertyGroup>
<Import Project="..\MSBuild\Robust.DefineConstants.targets" />
<ItemGroup>
<PackageReference Condition="'$(TargetFramework)' == 'net472'" Include="System.Memory" Version="4.5.3" />
</ItemGroup>
<Import Project="..\MSBuild\Robust.Properties.targets" />
</Project>

View File

@@ -47,12 +47,16 @@ END TEMPLATE-->
### Other
*None yet*
* Added new `DebugOpt` and `Tools` build configurations. These must be added to your solution file and apply to all projects importing `Robust.Properties.targets`.
* `DebugOpt` is "`Debug` with optimizations enabled".
* `Tools` has development tools (e.g. `launchauth` command) that release builds don't, while still having asserts (`DEBUG`) off and optimizations on.
* All configurations except `Release` now define `TOOLS`.
* `Release` is now intended to be "as close to published release as possible" with game configuration. Use `Tools` as build configuration instead for scenarios such as mapping.
* `Robust.Properties.targets` should now be included at the end of project files. `Robust.Analyzers.targets` and `Robust.DefineConstants.targets` are now included by it automatically.
### Internal
*None yet*
* General cleanup to MSBuild files.
## 0.91.0.0

View File

@@ -1,25 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\MSBuild\Robust.Properties.targets" />
<Import Project="..\MSBuild\Robust.Engine.props" />
<PropertyGroup>
<IsPackable>false</IsPackable>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<OutputPath>../bin/Benchmarks</OutputPath>
<OutputType>Exe</OutputType>
<NoWarn>RA0003</NoWarn>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Robust.Server\Robust.Server.csproj" />
<ProjectReference Include="..\Robust.Shared\Robust.Shared.csproj" />
<ProjectReference Include="..\Robust.UnitTesting\Robust.UnitTesting.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.12.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.4" />
</ItemGroup>
<Import Project="..\MSBuild\Robust.Engine.targets" />
<Import Project="..\MSBuild\Robust.Engine.props" />
<PropertyGroup>
<IsPackable>false</IsPackable>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<OutputPath>../bin/Benchmarks</OutputPath>
<OutputType>Exe</OutputType>
<NoWarn>RA0003</NoWarn>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Robust.Server\Robust.Server.csproj" />
<ProjectReference Include="..\Robust.Shared\Robust.Shared.csproj" />
<ProjectReference Include="..\Robust.UnitTesting\Robust.UnitTesting.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.12.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.4" />
</ItemGroup>
<Import Project="..\MSBuild\Robust.Properties.targets" />
</Project>

View File

@@ -1,5 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\MSBuild\Robust.Properties.targets" />
<Import Project="..\MSBuild\Robust.Engine.props" />
<PropertyGroup>
@@ -8,10 +7,6 @@
<ValidateExecutableReferencesMatchSelfContained>false</ValidateExecutableReferencesMatchSelfContained>
</PropertyGroup>
<Import Project="..\MSBuild\Robust.DefineConstants.targets" />
<Target Name="RobustAfterBuild" AfterTargets="Build" />
<Import Project="..\MSBuild\Robust.Engine.targets" />
<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2020.3.0" />
<PackageReference Include="Robust.Natives.Cef" Version="102.0.9" />
@@ -21,4 +16,6 @@
<ProjectReference Include="..\cefglue\CefGlue\CefGlue.csproj" />
<ProjectReference Include="..\Robust.Client\Robust.Client.csproj" />
</ItemGroup>
<Import Project="..\MSBuild\Robust.Properties.targets" />
</Project>

View File

@@ -1,4 +1,4 @@
#if !FULL_RELEASE
#if TOOLS
using System;
using System.IO;
using Microsoft.Data.Sqlite;

View File

@@ -1,4 +1,4 @@
#if !FULL_RELEASE
#if TOOLS
using System;
using JetBrains.Profiler.Api;
using Robust.Shared.Console;

View File

@@ -44,7 +44,7 @@ namespace Robust.Client.Prototypes
private void WindowFocusedChanged(WindowFocusedEventArgs args)
{
#if !FULL_RELEASE
#if TOOLS
if (args.Focused && _reloadQueue.Count > 0)
{
Timer.Spawn(_reloadDelay, ReloadPrototypeQueue, _reloadToken.Token);
@@ -59,7 +59,7 @@ namespace Robust.Client.Prototypes
private void ReloadPrototypeQueue()
{
#if !FULL_RELEASE
#if TOOLS
var sw = Stopwatch.StartNew();
var msg = new MsgReloadPrototypes();
@@ -83,7 +83,7 @@ namespace Robust.Client.Prototypes
if (!_cfg.GetCVar(CVars.ResPrototypeReloadWatch))
return;
#if !FULL_RELEASE
#if TOOLS
foreach (var path in Resources.GetContentRoots().Select(r => r.ToString())
.Where(r => Directory.Exists(r + "/Prototypes")).Select(p => p + "/Prototypes"))
{

View File

@@ -1,16 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\MSBuild\Robust.Properties.targets" />
<Import Project="..\MSBuild\Robust.Engine.props" />
<PropertyGroup>
<IsPackable>false</IsPackable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<OutputType>WinExe</OutputType>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<OutputPath>../bin/Client</OutputPath>
<NoWarn>NU1701</NoWarn>
<OutputPath>../bin/Client</OutputPath>
<RobustILLink>true</RobustILLink>
</PropertyGroup>
<Import Project="..\MSBuild\Robust.DefineConstants.targets" />
<ItemGroup>
<PackageReference Include="DiscordRichPresence" Version="1.0.175" />
<PackageReference Include="JetBrains.Annotations" Version="2021.3.0" PrivateAssets="All" />
@@ -43,26 +41,22 @@
<ProjectReference Include="..\Robust.Shared.Maths\Robust.Shared.Maths.csproj" />
<ProjectReference Include="..\Robust.Shared\Robust.Shared.csproj" />
</ItemGroup>
<ItemGroup>
<!-- Shader embedding -->
<ItemGroup>
<EmbeddedResource Include="Graphics\Clyde\Shaders\*" />
</ItemGroup>
<!-- ILLink configuration -->
<ItemGroup>
<RobustLinkRoots Include="Robust.Client" />
<RobustLinkAssemblies Include="TerraFX.Interop.Windows" />
<RobustLinkAssemblies Include="OpenToolkit.Graphics" />
</ItemGroup>
<ItemGroup>
<Compile Update="UserInterface\CustomControls\DefaultWindow.xaml.cs">
<DependentUpon>DefaultWindow.xaml</DependentUpon>
</Compile>
<Compile Remove="Debugging\IDebugDrawing.cs" />
</ItemGroup>
<Import Project="..\MSBuild\Robust.Engine.targets" />
<PropertyGroup>
<RobustToolsPath>../Tools</RobustToolsPath>
</PropertyGroup>
<Target Name="RobustAfterBuild" AfterTargets="Build" />
<Import Project="..\MSBuild\Robust.Properties.targets" />
<Import Project="..\MSBuild\XamlIL.targets" />
<Import Project="..\MSBuild\Robust.Trimming.targets" />
</Project>

View File

@@ -60,6 +60,10 @@ Intrinsics: {GetIntrinsics()}";
options.Add("FULL_RELEASE");
#endif
#if TOOLS
options.Add("TOOLS");
#endif
#if DEBUG
options.Add("DEBUG");
#endif

View File

@@ -1,5 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\MSBuild\Robust.Properties.targets" />
<Import Project="..\MSBuild\Robust.Engine.props" />
<PropertyGroup>
@@ -11,5 +10,5 @@
<ProjectReference Include="..\Robust.Shared\Robust.Shared.csproj" />
</ItemGroup>
<Import Project="..\MSBuild\Robust.Engine.targets" />
<Import Project="..\MSBuild\Robust.Properties.targets" />
</Project>

View File

@@ -1,10 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\MSBuild\Robust.Properties.targets" />
<Import Project="..\MSBuild\Robust.Engine.props" />
<PropertyGroup>
</PropertyGroup>
<Import Project="..\MSBuild\Robust.DefineConstants.targets" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
@@ -20,4 +18,5 @@
<ProjectReference Include="..\Robust.Shared.Maths\Robust.Shared.Maths.csproj" />
</ItemGroup>
<Import Project="..\MSBuild\Robust.Properties.targets" />
</Project>

View File

@@ -1,4 +1,4 @@
#if !FULL_RELEASE
#if TOOLS
using System;
using JetBrains.Profiler.Api;
using Robust.Shared.Console;

View File

@@ -842,9 +842,9 @@ internal sealed partial class PVSSystem : EntitySystem
// This is pretty shit and there is probably a better way of doing this.
sessionData.Overflow = oldEntry.Value;
#if !FULL_RELEASE
#if DEBUG
// This happens relatively frequently for the current TickBuffer value, and doesn't really provide any
// useful info when not debugging/testing locally. Hence disabled on FULL_RELEASE.
// useful info when not debugging/testing locally. Hence only enable on DEBUG.
_sawmill.Debug($"Client {session} exceeded tick buffer.");
#endif
}

View File

@@ -54,10 +54,7 @@ namespace Robust.Server.Physics
SubscribeLocalEvent<GridRemovalEvent>(OnGridRemoval);
SubscribeNetworkEvent<RequestGridNodesMessage>(OnDebugRequest);
SubscribeNetworkEvent<StopGridNodesMessage>(OnDebugStopRequest);
#if !FULL_RELEASE
// It makes mapping painful
_cfg.OverrideDefault(CVars.GridSplitting, false);
#endif
_cfg.OnValueChanged(CVars.GridSplitting, SetSplitAllowed, true);
}

View File

@@ -31,7 +31,7 @@ namespace Robust.Server.Prototypes
private void HandleReloadPrototypes(MsgReloadPrototypes msg)
{
#if !FULL_RELEASE
#if TOOLS
if (!_playerManager.TryGetSessionByChannel(msg.MsgChannel, out var player) ||
!_conGroups.CanAdminReloadPrototypes(player))
{

View File

@@ -1,5 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\MSBuild\Robust.Properties.targets" />
<Import Project="..\MSBuild\Robust.Engine.props" />
<PropertyGroup>
<IsPackable>false</IsPackable>
@@ -11,7 +10,6 @@
<!-- Try to fix sporadic errors against Robust.Packaging, apparently?? -->
<ValidateExecutableReferencesMatchSelfContained>false</ValidateExecutableReferencesMatchSelfContained>
</PropertyGroup>
<Import Project="..\MSBuild\Robust.DefineConstants.targets" />
<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2021.3.0" PrivateAssets="All" />
<PackageReference Include="SpaceWizards.HttpListener" Version="0.1.0" />
@@ -41,5 +39,6 @@
<LogicalName>Robust.Server.ExtraMappedSerializerStrings.txt</LogicalName>
</EmbeddedResource>
</ItemGroup>
<Import Project="..\MSBuild\Robust.Engine.targets" />
<Import Project="..\MSBuild\Robust.Properties.targets" />
</Project>

View File

@@ -1,14 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\MSBuild\Robust.Properties.targets" />
<Import Project="..\MSBuild\Robust.Engine.props" />
<PropertyGroup>
<IsPackable>false</IsPackable>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<Import Project="..\MSBuild\Robust.DefineConstants.targets" />
<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2021.3.0" PrivateAssets="All" />
<PackageReference Condition="'$(TargetFramework)' == 'net472'" Include="System.Runtime.CompilerServices.Unsafe" Version="4.5.2" />
</ItemGroup>
<Import Project="..\MSBuild\Robust.Properties.targets" />
</Project>

View File

@@ -1,13 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\MSBuild\Robust.Properties.targets" />
<Import Project="..\MSBuild\Robust.Engine.props" />
<PropertyGroup>
<IsPackable>false</IsPackable>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<OutputPath>../bin/Shared.Maths</OutputPath>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<Import Project="..\MSBuild\Robust.DefineConstants.targets" />
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Features" Version="4.0.1" />
@@ -20,4 +17,6 @@
<ProjectReference Include="..\Robust.Shared.Maths\Robust.Shared.Maths.csproj" />
<ProjectReference Include="..\Robust.Shared\Robust.Shared.csproj" />
</ItemGroup>
<Import Project="..\MSBuild\Robust.Properties.targets" />
</Project>

View File

@@ -12,34 +12,28 @@ internal static class CVarDefaultOverrides
{
OverrideShared(cfg);
#if FULL_RELEASE
return;
#endif
#if TOOLS
// Profiling is currently only useful on the client, so only enable it there.
cfg.OverrideDefault(CVars.ProfEnabled, true);
#endif
}
public static void OverrideServer(IConfigurationManager cfg)
{
OverrideShared(cfg);
#if FULL_RELEASE
return;
#endif
#if TOOLS
// Set auth to optional in case you're doing any funny development shenanigans.
cfg.OverrideDefault(CVars.AuthMode, (int) AuthMode.Optional);
#endif
}
private static void OverrideShared(IConfigurationManager cfg)
{
#if FULL_RELEASE
return;
#endif
#if TOOLS
// Increase default profiler memory use on local builds to make it more useful.
cfg.OverrideDefault(CVars.ProfBufferSize, 65536);
cfg.OverrideDefault(CVars.ProfIndexSize, 1024);
#endif
}
}

View File

@@ -9,7 +9,7 @@ namespace Robust.Shared
public static void Setup(IConfigurationManager cfg)
{
// Disabled on non-release since I don't want this to start creating files in Steam's bin directory.
#if FULL_RELEASE
#if RELEASE
return;
#endif

View File

@@ -78,7 +78,7 @@ internal static class ProgramShared
internal static Task CheckBadFileExtensions(IResourceManager res, IConfigurationManager cfg, ISawmill sawmill)
{
#if FULL_RELEASE
#if !DEBUG
return Task.CompletedTask;
#else
if (!cfg.GetCVar(CVars.ResCheckBadFileExtensions))

View File

@@ -194,7 +194,7 @@ namespace Robust.Shared.Prototypes
protected void ReloadPrototypes(IEnumerable<ResourcePath> filePaths)
{
#if !FULL_RELEASE
#if TOOLS
var changed = new Dictionary<Type, HashSet<string>>();
foreach (var filePath in filePaths)
{
@@ -207,7 +207,7 @@ namespace Robust.Shared.Prototypes
public void ReloadPrototypes(Dictionary<Type, HashSet<string>> prototypes)
{
#if !FULL_RELEASE
#if TOOLS
var prototypeTypeOrder = prototypes.Keys.ToList();
prototypeTypeOrder.Sort(SortPrototypesByPriority);

View File

@@ -1,12 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\MSBuild\Robust.Properties.targets" />
<Import Project="..\MSBuild\Robust.Engine.props" />
<PropertyGroup>
<IsPackable>false</IsPackable>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<Import Project="..\MSBuild\Robust.DefineConstants.targets" />
<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2021.3.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.Extensions.ObjectPool" Version="6.0.2" />
@@ -50,5 +48,6 @@
<DependentUpon>RobustMappedStringSerializer.cs</DependentUpon>
</Compile>
</ItemGroup>
<Import Project="..\MSBuild\Robust.Engine.targets" />
<Import Project="..\MSBuild\Robust.Properties.targets" />
</Project>

View File

@@ -58,7 +58,7 @@ namespace Robust.Shared.Serialization
public void Initialize()
{
var types = _reflectionManager.FindTypesWithAttribute<NetSerializableAttribute>().ToList();
#if !FULL_RELEASE
#if DEBUG
// confirm only shared types are marked for serialization, no client & server only types
foreach (var type in types)
{

View File

@@ -1,5 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\MSBuild\Robust.Properties.targets" />
<Import Project="..\MSBuild\Robust.Engine.props" />
<PropertyGroup>
<IsPackable>false</IsPackable>
@@ -7,7 +6,6 @@
<OutputPath>../bin/UnitTesting</OutputPath>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<Import Project="..\MSBuild\Robust.DefineConstants.targets" />
<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.12.1" />
<PackageReference Include="Castle.Core" Version="4.4.1" />
@@ -34,5 +32,5 @@
<LogicalName>Robust.UnitTesting.Shared.ContentPack.ZipTest.zip</LogicalName>
</EmbeddedResource>
</ItemGroup>
<Import Project="..\MSBuild\Robust.Engine.targets" />
<Import Project="..\MSBuild\Robust.Properties.targets" />
</Project>

View File

@@ -67,6 +67,7 @@ entities:
var compFactory = IoCManager.Resolve<IComponentFactory>();
compFactory.RegisterClass<MapDeserializeTestComponent>();
compFactory.RegisterClass<VisibilityComponent>();
compFactory.RegisterClass<ActorComponent>();
compFactory.GenerateNetIds();
IoCManager.Resolve<ISerializationManager>().Initialize();

View File

@@ -1,26 +0,0 @@
using System;
using System.Diagnostics;
using NUnit.Framework;
using Robust.Shared.Utility;
namespace Robust.UnitTesting.Shared.Utility;
[TestFixture]
[Parallelizable(ParallelScope.All)]
[TestOf(typeof(DebugTools))]
public sealed class DebugTools_Test
{
[Test]
[TestCase(true, 5)]
[Conditional("DEBUG")]
public void TestAssertFormatNoAlloc(bool check, int val)
{
var allocA = GC.GetAllocatedBytesForCurrentThread();
DebugTools.Assert(check, $"Oops: {val}");
var allocB = GC.GetAllocatedBytesForCurrentThread();
Assert.That(allocB, Is.EqualTo(allocA));
}
}