UNPKG

@theia/task

Version:

Theia - Task extension. This extension adds support for executing raw or terminal processes in the backend.

157 lines • 5.83 kB
"use strict"; // ***************************************************************************** // Copyright (C) 2019 Ericsson and others. // // This program and the accompanying materials are made available under the // terms of the Eclipse Public License v. 2.0 which is available at // http://www.eclipse.org/legal/epl-2.0. // // This Source Code may also be made available under the following Secondary // Licenses when the conditions for such availability set forth in the Eclipse // Public License v. 2.0 are satisfied: GNU General Public License, version 2 // with the GNU Classpath Exception which is available at // https://www.gnu.org/software/classpath/license.html. // // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 // ***************************************************************************** /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ Object.defineProperty(exports, "__esModule", { value: true }); exports.TaskTemplateSelector = void 0; const tslib_1 = require("tslib"); const inversify_1 = require("@theia/core/shared/inversify"); const dotnetBuild = { id: 'dotnetCore', label: '.NET Core', sort: 'NET Core', autoDetect: false, // not supported in Theia description: 'Executes .NET Core build command', content: [ '{', '\t// See https://go.microsoft.com/fwlink/?LinkId=733558', '\t// for the documentation about the tasks.json format', '\t"version": "2.0.0",', '\t"tasks": [', '\t\t{', '\t\t\t"label": "build",', '\t\t\t"command": "dotnet",', '\t\t\t"type": "shell",', '\t\t\t"args": [', '\t\t\t\t"build",', '\t\t\t\t// Ask dotnet build to generate full paths for file names.', '\t\t\t\t"/property:GenerateFullPaths=true",', '\t\t\t\t// Do not generate summary otherwise it leads to duplicate errors in Problems panel', '\t\t\t\t"/consoleloggerparameters:NoSummary"', '\t\t\t],', '\t\t\t"group": "build",', '\t\t\t"presentation": {', '\t\t\t\t"reveal": "silent"', '\t\t\t},', '\t\t\t"problemMatcher": "$msCompile"', '\t\t}', '\t]', '}' ].join('\n') }; const msbuild = { id: 'msbuild', label: 'MSBuild', autoDetect: false, // not supported in Theia description: 'Executes the build target', content: [ '{', '\t// See https://go.microsoft.com/fwlink/?LinkId=733558', '\t// for the documentation about the tasks.json format', '\t"version": "2.0.0",', '\t"tasks": [', '\t\t{', '\t\t\t"label": "build",', '\t\t\t"type": "shell",', '\t\t\t"command": "msbuild",', '\t\t\t"args": [', '\t\t\t\t// Ask msbuild to generate full paths for file names.', '\t\t\t\t"/property:GenerateFullPaths=true",', '\t\t\t\t"/t:build",', '\t\t\t\t// Do not generate summary otherwise it leads to duplicate errors in Problems panel', '\t\t\t\t"/consoleloggerparameters:NoSummary"', '\t\t\t],', '\t\t\t"group": "build",', '\t\t\t"presentation": {', '\t\t\t\t// Reveal the output only if unrecognized errors occur.', '\t\t\t\t"reveal": "silent"', '\t\t\t},', '\t\t\t// Use the standard MS compiler pattern to detect errors, warnings and infos', '\t\t\t"problemMatcher": "$msCompile"', '\t\t}', '\t]', '}' ].join('\n') }; const maven = { id: 'maven', label: 'maven', sort: 'MVN', autoDetect: false, // not supported in Theia description: 'Executes common maven commands', content: [ '{', '\t// See https://go.microsoft.com/fwlink/?LinkId=733558', '\t// for the documentation about the tasks.json format', '\t"version": "2.0.0",', '\t"tasks": [', '\t\t{', '\t\t\t"label": "verify",', '\t\t\t"type": "shell",', '\t\t\t"command": "mvn -B verify",', '\t\t\t"group": "build"', '\t\t},', '\t\t{', '\t\t\t"label": "test",', '\t\t\t"type": "shell",', '\t\t\t"command": "mvn -B test",', '\t\t\t"group": "test"', '\t\t}', '\t]', '}' ].join('\n') }; const command = { id: 'externalCommand', label: 'Others', autoDetect: false, // not supported in Theia description: 'Example to run an arbitrary external command', content: [ '{', '\t// See https://go.microsoft.com/fwlink/?LinkId=733558', '\t// for the documentation about the tasks.json format', '\t"version": "2.0.0",', '\t"tasks": [', '\t\t{', '\t\t\t"label": "echo",', '\t\t\t"type": "shell",', '\t\t\t"command": "echo Hello"', '\t\t}', '\t]', '}' ].join('\n') }; let TaskTemplateSelector = class TaskTemplateSelector { selectTemplates() { const templates = [ dotnetBuild, msbuild, maven ].sort((a, b) => (a.sort || a.label).localeCompare(b.sort || b.label)); templates.push(command); return templates.map(t => ({ label: t.label, description: t.description, value: t })); } }; exports.TaskTemplateSelector = TaskTemplateSelector; exports.TaskTemplateSelector = TaskTemplateSelector = tslib_1.__decorate([ (0, inversify_1.injectable)() ], TaskTemplateSelector); //# sourceMappingURL=task-templates.js.map