in src/bazel/tasks.ts [34:78]
export function createBazelTask(
command: "build" | "clean" | "test",
options: IBazelCommandOptions,
): vscode.Task {
const bazelConfigCmdLine = vscode.workspace.getConfiguration("bazel.commandLine");
const startupOptions = bazelConfigCmdLine.get<string[]>("startupOptions");
const addCommandArgs = command === "build" || command === "test";
const commandArgs =
(addCommandArgs ? bazelConfigCmdLine.get<string[]>("commandArgs") : []);
const args = startupOptions
.concat([command as string])
.concat(commandArgs)
.concat(options.targets)
.concat(options.options)
.map(quotedOption);
let commandDescription: string;
switch (command) {
case "build":
commandDescription = "Build";
break;
case "clean":
commandDescription = "Clean";
break;
case "test":
commandDescription = "Test";
break;
}
const targetsDescription = options.targets.join(", ");
const task = new vscode.Task(
{ type: "bazel", command, targets: options.targets },
// TODO(allevato): Change Workspace to Global once the fix for
// Microsoft/vscode#63951 is in a stable release.
options.workspaceInfo.workspaceFolder || vscode.TaskScope.Workspace,
`${commandDescription} ${targetsDescription}`,
"bazel",
new vscode.ShellExecution(getDefaultBazelExecutablePath(), args, {
cwd: options.workspaceInfo.bazelWorkspacePath,
}),
);
setBazelTaskInfo(task, new BazelTaskInfo(command, options));
return task;
}