From a5156d1fccb3984d7c0bfa5dd70f1bfc1c3ec917 Mon Sep 17 00:00:00 2001 From: piomis Date: Tue, 10 Jan 2023 21:14:49 +0100 Subject: [PATCH 1/4] fix: comparison of Build type tasks for ones with "isDefault" option set --- src/cmakeTaskProvider.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cmakeTaskProvider.ts b/src/cmakeTaskProvider.ts index 6e86c036f..b282a1104 100644 --- a/src/cmakeTaskProvider.ts +++ b/src/cmakeTaskProvider.ts @@ -190,7 +190,7 @@ export class CMakeTaskProvider implements vscode.TaskProvider { // Fetch all CMake task from `tasks.json` files. const allTasks: vscode.Task[] = await vscode.tasks.fetchTasks({ type: CMakeTaskProvider.CMakeScriptType }); const tasks: (CMakeTask | undefined)[] = allTasks.map((task: any) => { - if (!task.definition.label || !task.group || (task.group && task.group !== vscode.TaskGroup.Build)) { + if (!task.definition.label || !task.group || (task.group && task.group.id !== vscode.TaskGroup.Build.id)) { return undefined; } const definition: CMakeTaskDefinition = { @@ -236,7 +236,7 @@ export class CMakeTaskProvider implements vscode.TaskProvider { return matchingTargetTasks[0]; } else { // Search for the matching default task. - const defaultTask: CMakeTask[] = matchingTargetTasks.filter(task => task.group?.isDefault); + const defaultTask: CMakeTask[] = matchingTargetTasks.filter(task => task.isDefault); if (defaultTask.length === 1) { return defaultTask[0]; } else { From 35cb7b749845f5e232eb5adfa81c4c4942637912 Mon Sep 17 00:00:00 2001 From: piomis Date: Tue, 10 Jan 2023 21:21:16 +0100 Subject: [PATCH 2/4] doc: update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d041f91c8..4821d6b0f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ Bug Fixes: - Quote launch arguments sent to the terminal if they have special characters. [#2898](https://github.com/microsoft/vscode-cmake-tools/issues/2898) - CMake Tools should choose cmake.exe from the newest VS when it's not found in the PATH. [#2753](https://github.com/microsoft/vscode-cmake-tools/issues/2753) - Calling build targets from CMake Project Outline always builds default target if useTasks option is set. [#2778](https://github.com/microsoft/vscode-cmake-tools/issues/2768) [@piomis]](https://github.com/piomis) +- Build command is not able to properly pick-up tasks from tasks.json file if configured with isDefault option. [#2935](https://github.com/microsoft/vscode-cmake-tools/issues/2935) [@piomis]](https://github.com/piomis) ## 1.12.27 Bug Fixes: From 619a4551627768b2960b057aeb56db3b28771489 Mon Sep 17 00:00:00 2001 From: piomis Date: Thu, 12 Jan 2023 16:51:42 +0100 Subject: [PATCH 3/4] fix: cancelation of running build task --- CHANGELOG.md | 2 +- src/cmakeBuildRunner.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4821d6b0f..b19bf27d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,7 +26,7 @@ Bug Fixes: - Quote launch arguments sent to the terminal if they have special characters. [#2898](https://github.com/microsoft/vscode-cmake-tools/issues/2898) - CMake Tools should choose cmake.exe from the newest VS when it's not found in the PATH. [#2753](https://github.com/microsoft/vscode-cmake-tools/issues/2753) - Calling build targets from CMake Project Outline always builds default target if useTasks option is set. [#2778](https://github.com/microsoft/vscode-cmake-tools/issues/2768) [@piomis]](https://github.com/piomis) -- Build command is not able to properly pick-up tasks from tasks.json file if configured with isDefault option. [#2935](https://github.com/microsoft/vscode-cmake-tools/issues/2935) [@piomis]](https://github.com/piomis) +- Build command is not able to properly pick-up tasks from tasks.json file if configured with isDefault option and cancellation of running build task is not working. [#2935](https://github.com/microsoft/vscode-cmake-tools/issues/2935) [@piomis]](https://github.com/piomis) ## 1.12.27 Bug Fixes: diff --git a/src/cmakeBuildRunner.ts b/src/cmakeBuildRunner.ts index 7f72c4a4b..9b3322e9a 100644 --- a/src/cmakeBuildRunner.ts +++ b/src/cmakeBuildRunner.ts @@ -36,6 +36,7 @@ export class CMakeBuildRunner { this.currentBuildProcess = { child: undefined, result: new Promise(resolve => { const disposable: vscode.Disposable = vscode.tasks.onDidEndTask((endEvent: vscode.TaskEndEvent) => { if (endEvent.execution === this.taskExecutor) { + this.taskExecutor = undefined; disposable.dispose(); resolve({ retc: 0, stdout: '', stderr: '' }); } @@ -53,7 +54,6 @@ export class CMakeBuildRunner { } if (this.taskExecutor) { this.taskExecutor.terminate(); - this.taskExecutor = undefined; } } From fb286e726f0fd518eaae5557957bf2afa80b3d41 Mon Sep 17 00:00:00 2001 From: "Bob Brown (DEVDIV)" Date: Thu, 12 Jan 2023 10:42:11 -0800 Subject: [PATCH 4/4] fix changelog --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6486dbfd6..7b8ca6fa0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,7 +26,8 @@ Bug Fixes: - Quote launch arguments sent to the terminal if they have special characters. [#2898](https://github.com/microsoft/vscode-cmake-tools/issues/2898) - CMake Tools should choose cmake.exe from the newest VS when it's not found in the PATH. [#2753](https://github.com/microsoft/vscode-cmake-tools/issues/2753) - Calling build targets from CMake Project Outline always builds default target if useTasks option is set. [#2778](https://github.com/microsoft/vscode-cmake-tools/issues/2768) [@piomis]](https://github.com/piomis) -- Remove the default path for `cmake.mingwSearchDirs` since the path is world-writable. [PR #2942](https://github.com/microsoft/vscode-cmake-tools/pull/2942)- Build command is not able to properly pick-up tasks from tasks.json file if configured with isDefault option and cancellation of running build task is not working. [#2935](https://github.com/microsoft/vscode-cmake-tools/issues/2935) [@piomis]](https://github.com/piomis) +- Remove the default path for `cmake.mingwSearchDirs` since the path is world-writable. [PR #2942](https://github.com/microsoft/vscode-cmake-tools/pull/2942) +- Build command is not able to properly pick-up tasks from tasks.json file if configured with isDefault option and cancellation of running build task is not working. [#2935](https://github.com/microsoft/vscode-cmake-tools/issues/2935) [@piomis]](https://github.com/piomis) ## 1.12.27 Bug Fixes: