1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { URI } from 'vs/base/common/uri';
import Severity from 'vs/base/common/severity';
import { TerminateResponse } from 'vs/base/common/processes';
import { Event } from 'vs/base/common/event';
import { Platform } from 'vs/base/common/platform';
import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
import { Task, ITaskEvent, KeyedTaskIdentifier } from './tasks';
import { ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
export const enum TaskErrors {
NotConfigured,
RunningTask,
NoBuildTask,
NoTestTask,
ConfigValidationError,
TaskNotFound,
NoValidTaskRunner,
UnknownError
}
export class TaskError {
public severity: Severity;
public message: string;
public code: TaskErrors;
constructor(severity: Severity, message: string, code: TaskErrors) {
this.severity = severity;
this.message = message;
this.code = code;
}
}
export namespace Triggers {
export const shortcut: string = 'shortcut';
export const command: string = 'command';
}
export interface ITaskSummary {
/**
* Exit code of the process.
*/
exitCode?: number;
}
export const enum TaskExecuteKind {
Started = 1,
Active = 2
}
export interface ITaskExecuteResult {
kind: TaskExecuteKind;
promise: Promise<ITaskSummary>;
task: Task;
started?: {
restartOnFileChanges?: string;
};
active?: {
same: boolean;
background: boolean;
};
}
export interface ITaskResolver {
resolve(uri: URI | string, identifier: string | KeyedTaskIdentifier | undefined): Promise<Task | undefined>;
}
export interface ITaskTerminateResponse extends TerminateResponse {
task: Task | undefined;
}
export interface IResolveSet {
process?: {
name: string;
cwd?: string;
path?: string;
};
variables: Set<string>;
}
export interface IResolvedVariables {
process?: string;
variables: Map<string, string>;
}
export interface ITaskSystemInfo {
platform: Platform;
context: any;
uriProvider: (this: void, path: string) => URI;
resolveVariables(workspaceFolder: IWorkspaceFolder, toResolve: IResolveSet, target: ConfigurationTarget): Promise<IResolvedVariables | undefined>;
findExecutable(command: string, cwd?: string, paths?: string[]): Promise<string | undefined>;
}
export interface ITaskSystemInfoResolver {
(workspaceFolder: IWorkspaceFolder | undefined): ITaskSystemInfo | undefined;
}
export interface ITaskSystem {
onDidStateChange: Event<ITaskEvent>;
run(task: Task, resolver: ITaskResolver): ITaskExecuteResult;
rerun(): ITaskExecuteResult | undefined;
isActive(): Promise<boolean>;
isActiveSync(): boolean;
getActiveTasks(): Task[];
getLastInstance(task: Task): Task | undefined;
getBusyTasks(): Task[];
canAutoTerminate(): boolean;
terminate(task: Task): Promise<ITaskTerminateResponse>;
terminateAll(): Promise<ITaskTerminateResponse[]>;
revealTask(task: Task): boolean;
customExecutionComplete(task: Task, result: number): Promise<void>;
isTaskVisible(task: Task): boolean;
}
|