1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 12:32:20 +02:00

Refactored prebuild/postbuild command handling

This commit is contained in:
Brian Fiete 2021-02-12 05:50:10 -08:00
parent 85c9a6ebc8
commit b356e4735c
3 changed files with 32 additions and 12 deletions

View file

@ -118,7 +118,7 @@ namespace IDE
bool didCommands = false;
let targetName = scope String("Project ", project.mProjectName);
//let targetName = scope String("Project ", project.mProjectName);
//Console.WriteLine("Executing custom command {0} {1} {2}", highestDateTime, targetDateTime, forceRebuild);
for (let origCustomCmd in cmdList)
@ -159,19 +159,13 @@ namespace IDE
didCommands = true;
}
mScriptManager.QueueCommands(customCmd, scope String()..AppendF("project {}", project.mProjectName), .NoLines);
let scriptCmd = new IDEApp.ScriptCmd();
scriptCmd.mCmd = new String(customCmd);
scriptCmd.mPath = new $"project {project.mProjectName}";
gApp.mExecutionQueue.Add(scriptCmd);
continue;
}
let targetCompleteCmd = new IDEApp.TargetCompletedCmd(project);
if (didCommands)
{
mScriptManager.QueueCommands(scope String()..AppendF("%targetComplete {}", project.mProjectName), targetName, .NoLines);
targetCompleteCmd.mIsReady = false;
project.mNeedsTargetRebuild = true;
}
gApp.mExecutionQueue.Add(targetCompleteCmd);
return didCommands ? .HadCommands : .NoCommands;
}

View file

@ -435,6 +435,12 @@ namespace IDE
}
}
public class ScriptCmd : ExecutionCmd
{
public String mCmd ~ delete _;
public String mPath ~ delete _;
}
public enum ArgsFileKind
{
None,
@ -8257,6 +8263,21 @@ namespace IDE
}
}
if (let scriptCmd = next as ScriptCmd)
{
if (mBuildContext?.mScriptManager != null)
{
if (scriptCmd.mCmd != null)
{
mBuildContext.mScriptManager.QueueCommands(scriptCmd.mCmd, scriptCmd.mPath, .NoLines);
DeleteAndNullify!(scriptCmd.mCmd);
}
if (mBuildContext.mScriptManager.HasQueuedCommands)
return;
}
}
defer delete next;
mExecutionQueue.RemoveAt(0);
@ -8412,6 +8433,11 @@ namespace IDE
if (gApp.mDebugger.mIsRunning)
mProfilePanel.StartProfiling(profileCmd.mThreadId, profileCmd.mDesc, profileCmd.mSampleRate);
}
else if (var scriptCmd = next as ScriptCmd)
{
// Already handled
(void)scriptCmd;
}
else
{
Runtime.FatalError("Unknown command");

View file

@ -1007,7 +1007,7 @@ namespace IDE
if (!gApp.[Friend]mExecutionQueue.IsEmpty)
{
var nextCmd = gApp.mExecutionQueue[0];
if (!(nextCmd is IDEApp.TargetCompletedCmd))
if (!(nextCmd is IDEApp.ScriptCmd))
return false;
}