| 144 | } |
| 145 | |
| 146 | void BuildProjectTool::onBuildQueueFinished(bool success) |
| 147 | { |
| 148 | QList<ProjectExplorer::Project *> projectsToCleanup; |
| 149 | |
| 150 | for (auto it = m_activeBuilds.begin(); it != m_activeBuilds.end(); ++it) { |
| 151 | ProjectExplorer::Project *project = it.key(); |
| 152 | |
| 153 | if (!ProjectExplorer::BuildManager::isBuilding(project)) { |
| 154 | BuildInfo &info = it.value(); |
| 155 | |
| 156 | if (info.promise && info.promise->future().isCanceled()) { |
| 157 | LOG_MESSAGE(QString("BuildProjectTool: Build cancelled for project '%1'") |
| 158 | .arg(info.projectName)); |
| 159 | projectsToCleanup.append(project); |
| 160 | continue; |
| 161 | } |
| 162 | |
| 163 | QString result = collectBuildResults(success, info.projectName, info.isRebuild); |
| 164 | |
| 165 | if (success && info.runAfterBuild) { |
| 166 | scheduleProjectRun(project, info.projectName, result); |
| 167 | } else if (!success && info.runAfterBuild) { |
| 168 | result += QString("\n\nProject was not started due to build failure."); |
| 169 | } |
| 170 | |
| 171 | if (info.promise) { |
| 172 | info.promise->addResult(LLMQore::ToolResult::text(result)); |
| 173 | info.promise->finish(); |
| 174 | } |
| 175 | |
| 176 | projectsToCleanup.append(project); |
| 177 | } |
| 178 | } |
| 179 | |
| 180 | for (ProjectExplorer::Project *project : projectsToCleanup) { |
| 181 | cleanupBuildInfo(project); |
| 182 | } |
| 183 | } |
| 184 | |
| 185 | void BuildProjectTool::scheduleProjectRun(ProjectExplorer::Project *project, |
| 186 | const QString &projectName, |