Optimzie Newtonsoft.Json lib by removing Xml, Schema support and making it AOT-friendly for AOT game builds

This commit is contained in:
Wojtek Figat
2023-04-01 23:34:24 +02:00
parent 12f4dc74d2
commit e1a0e51bc7
6 changed files with 11 additions and 1045 deletions

View File

@@ -604,9 +604,7 @@ namespace FlaxEditor.CustomEditors
JsonSerializer.Deserialize(obj, text);
}
}
#pragma warning disable 618
else if (Newtonsoft.Json.Schema.JsonSchema.Parse(text) == null)
#pragma warning restore 618
else if (!text.StartsWith("{") || !text.EndsWith("}"))
{
return false;
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -77,6 +77,10 @@ namespace Flax.Deps.Dependencies
// AOT build (disabled codegen)
Utilities.ReplaceInFile(Path.Combine(root, "Src", "Newtonsoft.Json", "Newtonsoft.Json.csproj"), "HAVE_REFLECTION_EMIT;", ";");
Utilities.ReplaceInFile(Path.Combine(root, "Src", "Newtonsoft.Json", "Newtonsoft.Json.csproj"), "HAVE_DYNAMIC;", ";");
Utilities.ReplaceInFile(Path.Combine(root, "Src", "Newtonsoft.Json", "Newtonsoft.Json.csproj"), "HAVE_EXPRESSIONS;", ";");
Utilities.ReplaceInFile(Path.Combine(root, "Src", "Newtonsoft.Json", "Newtonsoft.Json.csproj"), "HAVE_REGEX;", ";");
Utilities.ReplaceInFile(Path.Combine(root, "Src", "Newtonsoft.Json", "Newtonsoft.Json.csproj"), "HAVE_TYPE_DESCRIPTOR;", ";");
Deploy.VCEnvironment.BuildSolution(solutionPath, configuration, buildPlatform);
foreach (var platform in options.Platforms)
{