diff --git a/Source/Tools/Flax.Build/Build/Graph/LocalExecutor.cs b/Source/Tools/Flax.Build/Build/Graph/LocalExecutor.cs
index 5bf6908e7..20aa2e502 100644
--- a/Source/Tools/Flax.Build/Build/Graph/LocalExecutor.cs
+++ b/Source/Tools/Flax.Build/Build/Graph/LocalExecutor.cs
@@ -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();
diff --git a/Source/Tools/Flax.Build/Build/Graph/Task.cs b/Source/Tools/Flax.Build/Build/Graph/Task.cs
index 363a2e40e..2c3e2540f 100644
--- a/Source/Tools/Flax.Build/Build/Graph/Task.cs
+++ b/Source/Tools/Flax.Build/Build/Graph/Task.cs
@@ -26,6 +26,11 @@ namespace Flax.Build.Graph
///
public string WorkingDirectory = string.Empty;
+ ///
+ /// The command to call upon task execution.
+ ///
+ public Action Command;
+
///
/// The command to run to create produced files.
///