GenArray: Replace input properties
This commit is contained in:
parent
17671611b2
commit
af835e2fac
2 changed files with 26 additions and 9 deletions
|
@ -25,7 +25,19 @@ namespace Ryujinx.CustomTasks
|
||||||
public string OutputPath { get; set; }
|
public string OutputPath { get; set; }
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public ITaskItem[] InputFiles { get; set; }
|
public bool ScanSolution { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public string SolutionDir { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public string ProjectDir { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public string NugetPackagePath { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public string TargetFramework { get; set; }
|
||||||
|
|
||||||
[Output]
|
[Output]
|
||||||
public string[] OutputFiles { get; set; }
|
public string[] OutputFiles { get; set; }
|
||||||
|
@ -186,16 +198,14 @@ namespace Ryujinx.CustomTasks
|
||||||
string arraysFilePath = Path.Combine(OutputPath, ArraysFileName);
|
string arraysFilePath = Path.Combine(OutputPath, ArraysFileName);
|
||||||
List<int> arraySizes = new List<int>();
|
List<int> arraySizes = new List<int>();
|
||||||
|
|
||||||
foreach (var item in InputFiles)
|
foreach (var item in Directory.EnumerateFiles(ScanSolution ? SolutionDir: ProjectDir, "*.cs", SearchOption.AllDirectories))
|
||||||
{
|
{
|
||||||
string fullPath = item.GetMetadata("FullPath");
|
if (item.EndsWith(".g.cs") || item.Contains(Path.Combine("obj","Debug")) || item.Contains(Path.Combine("obj", "Release")))
|
||||||
|
|
||||||
if (fullPath.EndsWith(".g.cs") || fullPath.Contains(Path.Combine("obj","Debug")) || fullPath.Contains(Path.Combine("obj", "Release")))
|
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (int size in GetArraySizes(fullPath))
|
foreach (int size in GetArraySizes(item))
|
||||||
{
|
{
|
||||||
if (!arraySizes.Contains(size))
|
if (!arraySizes.Contains(size))
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,16 +3,23 @@
|
||||||
|
|
||||||
<!-- Task: GenerateArrays -->
|
<!-- Task: GenerateArrays -->
|
||||||
|
|
||||||
<!-- Defining all sources files of the current project for the input parameter -->
|
<!-- Assign default values -->
|
||||||
|
<PropertyGroup>
|
||||||
|
<ArrayScanSolution Condition="'$(ArrayScanSolution)' == ''">false</ArrayScanSolution>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ArrayInputFiles Condition="'$(ArrayInputFiles)' == ''" Include="$(MSBuildProjectDirectory)\**\*.cs" />
|
<ArrayInputFiles Condition="'$(ArrayScanSolution)' == 'false'" Include="$(MSBuildProjectDirectory)\**\*.cs" />
|
||||||
|
<ArrayInputFiles Condition="'$(ArrayScanSolution)' == 'true'" Include="$(SolutionDir)\**\*.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<!--A target that generates code, which is executed before the compilation-->
|
<!--A target that generates code, which is executed before the compilation-->
|
||||||
<!-- TODO: Make "Outputs" more generic -->
|
<!-- TODO: Make "Outputs" more generic -->
|
||||||
<Target Name="BeforeCompile" Inputs="@(ArrayInputFiles)" Outputs="$(ArrayOutputPath)\Arrays.g.cs;$(ArrayOutputPath)\IArray.g.cs">
|
<Target Name="BeforeCompile" Inputs="@(ArrayInputFiles)" Outputs="$(ArrayOutputPath)\Arrays.g.cs;$(ArrayOutputPath)\IArray.g.cs">
|
||||||
<!--Calling our custom task -->
|
<!--Calling our custom task -->
|
||||||
<GenerateArrays ArrayNamespace="$(ArrayNamespace)" InputFiles="@(ArrayInputFiles)" OutputPath="$(ArrayOutputPath)">
|
<GenerateArrays ArrayNamespace="$(ArrayNamespace)" ScanSolution="$(ArrayScanSolution)" OutputPath="$(ArrayOutputPath)"
|
||||||
|
SolutionDir="$(SolutionDir)" ProjectDir="$(MSBuildProjectDirectory)" NugetPackagePath="$(NuGetPackageRoot)"
|
||||||
|
TargetFramework="$(TargetFramework)">
|
||||||
<!--Our generated files are included to be compiled-->
|
<!--Our generated files are included to be compiled-->
|
||||||
<Output TaskParameter="OutputFiles" ItemName="Compile" />
|
<Output TaskParameter="OutputFiles" ItemName="Compile" />
|
||||||
</GenerateArrays>
|
</GenerateArrays>
|
||||||
|
|
Loading…
Reference in a new issue