From bb2fe56dc9c079888cfebc9e5346c7774e51819b Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Mon, 8 Feb 2021 17:46:22 -0800 Subject: [PATCH] Reordered postbuild commands to occur after all linking --- IDE/src/BuildContext.bf | 49 ++++++++++++++++++++++++----------------- IDE/src/IDEApp.bf | 6 +++++ 2 files changed, 35 insertions(+), 20 deletions(-) diff --git a/IDE/src/BuildContext.bf b/IDE/src/BuildContext.bf index 571ccaeb..15c4fe20 100644 --- a/IDE/src/BuildContext.bf +++ b/IDE/src/BuildContext.bf @@ -29,12 +29,8 @@ namespace IDE public int32 mUpdateCnt; public Project mHotProject; public Workspace.Options mWorkspaceOptions; - public Dictionary mImpLibMap = new .() ~ - { - for (let val in _.Values) - delete val; - delete _; - }; + public Dictionary mImpLibMap = new .() ~ DeleteDictionaryAndValues!(_); + public Dictionary mTargetPathMap = new .() ~ DeleteDictionaryAndValues!(_); public ScriptManager.Context mScriptContext = new .() ~ _.ReleaseLastRef(); public ScriptManager mScriptManager ~ delete _; @@ -1218,6 +1214,8 @@ namespace IDE } } + mTargetPathMap[project] = new String(targetPath); + if (hotProject == null) { switch (QueueProjectCustomBuildCommands(project, targetPath, compileKind.WantsRunAfter ? options.mBuildOptions.mBuildCommandsOnRun : options.mBuildOptions.mBuildCommandsOnCompile, options.mBuildOptions.mPreBuildCmds)) @@ -1228,22 +1226,9 @@ namespace IDE completedCompileCmd.mFailed = true; } } - - void DoPostBuild() - { - switch (QueueProjectCustomBuildCommands(project, targetPath, compileKind.WantsRunAfter ? options.mBuildOptions.mBuildCommandsOnRun : options.mBuildOptions.mBuildCommandsOnCompile, options.mBuildOptions.mPostBuildCmds)) - { - case .NoCommands: - case .HadCommands: - case .Failed: - completedCompileCmd.mFailed = true; - } - } if (project.mGeneralOptions.mTargetType == .CustomBuild) { - if (hotProject == null) - DoPostBuild(); return true; } @@ -1404,8 +1389,32 @@ namespace IDE return false; } - DoPostBuild(); return true; } + + public bool QueueProjectPostBuild(Project project, Project hotProject, IDEApp.BuildCompletedCmd completedCompileCmd, List hotFileNames, CompileKind compileKind) + { + if (hotProject != null) + return true; + + Project.Options options = gApp.GetCurProjectOptions(project); + if (options == null) + return true; + + String targetPath = null; + mTargetPathMap.TryGetValue(project, out targetPath); + if (targetPath == null) + return false; + + switch (QueueProjectCustomBuildCommands(project, targetPath, compileKind.WantsRunAfter ? options.mBuildOptions.mBuildCommandsOnRun : options.mBuildOptions.mBuildCommandsOnCompile, options.mBuildOptions.mPostBuildCmds)) + { + case .NoCommands: + case .HadCommands: + case .Failed: + completedCompileCmd.mFailed = true; + } + + return true; + } } } diff --git a/IDE/src/IDEApp.bf b/IDE/src/IDEApp.bf index 0cdaae19..f31ad44c 100644 --- a/IDE/src/IDEApp.bf +++ b/IDE/src/IDEApp.bf @@ -10252,6 +10252,12 @@ namespace IDE success = false; } + for (var project in orderedProjectList) + { + if (!mBuildContext.QueueProjectPostBuild(project, hotProject, completedCompileCmd, hotFileNames, compileKind)) + success = false; + } + if (hotFileNames.Count > 0) { // Why were we rehupping BEFORE hotLoad?