Skip to content

Commit daa99c0

Browse files
Merge branch 'main' into elrashed/apiv6
2 parents 60575f5 + fda9640 commit daa99c0

File tree

3 files changed

+35
-4
lines changed

3 files changed

+35
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ Improvements:
88
- Add c++23 support. [#2475](https://github.com/microsoft/vscode-cmake-tools/issues/2475) [@sweemer](https://github.com/sweemer)
99
- Add support for multiple targets in the CMake task provider. [#2122](https://github.com/microsoft/vscode-cmake-tools/issues/2122)
1010
- Add setting `cmake.showSystemKits`. [PR #2520](https://github.com/microsoft/vscode-cmake-tools/pull/2520) [@bharatvaj](https://github.com/bharatvaj)
11-
- Add support for "configure", "install" and "test" task. [#2452](https://github.com/microsoft/vscode-cmake-tools/issues/2452)
11+
- Add support for "Configure", "Install" and "Test" tasks. [#2452](https://github.com/microsoft/vscode-cmake-tools/issues/2452)
1212
- Add setting `cmake.ignoreCMakeListsMissing`. [PR #2537](https://github.com/microsoft/vscode-cmake-tools/pull/2537) [@ilg-ul](https://github.com/ilg-ul)
13+
- Add support for "Clean" and "Clean Rebuild" tasks. [#2555](https://github.com/microsoft/vscode-cmake-tools/issues/2555)
1314

1415
Bug Fixes:
1516
- `Clean All Projects` menu item builds rather than cleans. [#2460](https://github.com/microsoft/vscode-cmake-tools/issues/2460)

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,9 @@
539539
"build",
540540
"configure",
541541
"install",
542-
"test"
542+
"test",
543+
"clean",
544+
"cleanRebuild"
543545
],
544546
"description": "CMake build command"
545547
},

src/cmakeTaskProvider.ts

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ enum CommandType {
2828
build = "build",
2929
config = "configure",
3030
install = "install",
31-
test = "test"
31+
test = "test",
32+
clean = "clean",
33+
cleanRebuild = "cleanRebuild"
3234
}
3335

3436
const localizeCommandType = (cmd: CommandType): string => {
@@ -45,6 +47,12 @@ const localizeCommandType = (cmd: CommandType): string => {
4547
case CommandType.config: {
4648
return localize("configure", "configure");
4749
}
50+
case CommandType.clean: {
51+
return localize("clean", "clean");
52+
}
53+
case CommandType.cleanRebuild: {
54+
return localize("clean.rebuild", "clean rebuild");
55+
}
4856
default: {
4957
return "";
5058
}
@@ -79,6 +87,8 @@ export class CMakeTaskProvider implements vscode.TaskProvider {
7987
result.push(await this.provideTask(CommandType.config));
8088
result.push(await this.provideTask(CommandType.install));
8189
result.push(await this.provideTask(CommandType.test));
90+
result.push(await this.provideTask(CommandType.clean));
91+
result.push(await this.provideTask(CommandType.cleanRebuild));
8292
return result;
8393
}
8494

@@ -151,6 +161,12 @@ class CustomBuildTaskTerminal implements vscode.Pseudoterminal, proc.OutputConsu
151161
case CommandType.test:
152162
await this.runTestTask();
153163
break;
164+
case CommandType.clean:
165+
await this.runCleanTask();
166+
break;
167+
case CommandType.cleanRebuild:
168+
await this.runCleanRebuildTask();
169+
break;
154170
default:
155171
this.writeEmitter.fire(localize("command.not.recognized", '{0} is not a recognized command.', `"${this.command}"`) + endOfLine);
156172
this.closeEmitter.fire(-1);
@@ -220,8 +236,20 @@ class CustomBuildTaskTerminal implements vscode.Pseudoterminal, proc.OutputConsu
220236
}
221237

222238
private async runTestTask(): Promise<any> {
223-
this.writeEmitter.fire(localize("Test.started", "Test Started...") + endOfLine);
239+
this.writeEmitter.fire(localize("test.started", "Test Started...") + endOfLine);
224240
const result: number | undefined = await vscode.commands.executeCommand('cmake.ctest');
225241
this.closeEmitter.fire(result ? result : -1);
226242
}
243+
244+
private async runCleanTask(): Promise<any> {
245+
this.writeEmitter.fire(localize("clean.started", "Clean Started...") + endOfLine);
246+
const result: number | undefined = await vscode.commands.executeCommand('cmake.clean');
247+
this.closeEmitter.fire(result ? result : -1);
248+
}
249+
250+
private async runCleanRebuildTask(): Promise<any> {
251+
this.writeEmitter.fire(localize("clean.rebuild.started", "Clean Rebuild Started...") + endOfLine);
252+
const result: number | undefined = await vscode.commands.executeCommand('cmake.cleanRebuild');
253+
this.closeEmitter.fire(result ? result : -1);
254+
}
227255
}

0 commit comments

Comments
 (0)