Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import { injectable, inject } from "inversify";
import { CommandContribution, CommandRegistry, MenuContribution, MenuModelRegistry, MessageService } from "@theia/core/lib/common";
import { CommonMenus } from "@theia/core/lib/browser";
import { TaskConfiguration } from '@theia/task/lib/common';
import { TaskService } from '@theia/task/lib/browser/task-service';
export const TheiaWebsdkExtensionCommand = {
id: 'TheiaWebsdkExtension.command',
label: "Build drivers"
};
const buildSteps: TaskConfiguration[] = [
{
"_scope": "", // use a proper scope.
"label": "Run qmake",
"type": "shell",
"command": "/usr/lib/x86_64-linux-gnu/qt5/bin/qmake",
"args": [
"/home/costof2/git/costof2_sensorsdk/Costof2_Emulator.pro",
"-spec",
"linux-g++",
"CONFIG+=debug",
"CONFIG+=qml_debug"
],
"options": {
"cwd": "/home/costof2/git/costof2_sensorsdk"
}
},
{
"_scope": "", // use a proper scope.
"label": "Run make qmake_all",
"type": "shell",
"command": "/usr/bin/make",
"args": [
"qmake_all"
],
"options": {
"cwd": "/home/costof2/git/costof2_sensorsdk"
}
},
{
"_scope": "", // use a proper scope.
"label": "Run make",
"type": "shell",
"command": "/usr/bin/make",
"args": [
"-j2"
],
"options": {
"cwd": "/home/costof2/git/build-Costof2_Emulator-Desktop-Debug"
}
}
];
@injectable()
export class TheiaWebsdkExtensionCommandContribution implements CommandContribution {
constructor(
@inject(MessageService) private readonly messageService: MessageService,
@inject(TaskService) private readonly taskService: TaskService,
) { }
registerCommands(registry: CommandRegistry): void {
registry.registerCommand(TheiaWebsdkExtensionCommand, {
execute: () => {
this.taskService.runTask(buildSteps[0]);
this.messageService.info('Build started.');
}
});
}
}
@injectable()
export class TheiaWebsdkExtensionMenuContribution implements MenuContribution {
registerMenus(menus: MenuModelRegistry): void {
menus.registerMenuAction(CommonMenus.EDIT_FIND, {
commandId: TheiaWebsdkExtensionCommand.id,
label: TheiaWebsdkExtensionCommand.label
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment