Adds a new flag to allow the transformer source file to be in the solution directory

This commit is contained in:
Zontreck 2023-08-10 23:24:10 -07:00
parent fdbdf0ce62
commit ea7bb0d8c9
4 changed files with 15 additions and 28 deletions

2
.gitignore vendored
View file

@ -404,5 +404,5 @@ bootstrap/*.exe
bootstrap/** bootstrap/**
bootstrap bootstrap
source/**/*.csproj
*.sln *.sln

Binary file not shown.

View file

@ -14,11 +14,10 @@ namespace Prebuild.Core.Nodes
{ {
#region Values #region Values
private string m_Name; private string m_Name;
private string m_Generator;
private bool m_AutoGen = true;
private string m_OutputName; private string m_OutputName;
private List<string> m_Libs = new(); private List<string> m_Libs = new();
#endregion #endregion
#region Methods #region Methods
@ -36,6 +35,8 @@ namespace Prebuild.Core.Nodes
} }
} }
SourceInSolution = Helper.ParseBoolean(node, "sourceInSolution", false);
} }
#endregion #endregion
@ -48,30 +49,6 @@ namespace Prebuild.Core.Nodes
} }
} }
public string Generator
{
get
{
return m_Generator;
}
}
public bool AutoGen
{
get
{
return m_AutoGen;
}
}
public string AutoGenerate
{
get
{
return AutoGen ? "True" : "False";
}
}
public string OutputName public string OutputName
{ {
get get
@ -88,6 +65,16 @@ namespace Prebuild.Core.Nodes
} }
} }
public bool SourceInSolution { get; private set; } = false;
public string SourceDirectory
{
get
{
return SourceInSolution ? "SolutionDir" : "ProjectDir";
}
}
#endregion #endregion
} }
} }

View file

@ -696,7 +696,7 @@ public abstract class VSGenericTarget : ITarget
string outputFile = Path.Combine(project.Path, node.OutputName); string outputFile = Path.Combine(project.Path, node.OutputName);
ps.WriteLine(" <Target Name=\"Prebuild\" BeforeTargets=\"PreBuildEvent\">"); ps.WriteLine(" <Target Name=\"Prebuild\" BeforeTargets=\"PreBuildEvent\">");
ps.WriteLine($" <Exec Command='dotnet \"$(SolutionDir){pathText}\" \"$(ProjectDir){node.Name}\" \"$(ProjectDir){node.OutputName}\" \"{node.Libraries}\"' />"); ps.WriteLine($" <Exec Command='dotnet \"$(SolutionDir){pathText}\" \"$({node.SourceDirectory}){node.Name}\" \"$(ProjectDir){node.OutputName}\" \"{node.Libraries}\"' />");
ps.WriteLine($" </Target>"); ps.WriteLine($" </Target>");
} }
} }