@theia/task 1.53.0-next.55 → 1.53.0-next.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +193 -193
- package/lib/browser/task-schema-updater.js +1 -1
- package/package.json +12 -12
- package/src/browser/index.ts +22 -22
- package/src/browser/process/process-task-contribution.ts +31 -31
- package/src/browser/process/process-task-frontend-module.ts +27 -27
- package/src/browser/process/process-task-resolver.ts +89 -89
- package/src/browser/provided-task-configurations.spec.ts +46 -46
- package/src/browser/provided-task-configurations.ts +213 -213
- package/src/browser/quick-open-task.ts +831 -831
- package/src/browser/style/index.css +19 -19
- package/src/browser/task-configuration-manager.ts +256 -256
- package/src/browser/task-configuration-model.ts +101 -101
- package/src/browser/task-configurations.ts +508 -508
- package/src/browser/task-contribution.ts +266 -266
- package/src/browser/task-definition-registry.spec.ts +203 -203
- package/src/browser/task-definition-registry.ts +131 -131
- package/src/browser/task-frontend-contribution.ts +402 -402
- package/src/browser/task-frontend-module.ts +86 -86
- package/src/browser/task-name-resolver.ts +55 -55
- package/src/browser/task-node.ts +37 -37
- package/src/browser/task-preferences.ts +40 -40
- package/src/browser/task-problem-matcher-registry.ts +308 -308
- package/src/browser/task-problem-pattern-registry.ts +196 -196
- package/src/browser/task-schema-updater.ts +701 -701
- package/src/browser/task-service.ts +1164 -1164
- package/src/browser/task-source-resolver.ts +36 -36
- package/src/browser/task-templates.ts +168 -168
- package/src/browser/task-terminal-widget-manager.ts +224 -224
- package/src/browser/tasks-monaco-contribution.ts +27 -27
- package/src/common/index.ts +20 -20
- package/src/common/problem-matcher-protocol.ts +234 -234
- package/src/common/process/task-protocol.ts +97 -97
- package/src/common/task-common-module.ts +34 -34
- package/src/common/task-protocol.ts +317 -317
- package/src/common/task-util.ts +43 -43
- package/src/common/task-watcher.ts +78 -78
- package/src/node/custom/custom-task-runner-backend-module.ts +37 -37
- package/src/node/custom/custom-task-runner-contribution.ts +30 -30
- package/src/node/custom/custom-task-runner.ts +60 -60
- package/src/node/custom/custom-task.ts +73 -73
- package/src/node/index.ts +19 -19
- package/src/node/process/process-task-runner-backend-module.ts +37 -37
- package/src/node/process/process-task-runner-contribution.ts +31 -31
- package/src/node/process/process-task-runner.ts +371 -371
- package/src/node/process/process-task.spec.ts +30 -30
- package/src/node/process/process-task.ts +144 -144
- package/src/node/task-abstract-line-matcher.ts +312 -312
- package/src/node/task-backend-application-contribution.ts +36 -36
- package/src/node/task-backend-module.ts +57 -57
- package/src/node/task-line-matchers.ts +127 -127
- package/src/node/task-manager.ts +129 -129
- package/src/node/task-problem-collector.spec.ts +338 -338
- package/src/node/task-problem-collector.ts +62 -62
- package/src/node/task-runner-protocol.ts +33 -33
- package/src/node/task-runner.ts +96 -96
- package/src/node/task-server.slow-spec.ts +444 -444
- package/src/node/task-server.ts +263 -263
- package/src/node/task.ts +103 -103
- package/src/node/test/task-test-container.ts +63 -63
package/src/node/task.ts
CHANGED
|
@@ -1,103 +1,103 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2017 Ericsson and others.
|
|
3
|
-
//
|
|
4
|
-
// This program and the accompanying materials are made available under the
|
|
5
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
//
|
|
8
|
-
// This Source Code may also be made available under the following Secondary
|
|
9
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
// with the GNU Classpath Exception which is available at
|
|
12
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
//
|
|
14
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
-
// *****************************************************************************
|
|
16
|
-
|
|
17
|
-
import { injectable } from '@theia/core/shared/inversify';
|
|
18
|
-
import { ILogger, Disposable, DisposableCollection, Emitter, Event, MaybePromise } from '@theia/core/lib/common/';
|
|
19
|
-
import { TaskInfo, TaskExitedEvent, TaskConfiguration, TaskOutputEvent, ManagedTask, ManagedTaskManager } from '../common/task-protocol';
|
|
20
|
-
/**
|
|
21
|
-
* Represents the options used for running a task.
|
|
22
|
-
*/
|
|
23
|
-
export interface TaskOptions {
|
|
24
|
-
/** The task label */
|
|
25
|
-
label: string;
|
|
26
|
-
/** The task configuration which should be executed */
|
|
27
|
-
config: TaskConfiguration;
|
|
28
|
-
/** The optional execution context */
|
|
29
|
-
context?: string;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* A {@link Task} represents the execution state of a `TaskConfiguration`.
|
|
34
|
-
* Implementing classes have to call the {@link Task#fireOutputLine} function
|
|
35
|
-
* whenever a new output occurs during the execution.
|
|
36
|
-
*/
|
|
37
|
-
@injectable()
|
|
38
|
-
export abstract class Task implements Disposable, ManagedTask {
|
|
39
|
-
|
|
40
|
-
protected taskId: number;
|
|
41
|
-
protected readonly toDispose: DisposableCollection = new DisposableCollection();
|
|
42
|
-
readonly exitEmitter: Emitter<TaskExitedEvent>;
|
|
43
|
-
readonly outputEmitter: Emitter<TaskOutputEvent>;
|
|
44
|
-
|
|
45
|
-
constructor(
|
|
46
|
-
protected readonly taskManager: ManagedTaskManager<Task>,
|
|
47
|
-
protected readonly logger: ILogger,
|
|
48
|
-
protected readonly options: TaskOptions
|
|
49
|
-
) {
|
|
50
|
-
this.taskId = this.taskManager.register(this, this.options.context);
|
|
51
|
-
this.exitEmitter = new Emitter<TaskExitedEvent>();
|
|
52
|
-
this.outputEmitter = new Emitter<TaskOutputEvent>();
|
|
53
|
-
this.toDispose.push(this.exitEmitter);
|
|
54
|
-
this.toDispose.push(this.outputEmitter);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Terminate this task.
|
|
59
|
-
*
|
|
60
|
-
* @returns a promise that resolves once the task has been properly terminated.
|
|
61
|
-
*/
|
|
62
|
-
abstract kill(): Promise<void>;
|
|
63
|
-
|
|
64
|
-
get onExit(): Event<TaskExitedEvent> {
|
|
65
|
-
return this.exitEmitter.event;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
get onOutput(): Event<TaskOutputEvent> {
|
|
69
|
-
return this.outputEmitter.event;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/** Has to be called when a task has concluded its execution. */
|
|
73
|
-
protected fireTaskExited(event: TaskExitedEvent): void {
|
|
74
|
-
this.exitEmitter.fire(event);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
protected fireOutputLine(event: TaskOutputEvent): void {
|
|
78
|
-
this.outputEmitter.fire(event);
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Retrieves the runtime information about this task.
|
|
82
|
-
* The runtime information computation may happen asynchronous.
|
|
83
|
-
*
|
|
84
|
-
* @returns (a promise of) the runtime information as `TaskInfo`.
|
|
85
|
-
*/
|
|
86
|
-
abstract getRuntimeInfo(): MaybePromise<TaskInfo>;
|
|
87
|
-
|
|
88
|
-
get id(): number {
|
|
89
|
-
return this.taskId;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
get context(): string | undefined {
|
|
93
|
-
return this.options.context;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
get label(): string {
|
|
97
|
-
return this.options.label;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
dispose(): void {
|
|
101
|
-
this.toDispose.dispose();
|
|
102
|
-
}
|
|
103
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2017 Ericsson and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
import { injectable } from '@theia/core/shared/inversify';
|
|
18
|
+
import { ILogger, Disposable, DisposableCollection, Emitter, Event, MaybePromise } from '@theia/core/lib/common/';
|
|
19
|
+
import { TaskInfo, TaskExitedEvent, TaskConfiguration, TaskOutputEvent, ManagedTask, ManagedTaskManager } from '../common/task-protocol';
|
|
20
|
+
/**
|
|
21
|
+
* Represents the options used for running a task.
|
|
22
|
+
*/
|
|
23
|
+
export interface TaskOptions {
|
|
24
|
+
/** The task label */
|
|
25
|
+
label: string;
|
|
26
|
+
/** The task configuration which should be executed */
|
|
27
|
+
config: TaskConfiguration;
|
|
28
|
+
/** The optional execution context */
|
|
29
|
+
context?: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* A {@link Task} represents the execution state of a `TaskConfiguration`.
|
|
34
|
+
* Implementing classes have to call the {@link Task#fireOutputLine} function
|
|
35
|
+
* whenever a new output occurs during the execution.
|
|
36
|
+
*/
|
|
37
|
+
@injectable()
|
|
38
|
+
export abstract class Task implements Disposable, ManagedTask {
|
|
39
|
+
|
|
40
|
+
protected taskId: number;
|
|
41
|
+
protected readonly toDispose: DisposableCollection = new DisposableCollection();
|
|
42
|
+
readonly exitEmitter: Emitter<TaskExitedEvent>;
|
|
43
|
+
readonly outputEmitter: Emitter<TaskOutputEvent>;
|
|
44
|
+
|
|
45
|
+
constructor(
|
|
46
|
+
protected readonly taskManager: ManagedTaskManager<Task>,
|
|
47
|
+
protected readonly logger: ILogger,
|
|
48
|
+
protected readonly options: TaskOptions
|
|
49
|
+
) {
|
|
50
|
+
this.taskId = this.taskManager.register(this, this.options.context);
|
|
51
|
+
this.exitEmitter = new Emitter<TaskExitedEvent>();
|
|
52
|
+
this.outputEmitter = new Emitter<TaskOutputEvent>();
|
|
53
|
+
this.toDispose.push(this.exitEmitter);
|
|
54
|
+
this.toDispose.push(this.outputEmitter);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Terminate this task.
|
|
59
|
+
*
|
|
60
|
+
* @returns a promise that resolves once the task has been properly terminated.
|
|
61
|
+
*/
|
|
62
|
+
abstract kill(): Promise<void>;
|
|
63
|
+
|
|
64
|
+
get onExit(): Event<TaskExitedEvent> {
|
|
65
|
+
return this.exitEmitter.event;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
get onOutput(): Event<TaskOutputEvent> {
|
|
69
|
+
return this.outputEmitter.event;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** Has to be called when a task has concluded its execution. */
|
|
73
|
+
protected fireTaskExited(event: TaskExitedEvent): void {
|
|
74
|
+
this.exitEmitter.fire(event);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
protected fireOutputLine(event: TaskOutputEvent): void {
|
|
78
|
+
this.outputEmitter.fire(event);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Retrieves the runtime information about this task.
|
|
82
|
+
* The runtime information computation may happen asynchronous.
|
|
83
|
+
*
|
|
84
|
+
* @returns (a promise of) the runtime information as `TaskInfo`.
|
|
85
|
+
*/
|
|
86
|
+
abstract getRuntimeInfo(): MaybePromise<TaskInfo>;
|
|
87
|
+
|
|
88
|
+
get id(): number {
|
|
89
|
+
return this.taskId;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
get context(): string | undefined {
|
|
93
|
+
return this.options.context;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
get label(): string {
|
|
97
|
+
return this.options.label;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
dispose(): void {
|
|
101
|
+
this.toDispose.dispose();
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2017 Ericsson and others.
|
|
3
|
-
//
|
|
4
|
-
// This program and the accompanying materials are made available under the
|
|
5
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
//
|
|
8
|
-
// This Source Code may also be made available under the following Secondary
|
|
9
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
// with the GNU Classpath Exception which is available at
|
|
12
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
//
|
|
14
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
-
// *****************************************************************************
|
|
16
|
-
import { Container } from '@theia/core/shared/inversify';
|
|
17
|
-
import { bindLogger } from '@theia/core/lib/node/logger-backend-module';
|
|
18
|
-
import { backendApplicationModule } from '@theia/core/lib/node/backend-application-module';
|
|
19
|
-
import processBackendModule from '@theia/process/lib/node/process-backend-module';
|
|
20
|
-
import terminalBackendModule from '@theia/terminal/lib/node/terminal-backend-module';
|
|
21
|
-
import taskBackendModule from '../task-backend-module';
|
|
22
|
-
import filesystemBackendModule from '@theia/filesystem/lib/node/filesystem-backend-module';
|
|
23
|
-
import workspaceServer from '@theia/workspace/lib/node/workspace-backend-module';
|
|
24
|
-
import { messagingBackendModule } from '@theia/core/lib/node/messaging/messaging-backend-module';
|
|
25
|
-
import { ApplicationPackage } from '@theia/core/shared/@theia/application-package';
|
|
26
|
-
import { TerminalProcess } from '@theia/process/lib/node';
|
|
27
|
-
import { ProcessUtils } from '@theia/core/lib/node/process-utils';
|
|
28
|
-
|
|
29
|
-
export function createTaskTestContainer(): Container {
|
|
30
|
-
const testContainer = new Container();
|
|
31
|
-
|
|
32
|
-
testContainer.load(backendApplicationModule);
|
|
33
|
-
testContainer.rebind(ApplicationPackage).toConstantValue({} as ApplicationPackage);
|
|
34
|
-
|
|
35
|
-
bindLogger(testContainer.bind.bind(testContainer));
|
|
36
|
-
testContainer.load(messagingBackendModule);
|
|
37
|
-
testContainer.load(processBackendModule);
|
|
38
|
-
testContainer.load(taskBackendModule);
|
|
39
|
-
testContainer.load(filesystemBackendModule);
|
|
40
|
-
testContainer.load(workspaceServer);
|
|
41
|
-
testContainer.load(terminalBackendModule);
|
|
42
|
-
|
|
43
|
-
// Make it easier to debug processes.
|
|
44
|
-
testContainer.rebind(TerminalProcess).to(TestTerminalProcess);
|
|
45
|
-
|
|
46
|
-
testContainer.rebind(ProcessUtils).toConstantValue(new class extends ProcessUtils {
|
|
47
|
-
override terminateProcessTree(): void { } // don't actually kill the tree, it breaks the tests.
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
return testContainer;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
class TestTerminalProcess extends TerminalProcess {
|
|
54
|
-
|
|
55
|
-
protected override emitOnStarted(): void {
|
|
56
|
-
if (process.env['THEIA_TASK_TEST_DEBUG']) {
|
|
57
|
-
console.log(`START ${this.id} ${JSON.stringify([this.executable, this.options.commandLine, ...this.arguments])}`);
|
|
58
|
-
this.outputStream.on('data', data => console.debug(`${this.id} OUTPUT: ${data.toString().trim()}`));
|
|
59
|
-
}
|
|
60
|
-
super.emitOnStarted();
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2017 Ericsson and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
import { Container } from '@theia/core/shared/inversify';
|
|
17
|
+
import { bindLogger } from '@theia/core/lib/node/logger-backend-module';
|
|
18
|
+
import { backendApplicationModule } from '@theia/core/lib/node/backend-application-module';
|
|
19
|
+
import processBackendModule from '@theia/process/lib/node/process-backend-module';
|
|
20
|
+
import terminalBackendModule from '@theia/terminal/lib/node/terminal-backend-module';
|
|
21
|
+
import taskBackendModule from '../task-backend-module';
|
|
22
|
+
import filesystemBackendModule from '@theia/filesystem/lib/node/filesystem-backend-module';
|
|
23
|
+
import workspaceServer from '@theia/workspace/lib/node/workspace-backend-module';
|
|
24
|
+
import { messagingBackendModule } from '@theia/core/lib/node/messaging/messaging-backend-module';
|
|
25
|
+
import { ApplicationPackage } from '@theia/core/shared/@theia/application-package';
|
|
26
|
+
import { TerminalProcess } from '@theia/process/lib/node';
|
|
27
|
+
import { ProcessUtils } from '@theia/core/lib/node/process-utils';
|
|
28
|
+
|
|
29
|
+
export function createTaskTestContainer(): Container {
|
|
30
|
+
const testContainer = new Container();
|
|
31
|
+
|
|
32
|
+
testContainer.load(backendApplicationModule);
|
|
33
|
+
testContainer.rebind(ApplicationPackage).toConstantValue({} as ApplicationPackage);
|
|
34
|
+
|
|
35
|
+
bindLogger(testContainer.bind.bind(testContainer));
|
|
36
|
+
testContainer.load(messagingBackendModule);
|
|
37
|
+
testContainer.load(processBackendModule);
|
|
38
|
+
testContainer.load(taskBackendModule);
|
|
39
|
+
testContainer.load(filesystemBackendModule);
|
|
40
|
+
testContainer.load(workspaceServer);
|
|
41
|
+
testContainer.load(terminalBackendModule);
|
|
42
|
+
|
|
43
|
+
// Make it easier to debug processes.
|
|
44
|
+
testContainer.rebind(TerminalProcess).to(TestTerminalProcess);
|
|
45
|
+
|
|
46
|
+
testContainer.rebind(ProcessUtils).toConstantValue(new class extends ProcessUtils {
|
|
47
|
+
override terminateProcessTree(): void { } // don't actually kill the tree, it breaks the tests.
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
return testContainer;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
class TestTerminalProcess extends TerminalProcess {
|
|
54
|
+
|
|
55
|
+
protected override emitOnStarted(): void {
|
|
56
|
+
if (process.env['THEIA_TASK_TEST_DEBUG']) {
|
|
57
|
+
console.log(`START ${this.id} ${JSON.stringify([this.executable, this.options.commandLine, ...this.arguments])}`);
|
|
58
|
+
this.outputStream.on('data', data => console.debug(`${this.id} OUTPUT: ${data.toString().trim()}`));
|
|
59
|
+
}
|
|
60
|
+
super.emitOnStarted();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
}
|