This commit is contained in:
LotP1 2024-12-25 22:13:54 +01:00
parent b19ee23c6b
commit 695f9e277d
3 changed files with 21 additions and 44 deletions

View file

@ -11,6 +11,7 @@
<PackageVersion Include="Avalonia.Svg" Version="11.0.0.18" />
<PackageVersion Include="Avalonia.Svg.Skia" Version="11.0.0.18" />
<PackageVersion Include="Microsoft.Build.Framework" Version="17.12.6" />
<PackageVersion Include="Microsoft.Build.Tasks.Core" Version="17.12.6" />
<PackageVersion Include="Microsoft.Build.Utilities.Core" Version="17.12.6" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="Projektanker.Icons.Avalonia" Version="9.4.0" />

View file

@ -11,20 +11,11 @@ namespace Ryujinx.BuildValidationTasks
{
public class LocalesValidationTask : Task
{
public string Path { get; set; }
public override bool Execute()
{
string path = System.Reflection.Assembly.GetExecutingAssembly().Location;
if (path.Split(["src"], StringSplitOptions.None).Length == 1)
{
//i assume that we are in a build directory in the solution dir
path = new FileInfo(path).Directory!.Parent!.GetDirectories("src")[0].GetDirectories("Ryujinx")[0].GetDirectories("Assets")[0].GetFiles("locales.json")[0].FullName;
}
else
{
path = path.Split(["src"], StringSplitOptions.None)[0];
path = new FileInfo(path).Directory!.GetDirectories("src")[0].GetDirectories("Ryujinx")[0].GetDirectories("Assets")[0].GetFiles("locales.json")[0].FullName;
}
string path = Path;
string data;

View file

@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<temp_assemblies>$(MSBuildThisFileDirectory)temp_assemblies/</temp_assemblies>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Build.Utilities.Core" GeneratePathProperty="true" />
<PackageReference Include="Microsoft.Build.Framework" GeneratePathProperty="true" />
<PackageReference Include="Microsoft.Build.Tasks.Core" />
<PackageReference Include="Microsoft.Build.Utilities.Core" />
<PackageReference Include="Microsoft.Build.Framework" />
</ItemGroup>
<Target Name="ValidationTask">
@ -26,42 +26,27 @@
<PropertyGroup>
<!--Name of Validation Task. <Name> refers to this name-->
<Name>LocalesValidation</Name>
<!--Dll should be "<Name>Task.dll"-->
<Dll>LocalesValidationTask.dll</Dll>
</PropertyGroup>
<!--Name should be "Build<Name>TaskDll"-->
<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" />
<!--Remember to include References!-->
<Csc Sources="$(MSBuildThisFileDirectory)$(Name)Task*.cs"
AdditionalLibPaths="$(ProgramFiles)/dotnet/packs/Microsoft.NETCore.App.Ref/9.0.0/ref/net9.0/"
References="
System.dll;
System.Runtime.dll;
netstandard.dll;
System.Collections.dll;
System.Linq.dll;
System.Text.Json.dll;
System.Text.Encodings.Web.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)"/>
</Target>
<UsingTask TaskName="Ryujinx.BuildValidationTasks.$(Name)Task" TaskFactory="TaskHostFactory" AssemblyFile="$(temp_assemblies)$(Dll)"/>
<UsingTask TaskName="Ryujinx.BuildValidationTasks.$(Name)Task" TaskFactory="RoslynCodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
<ParameterGroup>
<Path Required="true" />
</ParameterGroup>
<Task>
<Reference Include="System.Text.Json"/>
<Reference Include="System.Text.Encodings.Web"/>
<Reference Include="System.Memory"/>
<Code Language="cs" Source="$(MSBuildThisFileDirectory)$(Name)Task.cs" />
</Task>
</UsingTask>
<!--Name should be "Master<Name>Task"-->
<Target Name="MasterLocalesValidationTask" DependsOnTargets="Build$(Name)TaskDll">
<Target Name="MasterLocalesValidationTask">
<Message Text="Running $(Name)Task... " Importance="high" />
<!--Should call "Ryujinx.BuildValidationTasks.<Name>Task"-->
<Ryujinx.BuildValidationTasks.LocalesValidationTask />
<Ryujinx.BuildValidationTasks.LocalesValidationTask Path="$(MSBuildThisFileDirectory)../Ryujinx/Assets/locales.json" />
<Message Text="$(Name)Task finished!" Importance="high" />
</Target>
</Project>
</Project>