@@ -28,7 +28,9 @@ enum CommandType {
28
28
build = "build" ,
29
29
config = "configure" ,
30
30
install = "install" ,
31
- test = "test"
31
+ test = "test" ,
32
+ clean = "clean" ,
33
+ cleanRebuild = "cleanRebuild"
32
34
}
33
35
34
36
const localizeCommandType = ( cmd : CommandType ) : string => {
@@ -45,6 +47,12 @@ const localizeCommandType = (cmd: CommandType): string => {
45
47
case CommandType . config : {
46
48
return localize ( "configure" , "configure" ) ;
47
49
}
50
+ case CommandType . clean : {
51
+ return localize ( "clean" , "clean" ) ;
52
+ }
53
+ case CommandType . cleanRebuild : {
54
+ return localize ( "clean.rebuild" , "clean rebuild" ) ;
55
+ }
48
56
default : {
49
57
return "" ;
50
58
}
@@ -79,6 +87,8 @@ export class CMakeTaskProvider implements vscode.TaskProvider {
79
87
result . push ( await this . provideTask ( CommandType . config ) ) ;
80
88
result . push ( await this . provideTask ( CommandType . install ) ) ;
81
89
result . push ( await this . provideTask ( CommandType . test ) ) ;
90
+ result . push ( await this . provideTask ( CommandType . clean ) ) ;
91
+ result . push ( await this . provideTask ( CommandType . cleanRebuild ) ) ;
82
92
return result ;
83
93
}
84
94
@@ -151,6 +161,12 @@ class CustomBuildTaskTerminal implements vscode.Pseudoterminal, proc.OutputConsu
151
161
case CommandType . test :
152
162
await this . runTestTask ( ) ;
153
163
break ;
164
+ case CommandType . clean :
165
+ await this . runCleanTask ( ) ;
166
+ break ;
167
+ case CommandType . cleanRebuild :
168
+ await this . runCleanRebuildTask ( ) ;
169
+ break ;
154
170
default :
155
171
this . writeEmitter . fire ( localize ( "command.not.recognized" , '{0} is not a recognized command.' , `"${ this . command } "` ) + endOfLine ) ;
156
172
this . closeEmitter . fire ( - 1 ) ;
@@ -220,8 +236,20 @@ class CustomBuildTaskTerminal implements vscode.Pseudoterminal, proc.OutputConsu
220
236
}
221
237
222
238
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 ) ;
224
240
const result : number | undefined = await vscode . commands . executeCommand ( 'cmake.ctest' ) ;
225
241
this . closeEmitter . fire ( result ? result : - 1 ) ;
226
242
}
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
+ }
227
255
}
0 commit comments