Add support for custom Action Command in TaskGraph
This commit is contained in:
@@ -184,18 +184,6 @@ namespace Flax.Build.BuildSystem.Graph
|
||||
name = Path.GetFileName(task.ProducedFiles[0]);
|
||||
var profilerEvent = Profiling.Begin(name);
|
||||
|
||||
var startInfo = new ProcessStartInfo
|
||||
{
|
||||
WorkingDirectory = task.WorkingDirectory,
|
||||
FileName = task.CommandPath,
|
||||
Arguments = task.CommandArguments,
|
||||
UseShellExecute = false,
|
||||
RedirectStandardInput = false,
|
||||
RedirectStandardOutput = true,
|
||||
RedirectStandardError = true,
|
||||
CreateNoWindow = true,
|
||||
};
|
||||
|
||||
if (Configuration.Verbose)
|
||||
{
|
||||
lock (_locker)
|
||||
@@ -212,13 +200,42 @@ namespace Flax.Build.BuildSystem.Graph
|
||||
Log.Info(task.InfoMessage);
|
||||
}
|
||||
|
||||
// Custom action execution (eg. instead of executable file run)
|
||||
if (task.Command != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
task.Command();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Exception(ex);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (task.CommandPath == null)
|
||||
{
|
||||
Profiling.End(profilerEvent);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Process process = null;
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
process = new Process();
|
||||
process.StartInfo = startInfo;
|
||||
process.StartInfo = new ProcessStartInfo
|
||||
{
|
||||
WorkingDirectory = task.WorkingDirectory,
|
||||
FileName = task.CommandPath,
|
||||
Arguments = task.CommandArguments,
|
||||
UseShellExecute = false,
|
||||
RedirectStandardInput = false,
|
||||
RedirectStandardOutput = true,
|
||||
RedirectStandardError = true,
|
||||
CreateNoWindow = true,
|
||||
};
|
||||
process.OutputDataReceived += ProcessDebugOutput;
|
||||
process.ErrorDataReceived += ProcessDebugOutput;
|
||||
process.Start();
|
||||
|
||||
Reference in New Issue
Block a user