Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/npm_and_yarn/types/vscode-webvi…
Browse files Browse the repository at this point in the history
…ew-1.57.4
  • Loading branch information
ooeygui authored Jan 8, 2024
2 parents b3bc5a2 + e59d576 commit 89b4b34
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 21 deletions.
8 changes: 4 additions & 4 deletions src/build-tool/catkin-tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import * as extension from "../extension";
import * as common from "./common";
import * as rosShell from "./ros-shell";

function makeCatkin(command: string, args: string[], category?: string): vscode.Task {
const task = rosShell.make({type: command, command, args: ['--workspace', vscode.workspace.rootPath, ...args]}, category)
function makeCatkin(name: string, command: string, args: string[], category?: string): vscode.Task {
const task = rosShell.make(name, {type: command, command, args: ['--workspace', vscode.workspace.rootPath, ...args]}, category)
task.problemMatchers = ["$catkin-gcc"];

return task;
Expand All @@ -19,10 +19,10 @@ function makeCatkin(command: string, args: string[], category?: string): vscode.
*/
export class CatkinToolsProvider implements vscode.TaskProvider {
public provideTasks(token?: vscode.CancellationToken): vscode.ProviderResult<vscode.Task[]> {
const make = makeCatkin('catkin', [], 'build');
const make = makeCatkin('Catkin Tools - Build', 'catkin', [], 'build');
make.group = vscode.TaskGroup.Build;

const test = makeCatkin('catkin', ['--catkin-make-args', 'run_tests'], 'run_tests');
const test = makeCatkin('Catkin Tools - Test', 'catkin', ['--catkin-make-args', 'run_tests'], 'run_tests');
test.group = vscode.TaskGroup.Test;

return [make, test];
Expand Down
12 changes: 6 additions & 6 deletions src/build-tool/catkin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import * as extension from "../extension";
import * as common from "./common";
import * as rosShell from "./ros-shell";

function makeCatkin(command: string, args: string[], category?: string): vscode.Task {
const task = rosShell.make({type: command, command, args: ['--directory', vscode.workspace.rootPath, '-DCMAKE_BUILD_TYPE=RelWithDebInfo',...args]}, category)
function makeCatkin(name: string, command: string, args: string[], category?: string): vscode.Task {
const task = rosShell.make(name, {type: command, command, args: ['--directory', vscode.workspace.rootPath, '-DCMAKE_BUILD_TYPE=RelWithDebInfo',...args]}, category)
task.problemMatchers = ["$catkin-gcc"];

return task;
Expand All @@ -18,10 +18,10 @@ function makeCatkin(command: string, args: string[], category?: string): vscode.
*/
export class CatkinMakeProvider implements vscode.TaskProvider {
public provideTasks(token?: vscode.CancellationToken): vscode.ProviderResult<vscode.Task[]> {
const make = makeCatkin('catkin_make', [], 'build');
const make = makeCatkin('Catkin Build', 'catkin_make', [], 'build');
make.group = vscode.TaskGroup.Build;

const test = makeCatkin('catkin_make', ['run_tests'], 'run_tests');
const test = makeCatkin('Catkin Test', 'catkin_make', ['run_tests'], 'run_tests');
test.group = vscode.TaskGroup.Test;

return [make, test];
Expand All @@ -36,10 +36,10 @@ export class CatkinMakeProvider implements vscode.TaskProvider {
*/
export class CatkinMakeIsolatedProvider implements vscode.TaskProvider {
public provideTasks(token?: vscode.CancellationToken): vscode.ProviderResult<vscode.Task[]> {
const make = makeCatkin('catkin_make_isolated', [], 'build');
const make = makeCatkin('Catkin Build Isolated', 'catkin_make_isolated', [], 'build');
make.group = vscode.TaskGroup.Build;

const test = makeCatkin('catkin_make_isolated', ['--catkin-make-args', 'run_tests'], 'run_tests');
const test = makeCatkin('Catkin Test Isolated', 'catkin_make_isolated', ['--catkin-make-args', 'run_tests'], 'run_tests');
test.group = vscode.TaskGroup.Test;

return [make, test];
Expand Down
17 changes: 11 additions & 6 deletions src/build-tool/colcon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,15 @@ import * as common from "./common";
import * as rosShell from "./ros-shell";
import { env } from "process";

function makeColcon(command: string, verb: string, args: string[], category?: string): vscode.Task {
function makeColcon(name: string, command: string, verb: string, args: string[], category?: string): vscode.Task {
let installType = '--symlink-install';
if (process.platform === "win32") {

// Use Merge Install on Windows to support adminless builds and deployment.
installType = '--merge-install';
}

const task = rosShell.make({type: command, command, args: [verb, installType, '--event-handlers', 'console_cohesion+', '--base-paths', vscode.workspace.rootPath, `--cmake-args`, `-DCMAKE_BUILD_TYPE=RelWithDebInfo`,...args]},
category)
const task = rosShell.make(name, {type: command, command, args: [verb, installType, '--event-handlers', 'console_cohesion+', '--base-paths', vscode.workspace.rootPath, `--cmake-args`, ...args]}, category)
task.problemMatchers = ["$catkin-gcc"];

return task;
Expand All @@ -30,13 +29,19 @@ function makeColcon(command: string, verb: string, args: string[], category?: st
*/
export class ColconProvider implements vscode.TaskProvider {
public provideTasks(token?: vscode.CancellationToken): vscode.ProviderResult<vscode.Task[]> {
const make = makeColcon('colcon', 'build', [], 'build');
const make = makeColcon('Colcon Build Release', 'colcon', 'build', [`-DCMAKE_BUILD_TYPE=RelWithDebInfo`], 'build');
make.group = vscode.TaskGroup.Build;

const test = makeColcon('colcon', 'test', [], 'test');
const makeDebug = makeColcon('Colcon Build Debug', 'colcon', 'build', [`-DCMAKE_BUILD_TYPE=Debug`], 'build');
makeDebug.group = vscode.TaskGroup.Build;

const test = makeColcon('Colcon Build Test Release', 'colcon', 'test', [`-DCMAKE_BUILD_TYPE=RelWithDebInfo`], 'test');
test.group = vscode.TaskGroup.Test;

return [make, test];
const testDebug = makeColcon('Colcon Build Test Debug', 'colcon', 'test', [`-DCMAKE_BUILD_TYPE=Debug`], 'test');
test.group = vscode.TaskGroup.Test;

return [make, makeDebug, test, testDebug];
}

public resolveTask(task: vscode.Task, token?: vscode.CancellationToken): vscode.ProviderResult<vscode.Task> {
Expand Down
10 changes: 5 additions & 5 deletions src/build-tool/ros-shell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ export class RosShellTaskProvider implements vscode.TaskProvider {
}

public defaultRosTasks(): vscode.Task[] {
const rosCore = make({type: 'ros', command: 'roscore'}, 'roscore');
const rosCore = make('ros core', {type: 'ros', command: 'roscore'}, 'roscore');
rosCore.isBackground = true;
rosCore.problemMatchers = ['$roscore'];

const rosLaunch = make({type: 'ros', command: 'roslaunch', args: ['package_name', 'launch_file.launch']}, 'roslaunch');
const rosLaunch = make('ros launch', {type: 'ros', command: 'roslaunch', args: ['package_name', 'launch_file.launch']}, 'roslaunch');
rosLaunch.isBackground = true;
rosLaunch.problemMatchers = ['$roslaunch'];

Expand All @@ -39,18 +39,18 @@ export function registerRosShellTaskProvider(): vscode.Disposable[] {
}

export function resolve(task: vscode.Task): vscode.Task {
const resolvedTask = make(task.definition as RosTaskDefinition);
let definition = task.definition as RosTaskDefinition
const resolvedTask = make(definition.command, definition);

resolvedTask.isBackground = task.isBackground;
resolvedTask.problemMatchers = task.problemMatchers;
return resolvedTask;
}

export function make(definition: RosTaskDefinition, category?: string): vscode.Task {
export function make(name: string, definition: RosTaskDefinition, category?: string): vscode.Task {
definition.command = definition.command || definition.type; // Command can be missing in build tasks that have type==command

const args = definition.args || [];
const name = category ? category : args.join(' ');
const task = new vscode.Task(definition, vscode.TaskScope.Workspace, name, definition.command);

task.execution = new vscode.ShellExecution(definition.command, args, {
Expand Down

0 comments on commit 89b4b34

Please sign in to comment.