this won't work

This commit is contained in:
LotP1 2024-12-25 20:48:28 +01:00
parent 748e93ba65
commit b19ee23c6b
3 changed files with 21 additions and 11 deletions

View File

@ -3,8 +3,9 @@ using Microsoft.Build.Utilities;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.IO; using System.IO;
using Newtonsoft.Json; using System.Text.Json;
using Microsoft.Build.Framework; using Microsoft.Build.Framework;
using System.Text.Encodings.Web;
namespace Ryujinx.BuildValidationTasks namespace Ryujinx.BuildValidationTasks
{ {
@ -34,9 +35,10 @@ namespace Ryujinx.BuildValidationTasks
LocalesJson json; LocalesJson json;
try try
{ {
json = JsonConvert.DeserializeObject<LocalesJson>(data); json = JsonSerializer.Deserialize<LocalesJson>(data);
} }
catch (Exception e) catch (Exception e)
@ -61,7 +63,13 @@ namespace Ryujinx.BuildValidationTasks
json.Locales[i] = locale; json.Locales[i] = locale;
} }
string jsonString = JsonConvert.SerializeObject(json, Formatting.Indented); JsonSerializerOptions jsonOptions = new JsonSerializerOptions()
{
WriteIndented = true,
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping
};
string jsonString = JsonSerializer.Serialize(json, jsonOptions);
using (StreamWriter sw = new(path)) using (StreamWriter sw = new(path))
{ {

View File

@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<temp_assemblies>$(MSBuildThisFileDirectory)temp_assemblies/</temp_assemblies> <temp_assemblies>$(MSBuildThisFileDirectory)temp_assemblies/</temp_assemblies>
@ -9,16 +10,11 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.Build.Utilities.Core" GeneratePathProperty="true" /> <PackageReference Include="Microsoft.Build.Utilities.Core" GeneratePathProperty="true" />
<PackageReference Include="Microsoft.Build.Framework" GeneratePathProperty="true" /> <PackageReference Include="Microsoft.Build.Framework" GeneratePathProperty="true" />
<PackageReference Include="Newtonsoft.Json" GeneratePathProperty="true" />
</ItemGroup> </ItemGroup>
<Target Name="ValidationTask"> <Target Name="ValidationTask">
<Message Text="Running Validations..." Importance="high" /> <Message Text="Running Validations..." Importance="high" />
<Message Text="Copying Assemblies To Intermediate Folder: $(temp_assemblies)" Importance="high" />
<!--Copy needed assemblies to the intermediate folder, only copy assemblies that are needed to run the validation dlls-->
<Copy SourceFiles="$(PkgNewtonsoft_Json)/lib/netstandard2.0/Newtonsoft.Json.dll" DestinationFolder="$(temp_assemblies)" />
<!--Run Validation Targets Here--> <!--Run Validation Targets Here-->
<CallTarget Targets="MasterLocalesValidationTask" /> <CallTarget Targets="MasterLocalesValidationTask" />
@ -36,6 +32,11 @@
<!--Name should be "Build<Name>TaskDll"--> <!--Name should be "Build<Name>TaskDll"-->
<Target Name="BuildLocalesValidationTaskDll"> <Target Name="BuildLocalesValidationTaskDll">
<CallTarget Targets="ResolveAssemblyReferences"/>
<Message Text="Path @(ReferencePath)" Importance="high" />
<Message Text="Ref @(Reference)" Importance="high" />
<Message Text="Building $(Name)Task..." Importance="high" /> <Message Text="Building $(Name)Task..." Importance="high" />
<!--Remember to include References!--> <!--Remember to include References!-->
<Csc Sources="$(MSBuildThisFileDirectory)$(Name)Task*.cs" <Csc Sources="$(MSBuildThisFileDirectory)$(Name)Task*.cs"
@ -46,9 +47,10 @@
netstandard.dll; netstandard.dll;
System.Collections.dll; System.Collections.dll;
System.Linq.dll; System.Linq.dll;
$(PkgMicrosoft_Build_Framework)/ref/netstandard2.0/Microsoft.Build.Framework.dll; System.Text.Json.dll;
$(PkgMicrosoft_Build_Utilities_Core)/ref/netstandard2.0/Microsoft.Build.Utilities.Core.dll; System.Text.Encodings.Web.dll;
$(PkgNewtonsoft_Json)/lib/netstandard2.0/Newtonsoft.Json.dll" $(PkgMicrosoft_Build_Framework)/ref/net9.0/Microsoft.Build.Framework.dll;
$(PkgMicrosoft_Build_Utilities_Core)/ref/net9.0/Microsoft.Build.Utilities.Core.dll;"
TargetType="Library" OutputAssembly="$(temp_assemblies)$(Dll)"/> TargetType="Library" OutputAssembly="$(temp_assemblies)$(Dll)"/>
</Target> </Target>