Skip to content

Commit 8e19cd6

Browse files
Fix Issue #4421 - always clean rebuild (#4605)
1 parent 0a68354 commit 8e19cd6

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ Bug Fixes:
4747
- Fix kits from `cmake.additionalKits` not being shown when `cmake.showSystemKits` is `false`. [#4651](https://github.com/microsoft/vscode-cmake-tools/issues/4651)
4848
- Fix how `jobs` is handled in build presets. Also update how `cmake.parallelJobs` is handled as a fallback when a build preset does not define `jobs`. [#4176](https://github.com/microsoft/vscode-cmake-tools/issues/4176)
4949
- Fix diagnostics to handle when there isn't a command in the error output. [PR #4765](https://github.com/microsoft/vscode-cmake-tools/pull/4765)
50+
- Fix bug in which running "CMake: Build" would always run "CMake: Clean Rebuild" when `cmake.buildTask` is enabled [#4421](https://github.com/microsoft/vscode-cmake-tools/issues/4421) [@RedSkittleFox](https://github.com/RedSkittleFox)
5051

5152
## 1.22.28
5253

src/cmakeTaskProvider.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -330,11 +330,15 @@ export class CMakeTaskProvider implements vscode.TaskProvider {
330330
if (defaultTask.length >= 1) {
331331
return defaultTask[0];
332332
} else {
333+
// If there are two tasks, both of them are templates, either build or clean rebuild, select the build one - the first one
334+
if (matchingTargetTasks.length === 2) {
335+
return matchingTargetTasks[0];
336+
}
333337
// If there is no default task, matchingTargetTasks is a mixture of template and defined tasks.
334338
// If there is only one task, that task is a template, so return the template.
335-
// If there are only two tasks, the first one is always a template, and the second one is the defined task that we are searching for.
336-
// But if there are more than two tasks, it means that there are multiple defiend tasks and none are set as default. So ask the user to choose one later.
337-
if (matchingTargetTasks.length === 1 || matchingTargetTasks.length === 2) {
339+
// If there are three tasks, the first two are always templates, and the third one is the defined task that we are searching for.
340+
// But if there are more than three tasks, it means that there are multiple defiend tasks and none are set as default. So ask the user to choose one later.
341+
if (matchingTargetTasks.length === 1 || matchingTargetTasks.length === 3) {
338342
return matchingTargetTasks[matchingTargetTasks.length - 1];
339343
}
340344
}

0 commit comments

Comments
 (0)