diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 2583d6d..2007dff 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -35,13 +35,25 @@ jobs:
build-linux:
runs-on: ubuntu-latest
+ container:
+ image: debian:bookworm-slim
steps:
+ - name: Install prerequisites
+ run: |
+ apt-get update
+ apt-get install -y --no-install-recommends ca-certificates clang lld git curl
+
- name: Checkout
uses: actions/checkout@v6
with:
submodules: "recursive"
+ - name: Setup .NET
+ uses: actions/setup-dotnet@v5
+ with:
+ dotnet-version: "10.0.x"
+
- name: Test
run: dotnet test
diff --git a/RLBotCS/ManagerTools/ConfigParser.cs b/RLBotCS/ManagerTools/ConfigParser.cs
index 3bfcdc6..0174e59 100644
--- a/RLBotCS/ManagerTools/ConfigParser.cs
+++ b/RLBotCS/ManagerTools/ConfigParser.cs
@@ -4,6 +4,7 @@
using RLBotCS.Model;
using Tomlyn;
using Tomlyn.Model;
+using Tomlyn.Serialization;
namespace RLBotCS.ManagerTools;
@@ -16,6 +17,7 @@ public static class Fields
public const string RlBotLauncherArg = "launcher_arg";
public const string RlBotAutoStartAgents = "auto_start_agents";
public const string RlBotWaitForAgents = "wait_for_agents";
+ public const string RlBotPerformanceMonitor = "performance_monitor";
public const string MatchTable = "match";
public const string MatchGameMode = "game_mode";
@@ -27,7 +29,6 @@ public static class Fields
public const string MatchStateSetting = "enable_state_setting";
public const string MatchAutoSaveReplays = "auto_save_replays";
public const string MatchFreePlay = "freeplay";
- public const string MatchPerformanceMonitor = "performance_monitor";
public const string MutatorsTable = "mutators";
public const string MutatorsMatchLength = "match_length";
@@ -112,7 +113,21 @@ public class ConfigParserException(string? message, Exception? innerException =
private readonly ConfigContextTracker _context = new();
/// Holds field names that were not present in the config. Used for debugging.
- private readonly List _missingValues = new();
+ private readonly List _missingValues = [];
+
+ ///
+ /// AOT-safe TOML serializer context for parsing documents into .
+ ///
+ private sealed class ParserTomlContext : TomlSerializerContext
+ {
+ public static readonly ParserTomlContext Default = new();
+
+ private ParserTomlContext()
+ : base(new()) { }
+
+ public override TomlTypeInfo? GetTypeInfo(Type type, TomlSerializerOptions options) =>
+ type == typeof(TomlTable) ? GetBuiltInTypeInfo(options) : null;
+ }
private TomlTable LoadTomlFile(string path)
{
@@ -127,7 +142,8 @@ private TomlTable LoadTomlFile(string path)
}
path = Path.GetFullPath(path);
- return Toml.ToModel(File.ReadAllText(path), path);
+ using var stream = File.Open(path, FileMode.Open, FileAccess.Read, FileShare.Read);
+ return TomlSerializer.Deserialize(stream, ParserTomlContext.Default)!;
}
catch (Exception e)
{
@@ -729,7 +745,7 @@ public MatchConfigurationT LoadMatchConfig(string path)
path = Path.GetFullPath(path);
TomlTable outerTable = LoadTomlFile(path);
- MatchConfigurationT matchConfig = new MatchConfigurationT();
+ MatchConfigurationT matchConfig = new();
TomlTable rlbotTable = GetValue(outerTable, Fields.RlBotTable, []);
using (_context.Begin(Fields.RlBotTable))
@@ -752,7 +768,7 @@ public MatchConfigurationT LoadMatchConfig(string path)
);
matchConfig.PerformanceMonitor = GetEnum(
rlbotTable,
- Fields.MatchPerformanceMonitor,
+ Fields.RlBotPerformanceMonitor,
PerformanceMonitor.ShowWhenSuboptimal
);
}
diff --git a/RLBotCS/RLBotCS.csproj b/RLBotCS/RLBotCS.csproj
index b0f5afb..bf19692 100644
--- a/RLBotCS/RLBotCS.csproj
+++ b/RLBotCS/RLBotCS.csproj
@@ -10,16 +10,14 @@
Speed
true
true
- true
true
- true
lld
true
-
+