Skip to content

Commit

Permalink
❇️ buildKit api (#979)
Browse files Browse the repository at this point in the history
* ❇️ buildKit api
  • Loading branch information
xgdgsc authored and bobbrow committed Dec 23, 2019
1 parent 1cfc884 commit df7295a
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"onCommand:cmake.launchTargetDirectory",
"onCommand:cmake.buildType",
"onCommand:cmake.buildDirectory",
"onCommand:cmake.buildKit",
"onCommand:cmake.tasksBuildCommand",
"onCommand:cmake.quickStart",
"onCommand:cmake.resetState",
Expand Down Expand Up @@ -1118,4 +1119,4 @@
"handlebars": "^4.5.3",
"https-proxy-agent": "^2.2.4"
}
}
}
5 changes: 5 additions & 0 deletions src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,4 +303,9 @@ export interface CMakeToolsAPI extends Disposable {
* Get the build command string for the active target
*/
tasksBuildCommand(): Thenable<string|null>;

/**
* Get the build kit
*/
buildKit(): Thenable<string|null>;
}
11 changes: 11 additions & 0 deletions src/cmake-tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1051,6 +1051,17 @@ export class CMakeTools implements vscode.Disposable, api.CMakeToolsAPI {
}
}

/**
* Implementation of `cmake.buildKit`
*/
async buildKit(): Promise<string|null> {
if (this.activeKit) {
return this.activeKit.name;
} else {
return null;
}
}

async prepareLaunchTargetExecutable(name?: string): Promise<api.ExecutableTarget|null> {
let chosen: api.ExecutableTarget;
if (name) {
Expand Down
3 changes: 3 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1166,6 +1166,8 @@ class ExtensionManager implements vscode.Disposable {

buildDirectory() { return this.withCMakeTools(null, cmt => cmt.buildDirectory()); }

buildKit() {return this.withCMakeTools(null, cmt => cmt.buildKit()); }

tasksBuildCommand() { return this.withCMakeTools(null, cmt => cmt.tasksBuildCommand()); }

debugTarget(name?: string) { return this.withCMakeTools(null, cmt => cmt.debugTarget(name)); }
Expand Down Expand Up @@ -1249,6 +1251,7 @@ async function setup(context: vscode.ExtensionContext, progress: ProgressHandle)
'launchTargetDirectory',
'buildType',
'buildDirectory',
'buildKit',
'debugTarget',
'launchTarget',
'selectLaunchTarget',
Expand Down

0 comments on commit df7295a

Please sign in to comment.