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" Version="11.0.0.18" />
<PackageVersion Include="Avalonia.Svg.Skia" 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.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="Microsoft.Build.Utilities.Core" Version="17.12.6" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" /> <PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="Projektanker.Icons.Avalonia" Version="9.4.0" /> <PackageVersion Include="Projektanker.Icons.Avalonia" Version="9.4.0" />

View file

@ -11,20 +11,11 @@ namespace Ryujinx.BuildValidationTasks
{ {
public class LocalesValidationTask : Task public class LocalesValidationTask : Task
{ {
public string Path { get; set; }
public override bool Execute() public override bool Execute()
{ {
string path = System.Reflection.Assembly.GetExecutingAssembly().Location; string path = Path;
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 data; string data;

View file

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