@codingame/monaco-vscode-task-service-override 1.85.2
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/external/tslib/tslib.es6.js +11 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/override/vs/platform/dialogs/common/dialogs.js +8 -0
- package/package.json +24 -0
- package/task.d.ts +5 -0
- package/task.js +12 -0
- package/vscode/src/vs/base/common/parsers.js +44 -0
- package/vscode/src/vs/workbench/contrib/tasks/browser/abstractTaskService.js +3851 -0
- package/vscode/src/vs/workbench/contrib/tasks/browser/runAutomaticTasks.js +167 -0
- package/vscode/src/vs/workbench/contrib/tasks/browser/task.contribution.js +694 -0
- package/vscode/src/vs/workbench/contrib/tasks/browser/taskQuickPick.js +452 -0
- package/vscode/src/vs/workbench/contrib/tasks/browser/taskService.js +36 -0
- package/vscode/src/vs/workbench/contrib/tasks/browser/taskTerminalStatus.js +191 -0
- package/vscode/src/vs/workbench/contrib/tasks/browser/tasksQuickAccess.js +121 -0
- package/vscode/src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.js +1713 -0
- package/vscode/src/vs/workbench/contrib/tasks/common/jsonSchemaCommon.js +440 -0
- package/vscode/src/vs/workbench/contrib/tasks/common/jsonSchema_v1.js +125 -0
- package/vscode/src/vs/workbench/contrib/tasks/common/jsonSchema_v2.js +901 -0
- package/vscode/src/vs/workbench/contrib/tasks/common/problemCollectors.js +464 -0
- package/vscode/src/vs/workbench/contrib/tasks/common/problemMatcher.js +1796 -0
- package/vscode/src/vs/workbench/contrib/tasks/common/taskConfiguration.js +1581 -0
- package/vscode/src/vs/workbench/contrib/tasks/common/taskSystem.js +15 -0
- package/vscode/src/vs/workbench/contrib/tasks/common/taskTemplates.js +145 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalEscapeSequences.js +13 -0
|
@@ -0,0 +1,1581 @@
|
|
|
1
|
+
import * as nls from 'monaco-editor/esm/vs/nls.js';
|
|
2
|
+
import * as Objects from 'monaco-editor/esm/vs/base/common/objects.js';
|
|
3
|
+
import * as Types from 'monaco-editor/esm/vs/base/common/types.js';
|
|
4
|
+
import * as UUID from 'monaco-editor/esm/vs/base/common/uuid.js';
|
|
5
|
+
import { ProblemMatcherParser, isNamedProblemMatcher, ProblemMatcherRegistry } from './problemMatcher.js';
|
|
6
|
+
import { RunOnOptions as RunOnOptions$1, RevealKind, RevealProblemKind, PanelKind, ExecutionEngine as ExecutionEngine$1, ShellQuoting, RuntimeType, TaskGroup, TaskDefinition, TaskSourceKind, ConfiguringTask as ConfiguringTask$1, CUSTOMIZED_TASK_TYPE, CustomTask as CustomTask$1, USER_TASKS_GROUP_KEY, CommandString } from 'vscode/vscode/vs/workbench/contrib/tasks/common/tasks';
|
|
7
|
+
import { TaskDefinitionRegistry } from 'vscode/vscode/vs/workbench/contrib/tasks/common/taskDefinitionRegistry';
|
|
8
|
+
import { ShellExecutionSupportedContext, ProcessExecutionSupportedContext } from 'vscode/vscode/vs/workbench/contrib/tasks/common/taskService';
|
|
9
|
+
|
|
10
|
+
var ITaskIdentifier;
|
|
11
|
+
( (function(ITaskIdentifier) {
|
|
12
|
+
function is(value) {
|
|
13
|
+
const candidate = value;
|
|
14
|
+
return candidate !== undefined && Types.isString(value.type);
|
|
15
|
+
}
|
|
16
|
+
ITaskIdentifier.is = is;
|
|
17
|
+
})(ITaskIdentifier || (ITaskIdentifier = {})));
|
|
18
|
+
var ProblemMatcherKind;
|
|
19
|
+
( (function(ProblemMatcherKind) {
|
|
20
|
+
ProblemMatcherKind[ProblemMatcherKind["Unknown"] = 0] = "Unknown";
|
|
21
|
+
ProblemMatcherKind[ProblemMatcherKind["String"] = 1] = "String";
|
|
22
|
+
ProblemMatcherKind[ProblemMatcherKind["ProblemMatcher"] = 2] = "ProblemMatcher";
|
|
23
|
+
ProblemMatcherKind[ProblemMatcherKind["Array"] = 3] = "Array";
|
|
24
|
+
})(ProblemMatcherKind || (ProblemMatcherKind = {})));
|
|
25
|
+
const EMPTY_ARRAY = [];
|
|
26
|
+
function assignProperty(target, source, key) {
|
|
27
|
+
const sourceAtKey = source[key];
|
|
28
|
+
if (sourceAtKey !== undefined) {
|
|
29
|
+
target[key] = sourceAtKey;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function fillProperty(target, source, key) {
|
|
33
|
+
const sourceAtKey = source[key];
|
|
34
|
+
if (target[key] === undefined && sourceAtKey !== undefined) {
|
|
35
|
+
target[key] = sourceAtKey;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function _isEmpty(value, properties, allowEmptyArray = false) {
|
|
39
|
+
if (value === undefined || value === null || properties === undefined) {
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
for (const meta of properties) {
|
|
43
|
+
const property = value[meta.property];
|
|
44
|
+
if (property !== undefined && property !== null) {
|
|
45
|
+
if (meta.type !== undefined && !meta.type.isEmpty(property)) {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
else if (!Array.isArray(property) || (property.length > 0) || allowEmptyArray) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
function _assignProperties(target, source, properties) {
|
|
56
|
+
if (!source || _isEmpty(source, properties)) {
|
|
57
|
+
return target;
|
|
58
|
+
}
|
|
59
|
+
if (!target || _isEmpty(target, properties)) {
|
|
60
|
+
return source;
|
|
61
|
+
}
|
|
62
|
+
for (const meta of properties) {
|
|
63
|
+
const property = meta.property;
|
|
64
|
+
let value;
|
|
65
|
+
if (meta.type !== undefined) {
|
|
66
|
+
value = meta.type.assignProperties(target[property], source[property]);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
value = source[property];
|
|
70
|
+
}
|
|
71
|
+
if (value !== undefined && value !== null) {
|
|
72
|
+
target[property] = value;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return target;
|
|
76
|
+
}
|
|
77
|
+
function _fillProperties(target, source, properties, allowEmptyArray = false) {
|
|
78
|
+
if (!source || _isEmpty(source, properties)) {
|
|
79
|
+
return target;
|
|
80
|
+
}
|
|
81
|
+
if (!target || _isEmpty(target, properties, allowEmptyArray)) {
|
|
82
|
+
return source;
|
|
83
|
+
}
|
|
84
|
+
for (const meta of properties) {
|
|
85
|
+
const property = meta.property;
|
|
86
|
+
let value;
|
|
87
|
+
if (meta.type) {
|
|
88
|
+
value = meta.type.fillProperties(target[property], source[property]);
|
|
89
|
+
}
|
|
90
|
+
else if (target[property] === undefined) {
|
|
91
|
+
value = source[property];
|
|
92
|
+
}
|
|
93
|
+
if (value !== undefined && value !== null) {
|
|
94
|
+
target[property] = value;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return target;
|
|
98
|
+
}
|
|
99
|
+
function _fillDefaults(target, defaults, properties, context) {
|
|
100
|
+
if (target && Object.isFrozen(target)) {
|
|
101
|
+
return target;
|
|
102
|
+
}
|
|
103
|
+
if (target === undefined || target === null || defaults === undefined || defaults === null) {
|
|
104
|
+
if (defaults !== undefined && defaults !== null) {
|
|
105
|
+
return Objects.deepClone(defaults);
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
return undefined;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
for (const meta of properties) {
|
|
112
|
+
const property = meta.property;
|
|
113
|
+
if (target[property] !== undefined) {
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
let value;
|
|
117
|
+
if (meta.type) {
|
|
118
|
+
value = meta.type.fillDefaults(target[property], context);
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
value = defaults[property];
|
|
122
|
+
}
|
|
123
|
+
if (value !== undefined && value !== null) {
|
|
124
|
+
target[property] = value;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return target;
|
|
128
|
+
}
|
|
129
|
+
function _freeze(target, properties) {
|
|
130
|
+
if (target === undefined || target === null) {
|
|
131
|
+
return undefined;
|
|
132
|
+
}
|
|
133
|
+
if (Object.isFrozen(target)) {
|
|
134
|
+
return target;
|
|
135
|
+
}
|
|
136
|
+
for (const meta of properties) {
|
|
137
|
+
if (meta.type) {
|
|
138
|
+
const value = target[meta.property];
|
|
139
|
+
if (value) {
|
|
140
|
+
meta.type.freeze(value);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return target;
|
|
145
|
+
}
|
|
146
|
+
var RunOnOptions;
|
|
147
|
+
( (function(RunOnOptions) {
|
|
148
|
+
function fromString(value) {
|
|
149
|
+
if (!value) {
|
|
150
|
+
return RunOnOptions$1.default;
|
|
151
|
+
}
|
|
152
|
+
switch (value.toLowerCase()) {
|
|
153
|
+
case 'folderopen':
|
|
154
|
+
return RunOnOptions$1.folderOpen;
|
|
155
|
+
case 'default':
|
|
156
|
+
default:
|
|
157
|
+
return RunOnOptions$1.default;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
RunOnOptions.fromString = fromString;
|
|
161
|
+
})(RunOnOptions || (RunOnOptions = {})));
|
|
162
|
+
var RunOptions;
|
|
163
|
+
( (function(RunOptions) {
|
|
164
|
+
const properties = [{ property: 'reevaluateOnRerun' }, { property: 'runOn' }, { property: 'instanceLimit' }];
|
|
165
|
+
function fromConfiguration(value) {
|
|
166
|
+
return {
|
|
167
|
+
reevaluateOnRerun: value ? value.reevaluateOnRerun : true,
|
|
168
|
+
runOn: value ? RunOnOptions.fromString(value.runOn) : RunOnOptions$1.default,
|
|
169
|
+
instanceLimit: value ? value.instanceLimit : 1
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
RunOptions.fromConfiguration = fromConfiguration;
|
|
173
|
+
function assignProperties(target, source) {
|
|
174
|
+
return _assignProperties(target, source, properties);
|
|
175
|
+
}
|
|
176
|
+
RunOptions.assignProperties = assignProperties;
|
|
177
|
+
function fillProperties(target, source) {
|
|
178
|
+
return _fillProperties(target, source, properties);
|
|
179
|
+
}
|
|
180
|
+
RunOptions.fillProperties = fillProperties;
|
|
181
|
+
})(RunOptions || (RunOptions = {})));
|
|
182
|
+
var ShellConfiguration;
|
|
183
|
+
( (function(ShellConfiguration) {
|
|
184
|
+
const properties = [{ property: 'executable' }, { property: 'args' }, { property: 'quoting' }];
|
|
185
|
+
function is(value) {
|
|
186
|
+
const candidate = value;
|
|
187
|
+
return candidate && (Types.isString(candidate.executable) || Types.isStringArray(candidate.args));
|
|
188
|
+
}
|
|
189
|
+
ShellConfiguration.is = is;
|
|
190
|
+
function from(config, context) {
|
|
191
|
+
if (!is(config)) {
|
|
192
|
+
return undefined;
|
|
193
|
+
}
|
|
194
|
+
const result = {};
|
|
195
|
+
if (config.executable !== undefined) {
|
|
196
|
+
result.executable = config.executable;
|
|
197
|
+
}
|
|
198
|
+
if (config.args !== undefined) {
|
|
199
|
+
result.args = config.args.slice();
|
|
200
|
+
}
|
|
201
|
+
if (config.quoting !== undefined) {
|
|
202
|
+
result.quoting = Objects.deepClone(config.quoting);
|
|
203
|
+
}
|
|
204
|
+
return result;
|
|
205
|
+
}
|
|
206
|
+
ShellConfiguration.from = from;
|
|
207
|
+
function isEmpty(value) {
|
|
208
|
+
return _isEmpty(value, properties, true);
|
|
209
|
+
}
|
|
210
|
+
ShellConfiguration.isEmpty = isEmpty;
|
|
211
|
+
function assignProperties(target, source) {
|
|
212
|
+
return _assignProperties(target, source, properties);
|
|
213
|
+
}
|
|
214
|
+
ShellConfiguration.assignProperties = assignProperties;
|
|
215
|
+
function fillProperties(target, source) {
|
|
216
|
+
return _fillProperties(target, source, properties, true);
|
|
217
|
+
}
|
|
218
|
+
ShellConfiguration.fillProperties = fillProperties;
|
|
219
|
+
function fillDefaults(value, context) {
|
|
220
|
+
return value;
|
|
221
|
+
}
|
|
222
|
+
ShellConfiguration.fillDefaults = fillDefaults;
|
|
223
|
+
function freeze(value) {
|
|
224
|
+
if (!value) {
|
|
225
|
+
return undefined;
|
|
226
|
+
}
|
|
227
|
+
return ( Object.freeze(value));
|
|
228
|
+
}
|
|
229
|
+
ShellConfiguration.freeze = freeze;
|
|
230
|
+
})(ShellConfiguration || (ShellConfiguration = {})));
|
|
231
|
+
var CommandOptions;
|
|
232
|
+
( (function(CommandOptions) {
|
|
233
|
+
const properties = [{ property: 'cwd' }, { property: 'env' }, { property: 'shell', type: ShellConfiguration }];
|
|
234
|
+
const defaults = { cwd: '${workspaceFolder}' };
|
|
235
|
+
function from(options, context) {
|
|
236
|
+
const result = {};
|
|
237
|
+
if (options.cwd !== undefined) {
|
|
238
|
+
if (Types.isString(options.cwd)) {
|
|
239
|
+
result.cwd = options.cwd;
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
context.taskLoadIssues.push(( nls.localizeWithPath(
|
|
243
|
+
'vs/workbench/contrib/tasks/common/taskConfiguration',
|
|
244
|
+
'ConfigurationParser.invalidCWD',
|
|
245
|
+
'Warning: options.cwd must be of type string. Ignoring value {0}\n',
|
|
246
|
+
options.cwd
|
|
247
|
+
)));
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
if (options.env !== undefined) {
|
|
251
|
+
result.env = Objects.deepClone(options.env);
|
|
252
|
+
}
|
|
253
|
+
result.shell = ShellConfiguration.from(options.shell, context);
|
|
254
|
+
return isEmpty(result) ? undefined : result;
|
|
255
|
+
}
|
|
256
|
+
CommandOptions.from = from;
|
|
257
|
+
function isEmpty(value) {
|
|
258
|
+
return _isEmpty(value, properties);
|
|
259
|
+
}
|
|
260
|
+
CommandOptions.isEmpty = isEmpty;
|
|
261
|
+
function assignProperties(target, source) {
|
|
262
|
+
if ((source === undefined) || isEmpty(source)) {
|
|
263
|
+
return target;
|
|
264
|
+
}
|
|
265
|
+
if ((target === undefined) || isEmpty(target)) {
|
|
266
|
+
return source;
|
|
267
|
+
}
|
|
268
|
+
assignProperty(target, source, 'cwd');
|
|
269
|
+
if (target.env === undefined) {
|
|
270
|
+
target.env = source.env;
|
|
271
|
+
}
|
|
272
|
+
else if (source.env !== undefined) {
|
|
273
|
+
const env = Object.create(null);
|
|
274
|
+
if (target.env !== undefined) {
|
|
275
|
+
( Object.keys(target.env)).forEach(key => env[key] = target.env[key]);
|
|
276
|
+
}
|
|
277
|
+
if (source.env !== undefined) {
|
|
278
|
+
( Object.keys(source.env)).forEach(key => env[key] = source.env[key]);
|
|
279
|
+
}
|
|
280
|
+
target.env = env;
|
|
281
|
+
}
|
|
282
|
+
target.shell = ShellConfiguration.assignProperties(target.shell, source.shell);
|
|
283
|
+
return target;
|
|
284
|
+
}
|
|
285
|
+
CommandOptions.assignProperties = assignProperties;
|
|
286
|
+
function fillProperties(target, source) {
|
|
287
|
+
return _fillProperties(target, source, properties);
|
|
288
|
+
}
|
|
289
|
+
CommandOptions.fillProperties = fillProperties;
|
|
290
|
+
function fillDefaults(value, context) {
|
|
291
|
+
return _fillDefaults(value, defaults, properties, context);
|
|
292
|
+
}
|
|
293
|
+
CommandOptions.fillDefaults = fillDefaults;
|
|
294
|
+
function freeze(value) {
|
|
295
|
+
return _freeze(value, properties);
|
|
296
|
+
}
|
|
297
|
+
CommandOptions.freeze = freeze;
|
|
298
|
+
})(CommandOptions || (CommandOptions = {})));
|
|
299
|
+
var CommandConfiguration;
|
|
300
|
+
( (function(CommandConfiguration) {
|
|
301
|
+
let PresentationOptions;
|
|
302
|
+
( (function(PresentationOptions) {
|
|
303
|
+
const properties = [{ property: 'echo' }, { property: 'reveal' }, { property: 'revealProblems' }, { property: 'focus' }, { property: 'panel' }, { property: 'showReuseMessage' }, { property: 'clear' }, { property: 'group' }, { property: 'close' }];
|
|
304
|
+
function from(config, context) {
|
|
305
|
+
let echo;
|
|
306
|
+
let reveal;
|
|
307
|
+
let revealProblems;
|
|
308
|
+
let focus;
|
|
309
|
+
let panel;
|
|
310
|
+
let showReuseMessage;
|
|
311
|
+
let clear;
|
|
312
|
+
let group;
|
|
313
|
+
let close;
|
|
314
|
+
let hasProps = false;
|
|
315
|
+
if (Types.isBoolean(config.echoCommand)) {
|
|
316
|
+
echo = config.echoCommand;
|
|
317
|
+
hasProps = true;
|
|
318
|
+
}
|
|
319
|
+
if (Types.isString(config.showOutput)) {
|
|
320
|
+
reveal = RevealKind.fromString(config.showOutput);
|
|
321
|
+
hasProps = true;
|
|
322
|
+
}
|
|
323
|
+
const presentation = config.presentation || config.terminal;
|
|
324
|
+
if (presentation) {
|
|
325
|
+
if (Types.isBoolean(presentation.echo)) {
|
|
326
|
+
echo = presentation.echo;
|
|
327
|
+
}
|
|
328
|
+
if (Types.isString(presentation.reveal)) {
|
|
329
|
+
reveal = RevealKind.fromString(presentation.reveal);
|
|
330
|
+
}
|
|
331
|
+
if (Types.isString(presentation.revealProblems)) {
|
|
332
|
+
revealProblems = RevealProblemKind.fromString(presentation.revealProblems);
|
|
333
|
+
}
|
|
334
|
+
if (Types.isBoolean(presentation.focus)) {
|
|
335
|
+
focus = presentation.focus;
|
|
336
|
+
}
|
|
337
|
+
if (Types.isString(presentation.panel)) {
|
|
338
|
+
panel = PanelKind.fromString(presentation.panel);
|
|
339
|
+
}
|
|
340
|
+
if (Types.isBoolean(presentation.showReuseMessage)) {
|
|
341
|
+
showReuseMessage = presentation.showReuseMessage;
|
|
342
|
+
}
|
|
343
|
+
if (Types.isBoolean(presentation.clear)) {
|
|
344
|
+
clear = presentation.clear;
|
|
345
|
+
}
|
|
346
|
+
if (Types.isString(presentation.group)) {
|
|
347
|
+
group = presentation.group;
|
|
348
|
+
}
|
|
349
|
+
if (Types.isBoolean(presentation.close)) {
|
|
350
|
+
close = presentation.close;
|
|
351
|
+
}
|
|
352
|
+
hasProps = true;
|
|
353
|
+
}
|
|
354
|
+
if (!hasProps) {
|
|
355
|
+
return undefined;
|
|
356
|
+
}
|
|
357
|
+
return { echo: echo, reveal: reveal, revealProblems: revealProblems, focus: focus, panel: panel, showReuseMessage: showReuseMessage, clear: clear, group, close: close };
|
|
358
|
+
}
|
|
359
|
+
PresentationOptions.from = from;
|
|
360
|
+
function assignProperties(target, source) {
|
|
361
|
+
return _assignProperties(target, source, properties);
|
|
362
|
+
}
|
|
363
|
+
PresentationOptions.assignProperties = assignProperties;
|
|
364
|
+
function fillProperties(target, source) {
|
|
365
|
+
return _fillProperties(target, source, properties);
|
|
366
|
+
}
|
|
367
|
+
PresentationOptions.fillProperties = fillProperties;
|
|
368
|
+
function fillDefaults(value, context) {
|
|
369
|
+
const defaultEcho = context.engine === ExecutionEngine$1.Terminal ? true : false;
|
|
370
|
+
return _fillDefaults(value, { echo: defaultEcho, reveal: RevealKind.Always, revealProblems: RevealProblemKind.Never, focus: false, panel: PanelKind.Shared, showReuseMessage: true, clear: false }, properties, context);
|
|
371
|
+
}
|
|
372
|
+
PresentationOptions.fillDefaults = fillDefaults;
|
|
373
|
+
function freeze(value) {
|
|
374
|
+
return _freeze(value, properties);
|
|
375
|
+
}
|
|
376
|
+
PresentationOptions.freeze = freeze;
|
|
377
|
+
function isEmpty(value) {
|
|
378
|
+
return _isEmpty(value, properties);
|
|
379
|
+
}
|
|
380
|
+
PresentationOptions.isEmpty = isEmpty;
|
|
381
|
+
})(
|
|
382
|
+
PresentationOptions = CommandConfiguration.PresentationOptions || (CommandConfiguration.PresentationOptions = {})
|
|
383
|
+
));
|
|
384
|
+
let ShellString;
|
|
385
|
+
( (function(ShellString) {
|
|
386
|
+
function from(value) {
|
|
387
|
+
if (value === undefined || value === null) {
|
|
388
|
+
return undefined;
|
|
389
|
+
}
|
|
390
|
+
if (Types.isString(value)) {
|
|
391
|
+
return value;
|
|
392
|
+
}
|
|
393
|
+
else if (Types.isStringArray(value)) {
|
|
394
|
+
return value.join(' ');
|
|
395
|
+
}
|
|
396
|
+
else {
|
|
397
|
+
const quoting = ShellQuoting.from(value.quoting);
|
|
398
|
+
const result = Types.isString(value.value) ? value.value : Types.isStringArray(value.value) ? value.value.join(' ') : undefined;
|
|
399
|
+
if (result) {
|
|
400
|
+
return {
|
|
401
|
+
value: result,
|
|
402
|
+
quoting: quoting
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
else {
|
|
406
|
+
return undefined;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
ShellString.from = from;
|
|
411
|
+
})(ShellString || (ShellString = {})));
|
|
412
|
+
const properties = [
|
|
413
|
+
{ property: 'runtime' }, { property: 'name' }, { property: 'options', type: CommandOptions },
|
|
414
|
+
{ property: 'args' }, { property: 'taskSelector' }, { property: 'suppressTaskName' },
|
|
415
|
+
{ property: 'presentation', type: PresentationOptions }
|
|
416
|
+
];
|
|
417
|
+
function from(config, context) {
|
|
418
|
+
let result = fromBase(config, context);
|
|
419
|
+
let osConfig = undefined;
|
|
420
|
+
if (config.windows && context.platform === 3 ) {
|
|
421
|
+
osConfig = fromBase(config.windows, context);
|
|
422
|
+
}
|
|
423
|
+
else if (config.osx && context.platform === 1 ) {
|
|
424
|
+
osConfig = fromBase(config.osx, context);
|
|
425
|
+
}
|
|
426
|
+
else if (config.linux && context.platform === 2 ) {
|
|
427
|
+
osConfig = fromBase(config.linux, context);
|
|
428
|
+
}
|
|
429
|
+
if (osConfig) {
|
|
430
|
+
result = assignProperties(result, osConfig, context.schemaVersion === 2 );
|
|
431
|
+
}
|
|
432
|
+
return isEmpty(result) ? undefined : result;
|
|
433
|
+
}
|
|
434
|
+
CommandConfiguration.from = from;
|
|
435
|
+
function fromBase(config, context) {
|
|
436
|
+
const name = ShellString.from(config.command);
|
|
437
|
+
let runtime;
|
|
438
|
+
if (Types.isString(config.type)) {
|
|
439
|
+
if (config.type === 'shell' || config.type === 'process') {
|
|
440
|
+
runtime = RuntimeType.fromString(config.type);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
const isShellConfiguration = ShellConfiguration.is(config.isShellCommand);
|
|
444
|
+
if (Types.isBoolean(config.isShellCommand) || isShellConfiguration) {
|
|
445
|
+
runtime = RuntimeType.Shell;
|
|
446
|
+
}
|
|
447
|
+
else if (config.isShellCommand !== undefined) {
|
|
448
|
+
runtime = !!config.isShellCommand ? RuntimeType.Shell : RuntimeType.Process;
|
|
449
|
+
}
|
|
450
|
+
const result = {
|
|
451
|
+
name: name,
|
|
452
|
+
runtime: runtime,
|
|
453
|
+
presentation: PresentationOptions.from(config, context)
|
|
454
|
+
};
|
|
455
|
+
if (config.args !== undefined) {
|
|
456
|
+
result.args = [];
|
|
457
|
+
for (const arg of config.args) {
|
|
458
|
+
const converted = ShellString.from(arg);
|
|
459
|
+
if (converted !== undefined) {
|
|
460
|
+
result.args.push(converted);
|
|
461
|
+
}
|
|
462
|
+
else {
|
|
463
|
+
context.taskLoadIssues.push(( nls.localizeWithPath(
|
|
464
|
+
'vs/workbench/contrib/tasks/common/taskConfiguration',
|
|
465
|
+
'ConfigurationParser.inValidArg',
|
|
466
|
+
'Error: command argument must either be a string or a quoted string. Provided value is:\n{0}',
|
|
467
|
+
arg ? JSON.stringify(arg, undefined, 4) : 'undefined'
|
|
468
|
+
)));
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
if (config.options !== undefined) {
|
|
473
|
+
result.options = CommandOptions.from(config.options, context);
|
|
474
|
+
if (result.options && result.options.shell === undefined && isShellConfiguration) {
|
|
475
|
+
result.options.shell = ShellConfiguration.from(config.isShellCommand, context);
|
|
476
|
+
if (context.engine !== ExecutionEngine$1.Terminal) {
|
|
477
|
+
context.taskLoadIssues.push(( nls.localizeWithPath(
|
|
478
|
+
'vs/workbench/contrib/tasks/common/taskConfiguration',
|
|
479
|
+
'ConfigurationParser.noShell',
|
|
480
|
+
'Warning: shell configuration is only supported when executing tasks in the terminal.'
|
|
481
|
+
)));
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
if (Types.isString(config.taskSelector)) {
|
|
486
|
+
result.taskSelector = config.taskSelector;
|
|
487
|
+
}
|
|
488
|
+
if (Types.isBoolean(config.suppressTaskName)) {
|
|
489
|
+
result.suppressTaskName = config.suppressTaskName;
|
|
490
|
+
}
|
|
491
|
+
return isEmpty(result) ? undefined : result;
|
|
492
|
+
}
|
|
493
|
+
function hasCommand(value) {
|
|
494
|
+
return value && !!value.name;
|
|
495
|
+
}
|
|
496
|
+
CommandConfiguration.hasCommand = hasCommand;
|
|
497
|
+
function isEmpty(value) {
|
|
498
|
+
return _isEmpty(value, properties);
|
|
499
|
+
}
|
|
500
|
+
CommandConfiguration.isEmpty = isEmpty;
|
|
501
|
+
function assignProperties(target, source, overwriteArgs) {
|
|
502
|
+
if (isEmpty(source)) {
|
|
503
|
+
return target;
|
|
504
|
+
}
|
|
505
|
+
if (isEmpty(target)) {
|
|
506
|
+
return source;
|
|
507
|
+
}
|
|
508
|
+
assignProperty(target, source, 'name');
|
|
509
|
+
assignProperty(target, source, 'runtime');
|
|
510
|
+
assignProperty(target, source, 'taskSelector');
|
|
511
|
+
assignProperty(target, source, 'suppressTaskName');
|
|
512
|
+
if (source.args !== undefined) {
|
|
513
|
+
if (target.args === undefined || overwriteArgs) {
|
|
514
|
+
target.args = source.args;
|
|
515
|
+
}
|
|
516
|
+
else {
|
|
517
|
+
target.args = target.args.concat(source.args);
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
target.presentation = PresentationOptions.assignProperties(target.presentation, source.presentation);
|
|
521
|
+
target.options = CommandOptions.assignProperties(target.options, source.options);
|
|
522
|
+
return target;
|
|
523
|
+
}
|
|
524
|
+
CommandConfiguration.assignProperties = assignProperties;
|
|
525
|
+
function fillProperties(target, source) {
|
|
526
|
+
return _fillProperties(target, source, properties);
|
|
527
|
+
}
|
|
528
|
+
CommandConfiguration.fillProperties = fillProperties;
|
|
529
|
+
function fillGlobals(target, source, taskName) {
|
|
530
|
+
if ((source === undefined) || isEmpty(source)) {
|
|
531
|
+
return target;
|
|
532
|
+
}
|
|
533
|
+
target = target || {
|
|
534
|
+
name: undefined,
|
|
535
|
+
runtime: undefined,
|
|
536
|
+
presentation: undefined
|
|
537
|
+
};
|
|
538
|
+
if (target.name === undefined) {
|
|
539
|
+
fillProperty(target, source, 'name');
|
|
540
|
+
fillProperty(target, source, 'taskSelector');
|
|
541
|
+
fillProperty(target, source, 'suppressTaskName');
|
|
542
|
+
let args = source.args ? source.args.slice() : [];
|
|
543
|
+
if (!target.suppressTaskName && taskName) {
|
|
544
|
+
if (target.taskSelector !== undefined) {
|
|
545
|
+
args.push(target.taskSelector + taskName);
|
|
546
|
+
}
|
|
547
|
+
else {
|
|
548
|
+
args.push(taskName);
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
if (target.args) {
|
|
552
|
+
args = args.concat(target.args);
|
|
553
|
+
}
|
|
554
|
+
target.args = args;
|
|
555
|
+
}
|
|
556
|
+
fillProperty(target, source, 'runtime');
|
|
557
|
+
target.presentation = PresentationOptions.fillProperties(target.presentation, source.presentation);
|
|
558
|
+
target.options = CommandOptions.fillProperties(target.options, source.options);
|
|
559
|
+
return target;
|
|
560
|
+
}
|
|
561
|
+
CommandConfiguration.fillGlobals = fillGlobals;
|
|
562
|
+
function fillDefaults(value, context) {
|
|
563
|
+
if (!value || Object.isFrozen(value)) {
|
|
564
|
+
return;
|
|
565
|
+
}
|
|
566
|
+
if (value.name !== undefined && value.runtime === undefined) {
|
|
567
|
+
value.runtime = RuntimeType.Process;
|
|
568
|
+
}
|
|
569
|
+
value.presentation = PresentationOptions.fillDefaults(value.presentation, context);
|
|
570
|
+
if (!isEmpty(value)) {
|
|
571
|
+
value.options = CommandOptions.fillDefaults(value.options, context);
|
|
572
|
+
}
|
|
573
|
+
if (value.args === undefined) {
|
|
574
|
+
value.args = EMPTY_ARRAY;
|
|
575
|
+
}
|
|
576
|
+
if (value.suppressTaskName === undefined) {
|
|
577
|
+
value.suppressTaskName = ((context.schemaVersion === 2) );
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
CommandConfiguration.fillDefaults = fillDefaults;
|
|
581
|
+
function freeze(value) {
|
|
582
|
+
return _freeze(value, properties);
|
|
583
|
+
}
|
|
584
|
+
CommandConfiguration.freeze = freeze;
|
|
585
|
+
})(CommandConfiguration || (CommandConfiguration = {})));
|
|
586
|
+
var ProblemMatcherConverter;
|
|
587
|
+
( (function(ProblemMatcherConverter) {
|
|
588
|
+
function namedFrom(declares, context) {
|
|
589
|
+
const result = Object.create(null);
|
|
590
|
+
if (!Array.isArray(declares)) {
|
|
591
|
+
return result;
|
|
592
|
+
}
|
|
593
|
+
declares.forEach((value) => {
|
|
594
|
+
const namedProblemMatcher = (( new ProblemMatcherParser(context.problemReporter))).parse(value);
|
|
595
|
+
if (isNamedProblemMatcher(namedProblemMatcher)) {
|
|
596
|
+
result[namedProblemMatcher.name] = namedProblemMatcher;
|
|
597
|
+
}
|
|
598
|
+
else {
|
|
599
|
+
context.problemReporter.error(( nls.localizeWithPath(
|
|
600
|
+
'vs/workbench/contrib/tasks/common/taskConfiguration',
|
|
601
|
+
'ConfigurationParser.noName',
|
|
602
|
+
'Error: Problem Matcher in declare scope must have a name:\n{0}\n',
|
|
603
|
+
JSON.stringify(value, undefined, 4)
|
|
604
|
+
)));
|
|
605
|
+
}
|
|
606
|
+
});
|
|
607
|
+
return result;
|
|
608
|
+
}
|
|
609
|
+
ProblemMatcherConverter.namedFrom = namedFrom;
|
|
610
|
+
function fromWithOsConfig(external, context) {
|
|
611
|
+
let result = {};
|
|
612
|
+
if (external.windows && external.windows.problemMatcher && context.platform === 3 ) {
|
|
613
|
+
result = from(external.windows.problemMatcher, context);
|
|
614
|
+
}
|
|
615
|
+
else if (external.osx && external.osx.problemMatcher && context.platform === 1 ) {
|
|
616
|
+
result = from(external.osx.problemMatcher, context);
|
|
617
|
+
}
|
|
618
|
+
else if (external.linux && external.linux.problemMatcher && context.platform === 2 ) {
|
|
619
|
+
result = from(external.linux.problemMatcher, context);
|
|
620
|
+
}
|
|
621
|
+
else if (external.problemMatcher) {
|
|
622
|
+
result = from(external.problemMatcher, context);
|
|
623
|
+
}
|
|
624
|
+
return result;
|
|
625
|
+
}
|
|
626
|
+
ProblemMatcherConverter.fromWithOsConfig = fromWithOsConfig;
|
|
627
|
+
function from(config, context) {
|
|
628
|
+
const result = [];
|
|
629
|
+
if (config === undefined) {
|
|
630
|
+
return { value: result };
|
|
631
|
+
}
|
|
632
|
+
const errors = [];
|
|
633
|
+
function addResult(matcher) {
|
|
634
|
+
if (matcher.value) {
|
|
635
|
+
result.push(matcher.value);
|
|
636
|
+
}
|
|
637
|
+
if (matcher.errors) {
|
|
638
|
+
errors.push(...matcher.errors);
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
const kind = getProblemMatcherKind(config);
|
|
642
|
+
if (kind === ProblemMatcherKind.Unknown) {
|
|
643
|
+
const error = ( nls.localizeWithPath(
|
|
644
|
+
'vs/workbench/contrib/tasks/common/taskConfiguration',
|
|
645
|
+
'ConfigurationParser.unknownMatcherKind',
|
|
646
|
+
'Warning: the defined problem matcher is unknown. Supported types are string | ProblemMatcher | Array<string | ProblemMatcher>.\n{0}\n',
|
|
647
|
+
JSON.stringify(config, null, 4)
|
|
648
|
+
));
|
|
649
|
+
context.problemReporter.warn(error);
|
|
650
|
+
}
|
|
651
|
+
else if (kind === ProblemMatcherKind.String || kind === ProblemMatcherKind.ProblemMatcher) {
|
|
652
|
+
addResult(resolveProblemMatcher(config, context));
|
|
653
|
+
}
|
|
654
|
+
else if (kind === ProblemMatcherKind.Array) {
|
|
655
|
+
const problemMatchers = config;
|
|
656
|
+
problemMatchers.forEach(problemMatcher => {
|
|
657
|
+
addResult(resolveProblemMatcher(problemMatcher, context));
|
|
658
|
+
});
|
|
659
|
+
}
|
|
660
|
+
return { value: result, errors };
|
|
661
|
+
}
|
|
662
|
+
ProblemMatcherConverter.from = from;
|
|
663
|
+
function getProblemMatcherKind(value) {
|
|
664
|
+
if (Types.isString(value)) {
|
|
665
|
+
return ProblemMatcherKind.String;
|
|
666
|
+
}
|
|
667
|
+
else if (Array.isArray(value)) {
|
|
668
|
+
return ProblemMatcherKind.Array;
|
|
669
|
+
}
|
|
670
|
+
else if (!Types.isUndefined(value)) {
|
|
671
|
+
return ProblemMatcherKind.ProblemMatcher;
|
|
672
|
+
}
|
|
673
|
+
else {
|
|
674
|
+
return ProblemMatcherKind.Unknown;
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
function resolveProblemMatcher(value, context) {
|
|
678
|
+
if (Types.isString(value)) {
|
|
679
|
+
let variableName = value;
|
|
680
|
+
if (variableName.length > 1 && variableName[0] === '$') {
|
|
681
|
+
variableName = variableName.substring(1);
|
|
682
|
+
const global = ProblemMatcherRegistry.get(variableName);
|
|
683
|
+
if (global) {
|
|
684
|
+
return { value: Objects.deepClone(global) };
|
|
685
|
+
}
|
|
686
|
+
let localProblemMatcher = context.namedProblemMatchers[variableName];
|
|
687
|
+
if (localProblemMatcher) {
|
|
688
|
+
localProblemMatcher = Objects.deepClone(localProblemMatcher);
|
|
689
|
+
delete localProblemMatcher.name;
|
|
690
|
+
return { value: localProblemMatcher };
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
return { errors: [( nls.localizeWithPath(
|
|
694
|
+
'vs/workbench/contrib/tasks/common/taskConfiguration',
|
|
695
|
+
'ConfigurationParser.invalidVariableReference',
|
|
696
|
+
'Error: Invalid problemMatcher reference: {0}\n',
|
|
697
|
+
value
|
|
698
|
+
))] };
|
|
699
|
+
}
|
|
700
|
+
else {
|
|
701
|
+
const json = value;
|
|
702
|
+
return { value: ( new ProblemMatcherParser(context.problemReporter)).parse(json) };
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
})(ProblemMatcherConverter || (ProblemMatcherConverter = {})));
|
|
706
|
+
const partialSource = {
|
|
707
|
+
label: 'Workspace',
|
|
708
|
+
config: undefined
|
|
709
|
+
};
|
|
710
|
+
var GroupKind;
|
|
711
|
+
( (function(GroupKind) {
|
|
712
|
+
function from(external) {
|
|
713
|
+
if (external === undefined) {
|
|
714
|
+
return undefined;
|
|
715
|
+
}
|
|
716
|
+
else if (Types.isString(external) && TaskGroup.is(external)) {
|
|
717
|
+
return { _id: external, isDefault: false };
|
|
718
|
+
}
|
|
719
|
+
else if (Types.isString(external.kind) && TaskGroup.is(external.kind)) {
|
|
720
|
+
const group = external.kind;
|
|
721
|
+
const isDefault = Types.isUndefined(external.isDefault) ? false : external.isDefault;
|
|
722
|
+
return { _id: group, isDefault };
|
|
723
|
+
}
|
|
724
|
+
return undefined;
|
|
725
|
+
}
|
|
726
|
+
GroupKind.from = from;
|
|
727
|
+
function to(group) {
|
|
728
|
+
if (Types.isString(group)) {
|
|
729
|
+
return group;
|
|
730
|
+
}
|
|
731
|
+
else if (!group.isDefault) {
|
|
732
|
+
return group._id;
|
|
733
|
+
}
|
|
734
|
+
return {
|
|
735
|
+
kind: group._id,
|
|
736
|
+
isDefault: group.isDefault,
|
|
737
|
+
};
|
|
738
|
+
}
|
|
739
|
+
GroupKind.to = to;
|
|
740
|
+
})(GroupKind || (GroupKind = {})));
|
|
741
|
+
var TaskDependency;
|
|
742
|
+
( (function(TaskDependency) {
|
|
743
|
+
function uriFromSource(context, source) {
|
|
744
|
+
switch (source) {
|
|
745
|
+
case TaskConfigSource.User: return USER_TASKS_GROUP_KEY;
|
|
746
|
+
case TaskConfigSource.TasksJson: return context.workspaceFolder.uri;
|
|
747
|
+
default: return context.workspace && context.workspace.configuration ? context.workspace.configuration : context.workspaceFolder.uri;
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
function from(external, context, source) {
|
|
751
|
+
if (Types.isString(external)) {
|
|
752
|
+
return { uri: uriFromSource(context, source), task: external };
|
|
753
|
+
}
|
|
754
|
+
else if (ITaskIdentifier.is(external)) {
|
|
755
|
+
return {
|
|
756
|
+
uri: uriFromSource(context, source),
|
|
757
|
+
task: TaskDefinition.createTaskIdentifier(external, context.problemReporter)
|
|
758
|
+
};
|
|
759
|
+
}
|
|
760
|
+
else {
|
|
761
|
+
return undefined;
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
TaskDependency.from = from;
|
|
765
|
+
})(TaskDependency || (TaskDependency = {})));
|
|
766
|
+
var DependsOrder;
|
|
767
|
+
( (function(DependsOrder) {
|
|
768
|
+
function from(order) {
|
|
769
|
+
switch (order) {
|
|
770
|
+
case "sequence" :
|
|
771
|
+
return "sequence" ;
|
|
772
|
+
case "parallel" :
|
|
773
|
+
default:
|
|
774
|
+
return "parallel" ;
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
DependsOrder.from = from;
|
|
778
|
+
})(DependsOrder || (DependsOrder = {})));
|
|
779
|
+
var ConfigurationProperties;
|
|
780
|
+
( (function(ConfigurationProperties) {
|
|
781
|
+
const properties = [
|
|
782
|
+
{ property: 'name' },
|
|
783
|
+
{ property: 'identifier' },
|
|
784
|
+
{ property: 'group' },
|
|
785
|
+
{ property: 'isBackground' },
|
|
786
|
+
{ property: 'promptOnClose' },
|
|
787
|
+
{ property: 'dependsOn' },
|
|
788
|
+
{ property: 'presentation', type: CommandConfiguration.PresentationOptions },
|
|
789
|
+
{ property: 'problemMatchers' },
|
|
790
|
+
{ property: 'options' },
|
|
791
|
+
{ property: 'icon' },
|
|
792
|
+
{ property: 'hide' }
|
|
793
|
+
];
|
|
794
|
+
function from(external, context, includeCommandOptions, source, properties) {
|
|
795
|
+
if (!external) {
|
|
796
|
+
return {};
|
|
797
|
+
}
|
|
798
|
+
const result = {};
|
|
799
|
+
if (properties) {
|
|
800
|
+
for (const propertyName of ( Object.keys(properties))) {
|
|
801
|
+
if (external[propertyName] !== undefined) {
|
|
802
|
+
result[propertyName] = Objects.deepClone(external[propertyName]);
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
if (Types.isString(external.taskName)) {
|
|
807
|
+
result.name = external.taskName;
|
|
808
|
+
}
|
|
809
|
+
if (Types.isString(external.label) && context.schemaVersion === 2 ) {
|
|
810
|
+
result.name = external.label;
|
|
811
|
+
}
|
|
812
|
+
if (Types.isString(external.identifier)) {
|
|
813
|
+
result.identifier = external.identifier;
|
|
814
|
+
}
|
|
815
|
+
result.icon = external.icon;
|
|
816
|
+
result.hide = external.hide;
|
|
817
|
+
if (external.isBackground !== undefined) {
|
|
818
|
+
result.isBackground = !!external.isBackground;
|
|
819
|
+
}
|
|
820
|
+
if (external.promptOnClose !== undefined) {
|
|
821
|
+
result.promptOnClose = !!external.promptOnClose;
|
|
822
|
+
}
|
|
823
|
+
result.group = GroupKind.from(external.group);
|
|
824
|
+
if (external.dependsOn !== undefined) {
|
|
825
|
+
if (Array.isArray(external.dependsOn)) {
|
|
826
|
+
result.dependsOn = external.dependsOn.reduce((dependencies, item) => {
|
|
827
|
+
const dependency = TaskDependency.from(item, context, source);
|
|
828
|
+
if (dependency) {
|
|
829
|
+
dependencies.push(dependency);
|
|
830
|
+
}
|
|
831
|
+
return dependencies;
|
|
832
|
+
}, []);
|
|
833
|
+
}
|
|
834
|
+
else {
|
|
835
|
+
const dependsOnValue = TaskDependency.from(external.dependsOn, context, source);
|
|
836
|
+
result.dependsOn = dependsOnValue ? [dependsOnValue] : undefined;
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
result.dependsOrder = DependsOrder.from(external.dependsOrder);
|
|
840
|
+
if (includeCommandOptions && (external.presentation !== undefined || external.terminal !== undefined)) {
|
|
841
|
+
result.presentation = CommandConfiguration.PresentationOptions.from(external, context);
|
|
842
|
+
}
|
|
843
|
+
if (includeCommandOptions && (external.options !== undefined)) {
|
|
844
|
+
result.options = CommandOptions.from(external.options, context);
|
|
845
|
+
}
|
|
846
|
+
const configProblemMatcher = ProblemMatcherConverter.fromWithOsConfig(external, context);
|
|
847
|
+
if (configProblemMatcher.value !== undefined) {
|
|
848
|
+
result.problemMatchers = configProblemMatcher.value;
|
|
849
|
+
}
|
|
850
|
+
if (external.detail) {
|
|
851
|
+
result.detail = external.detail;
|
|
852
|
+
}
|
|
853
|
+
return isEmpty(result) ? {} : { value: result, errors: configProblemMatcher.errors };
|
|
854
|
+
}
|
|
855
|
+
ConfigurationProperties.from = from;
|
|
856
|
+
function isEmpty(value) {
|
|
857
|
+
return _isEmpty(value, properties);
|
|
858
|
+
}
|
|
859
|
+
ConfigurationProperties.isEmpty = isEmpty;
|
|
860
|
+
})(ConfigurationProperties || (ConfigurationProperties = {})));
|
|
861
|
+
var ConfiguringTask;
|
|
862
|
+
( (function(ConfiguringTask) {
|
|
863
|
+
const grunt = 'grunt.';
|
|
864
|
+
const jake = 'jake.';
|
|
865
|
+
const gulp = 'gulp.';
|
|
866
|
+
const npm = 'vscode.npm.';
|
|
867
|
+
const typescript = 'vscode.typescript.';
|
|
868
|
+
function from(external, context, index, source, registry) {
|
|
869
|
+
if (!external) {
|
|
870
|
+
return undefined;
|
|
871
|
+
}
|
|
872
|
+
const type = external.type;
|
|
873
|
+
const customize = external.customize;
|
|
874
|
+
if (!type && !customize) {
|
|
875
|
+
context.problemReporter.error(( nls.localizeWithPath(
|
|
876
|
+
'vs/workbench/contrib/tasks/common/taskConfiguration',
|
|
877
|
+
'ConfigurationParser.noTaskType',
|
|
878
|
+
'Error: tasks configuration must have a type property. The configuration will be ignored.\n{0}\n',
|
|
879
|
+
JSON.stringify(external, null, 4)
|
|
880
|
+
)));
|
|
881
|
+
return undefined;
|
|
882
|
+
}
|
|
883
|
+
const typeDeclaration = type ? registry?.get?.(type) || TaskDefinitionRegistry.get(type) : undefined;
|
|
884
|
+
if (!typeDeclaration) {
|
|
885
|
+
const message = ( nls.localizeWithPath(
|
|
886
|
+
'vs/workbench/contrib/tasks/common/taskConfiguration',
|
|
887
|
+
'ConfigurationParser.noTypeDefinition',
|
|
888
|
+
'Error: there is no registered task type \'{0}\'. Did you miss installing an extension that provides a corresponding task provider?',
|
|
889
|
+
type
|
|
890
|
+
));
|
|
891
|
+
context.problemReporter.error(message);
|
|
892
|
+
return undefined;
|
|
893
|
+
}
|
|
894
|
+
let identifier;
|
|
895
|
+
if (Types.isString(customize)) {
|
|
896
|
+
if (customize.indexOf(grunt) === 0) {
|
|
897
|
+
identifier = { type: 'grunt', task: customize.substring(grunt.length) };
|
|
898
|
+
}
|
|
899
|
+
else if (customize.indexOf(jake) === 0) {
|
|
900
|
+
identifier = { type: 'jake', task: customize.substring(jake.length) };
|
|
901
|
+
}
|
|
902
|
+
else if (customize.indexOf(gulp) === 0) {
|
|
903
|
+
identifier = { type: 'gulp', task: customize.substring(gulp.length) };
|
|
904
|
+
}
|
|
905
|
+
else if (customize.indexOf(npm) === 0) {
|
|
906
|
+
identifier = { type: 'npm', script: customize.substring(npm.length + 4) };
|
|
907
|
+
}
|
|
908
|
+
else if (customize.indexOf(typescript) === 0) {
|
|
909
|
+
identifier = { type: 'typescript', tsconfig: customize.substring(typescript.length + 6) };
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
else {
|
|
913
|
+
if (Types.isString(external.type)) {
|
|
914
|
+
identifier = external;
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
if (identifier === undefined) {
|
|
918
|
+
context.problemReporter.error(( nls.localizeWithPath(
|
|
919
|
+
'vs/workbench/contrib/tasks/common/taskConfiguration',
|
|
920
|
+
'ConfigurationParser.missingType',
|
|
921
|
+
'Error: the task configuration \'{0}\' is missing the required property \'type\'. The task configuration will be ignored.',
|
|
922
|
+
JSON.stringify(external, undefined, 0)
|
|
923
|
+
)));
|
|
924
|
+
return undefined;
|
|
925
|
+
}
|
|
926
|
+
const taskIdentifier = TaskDefinition.createTaskIdentifier(identifier, context.problemReporter);
|
|
927
|
+
if (taskIdentifier === undefined) {
|
|
928
|
+
context.problemReporter.error(( nls.localizeWithPath(
|
|
929
|
+
'vs/workbench/contrib/tasks/common/taskConfiguration',
|
|
930
|
+
'ConfigurationParser.incorrectType',
|
|
931
|
+
'Error: the task configuration \'{0}\' is using an unknown type. The task configuration will be ignored.',
|
|
932
|
+
JSON.stringify(external, undefined, 0)
|
|
933
|
+
)));
|
|
934
|
+
return undefined;
|
|
935
|
+
}
|
|
936
|
+
const configElement = {
|
|
937
|
+
workspaceFolder: context.workspaceFolder,
|
|
938
|
+
file: '.vscode/tasks.json',
|
|
939
|
+
index,
|
|
940
|
+
element: external
|
|
941
|
+
};
|
|
942
|
+
let taskSource;
|
|
943
|
+
switch (source) {
|
|
944
|
+
case TaskConfigSource.User: {
|
|
945
|
+
taskSource = Object.assign({}, partialSource, { kind: TaskSourceKind.User, config: configElement });
|
|
946
|
+
break;
|
|
947
|
+
}
|
|
948
|
+
case TaskConfigSource.WorkspaceFile: {
|
|
949
|
+
taskSource = Object.assign({}, partialSource, { kind: TaskSourceKind.WorkspaceFile, config: configElement });
|
|
950
|
+
break;
|
|
951
|
+
}
|
|
952
|
+
default: {
|
|
953
|
+
taskSource = Object.assign({}, partialSource, { kind: TaskSourceKind.Workspace, config: configElement });
|
|
954
|
+
break;
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
const result = new ConfiguringTask$1(`${typeDeclaration.extensionId}.${taskIdentifier._key}`, taskSource, undefined, type, taskIdentifier, RunOptions.fromConfiguration(external.runOptions), { hide: external.hide });
|
|
958
|
+
const configuration = ConfigurationProperties.from(external, context, true, source, typeDeclaration.properties);
|
|
959
|
+
result.addTaskLoadMessages(configuration.errors);
|
|
960
|
+
if (configuration.value) {
|
|
961
|
+
result.configurationProperties = Object.assign(result.configurationProperties, configuration.value);
|
|
962
|
+
if (result.configurationProperties.name) {
|
|
963
|
+
result._label = result.configurationProperties.name;
|
|
964
|
+
}
|
|
965
|
+
else {
|
|
966
|
+
let label = result.configures.type;
|
|
967
|
+
if (typeDeclaration.required && typeDeclaration.required.length > 0) {
|
|
968
|
+
for (const required of typeDeclaration.required) {
|
|
969
|
+
const value = result.configures[required];
|
|
970
|
+
if (value) {
|
|
971
|
+
label = label + ': ' + value;
|
|
972
|
+
break;
|
|
973
|
+
}
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
result._label = label;
|
|
977
|
+
}
|
|
978
|
+
if (!result.configurationProperties.identifier) {
|
|
979
|
+
result.configurationProperties.identifier = taskIdentifier._key;
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
return result;
|
|
983
|
+
}
|
|
984
|
+
ConfiguringTask.from = from;
|
|
985
|
+
})(ConfiguringTask || (ConfiguringTask = {})));
|
|
986
|
+
var CustomTask;
|
|
987
|
+
( (function(CustomTask) {
|
|
988
|
+
function from(external, context, index, source) {
|
|
989
|
+
if (!external) {
|
|
990
|
+
return undefined;
|
|
991
|
+
}
|
|
992
|
+
let type = external.type;
|
|
993
|
+
if (type === undefined || type === null) {
|
|
994
|
+
type = CUSTOMIZED_TASK_TYPE;
|
|
995
|
+
}
|
|
996
|
+
if (type !== CUSTOMIZED_TASK_TYPE && type !== 'shell' && type !== 'process') {
|
|
997
|
+
context.problemReporter.error(( nls.localizeWithPath(
|
|
998
|
+
'vs/workbench/contrib/tasks/common/taskConfiguration',
|
|
999
|
+
'ConfigurationParser.notCustom',
|
|
1000
|
+
'Error: tasks is not declared as a custom task. The configuration will be ignored.\n{0}\n',
|
|
1001
|
+
JSON.stringify(external, null, 4)
|
|
1002
|
+
)));
|
|
1003
|
+
return undefined;
|
|
1004
|
+
}
|
|
1005
|
+
let taskName = external.taskName;
|
|
1006
|
+
if (Types.isString(external.label) && context.schemaVersion === 2 ) {
|
|
1007
|
+
taskName = external.label;
|
|
1008
|
+
}
|
|
1009
|
+
if (!taskName) {
|
|
1010
|
+
context.problemReporter.error(( nls.localizeWithPath(
|
|
1011
|
+
'vs/workbench/contrib/tasks/common/taskConfiguration',
|
|
1012
|
+
'ConfigurationParser.noTaskName',
|
|
1013
|
+
'Error: a task must provide a label property. The task will be ignored.\n{0}\n',
|
|
1014
|
+
JSON.stringify(external, null, 4)
|
|
1015
|
+
)));
|
|
1016
|
+
return undefined;
|
|
1017
|
+
}
|
|
1018
|
+
let taskSource;
|
|
1019
|
+
switch (source) {
|
|
1020
|
+
case TaskConfigSource.User: {
|
|
1021
|
+
taskSource = Object.assign({}, partialSource, { kind: TaskSourceKind.User, config: { index, element: external, file: '.vscode/tasks.json', workspaceFolder: context.workspaceFolder } });
|
|
1022
|
+
break;
|
|
1023
|
+
}
|
|
1024
|
+
case TaskConfigSource.WorkspaceFile: {
|
|
1025
|
+
taskSource = Object.assign({}, partialSource, { kind: TaskSourceKind.WorkspaceFile, config: { index, element: external, file: '.vscode/tasks.json', workspaceFolder: context.workspaceFolder, workspace: context.workspace } });
|
|
1026
|
+
break;
|
|
1027
|
+
}
|
|
1028
|
+
default: {
|
|
1029
|
+
taskSource = Object.assign({}, partialSource, { kind: TaskSourceKind.Workspace, config: { index, element: external, file: '.vscode/tasks.json', workspaceFolder: context.workspaceFolder } });
|
|
1030
|
+
break;
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
const result = new CustomTask$1(context.uuidMap.getUUID(taskName), taskSource, taskName, CUSTOMIZED_TASK_TYPE, undefined, false, RunOptions.fromConfiguration(external.runOptions), {
|
|
1034
|
+
name: taskName,
|
|
1035
|
+
identifier: taskName,
|
|
1036
|
+
});
|
|
1037
|
+
const configuration = ConfigurationProperties.from(external, context, false, source);
|
|
1038
|
+
result.addTaskLoadMessages(configuration.errors);
|
|
1039
|
+
if (configuration.value) {
|
|
1040
|
+
result.configurationProperties = Object.assign(result.configurationProperties, configuration.value);
|
|
1041
|
+
}
|
|
1042
|
+
{
|
|
1043
|
+
const legacy = external;
|
|
1044
|
+
if (result.configurationProperties.isBackground === undefined && legacy.isWatching !== undefined) {
|
|
1045
|
+
result.configurationProperties.isBackground = !!legacy.isWatching;
|
|
1046
|
+
}
|
|
1047
|
+
if (result.configurationProperties.group === undefined) {
|
|
1048
|
+
if (legacy.isBuildCommand === true) {
|
|
1049
|
+
result.configurationProperties.group = TaskGroup.Build;
|
|
1050
|
+
}
|
|
1051
|
+
else if (legacy.isTestCommand === true) {
|
|
1052
|
+
result.configurationProperties.group = TaskGroup.Test;
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
const command = CommandConfiguration.from(external, context);
|
|
1057
|
+
if (command) {
|
|
1058
|
+
result.command = command;
|
|
1059
|
+
}
|
|
1060
|
+
if (external.command !== undefined) {
|
|
1061
|
+
command.suppressTaskName = true;
|
|
1062
|
+
}
|
|
1063
|
+
return result;
|
|
1064
|
+
}
|
|
1065
|
+
CustomTask.from = from;
|
|
1066
|
+
function fillGlobals(task, globals) {
|
|
1067
|
+
if (CommandConfiguration.hasCommand(task.command) || task.configurationProperties.dependsOn === undefined) {
|
|
1068
|
+
task.command = CommandConfiguration.fillGlobals(task.command, globals.command, task.configurationProperties.name);
|
|
1069
|
+
}
|
|
1070
|
+
if (task.configurationProperties.problemMatchers === undefined && globals.problemMatcher !== undefined) {
|
|
1071
|
+
task.configurationProperties.problemMatchers = Objects.deepClone(globals.problemMatcher);
|
|
1072
|
+
task.hasDefinedMatchers = true;
|
|
1073
|
+
}
|
|
1074
|
+
if (task.configurationProperties.promptOnClose === undefined && task.configurationProperties.isBackground === undefined && globals.promptOnClose !== undefined) {
|
|
1075
|
+
task.configurationProperties.promptOnClose = globals.promptOnClose;
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
CustomTask.fillGlobals = fillGlobals;
|
|
1079
|
+
function fillDefaults(task, context) {
|
|
1080
|
+
CommandConfiguration.fillDefaults(task.command, context);
|
|
1081
|
+
if (task.configurationProperties.promptOnClose === undefined) {
|
|
1082
|
+
task.configurationProperties.promptOnClose = task.configurationProperties.isBackground !== undefined ? !task.configurationProperties.isBackground : true;
|
|
1083
|
+
}
|
|
1084
|
+
if (task.configurationProperties.isBackground === undefined) {
|
|
1085
|
+
task.configurationProperties.isBackground = false;
|
|
1086
|
+
}
|
|
1087
|
+
if (task.configurationProperties.problemMatchers === undefined) {
|
|
1088
|
+
task.configurationProperties.problemMatchers = EMPTY_ARRAY;
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
CustomTask.fillDefaults = fillDefaults;
|
|
1092
|
+
function createCustomTask(contributedTask, configuredProps) {
|
|
1093
|
+
const result = new CustomTask$1(configuredProps._id, Object.assign({}, configuredProps._source, { customizes: contributedTask.defines }), configuredProps.configurationProperties.name || contributedTask._label, CUSTOMIZED_TASK_TYPE, contributedTask.command, false, contributedTask.runOptions, {
|
|
1094
|
+
name: configuredProps.configurationProperties.name || contributedTask.configurationProperties.name,
|
|
1095
|
+
identifier: configuredProps.configurationProperties.identifier || contributedTask.configurationProperties.identifier,
|
|
1096
|
+
icon: configuredProps.configurationProperties.icon,
|
|
1097
|
+
hide: configuredProps.configurationProperties.hide
|
|
1098
|
+
});
|
|
1099
|
+
result.addTaskLoadMessages(configuredProps.taskLoadMessages);
|
|
1100
|
+
const resultConfigProps = result.configurationProperties;
|
|
1101
|
+
assignProperty(resultConfigProps, configuredProps.configurationProperties, 'group');
|
|
1102
|
+
assignProperty(resultConfigProps, configuredProps.configurationProperties, 'isBackground');
|
|
1103
|
+
assignProperty(resultConfigProps, configuredProps.configurationProperties, 'dependsOn');
|
|
1104
|
+
assignProperty(resultConfigProps, configuredProps.configurationProperties, 'problemMatchers');
|
|
1105
|
+
assignProperty(resultConfigProps, configuredProps.configurationProperties, 'promptOnClose');
|
|
1106
|
+
assignProperty(resultConfigProps, configuredProps.configurationProperties, 'detail');
|
|
1107
|
+
result.command.presentation = CommandConfiguration.PresentationOptions.assignProperties(result.command.presentation, configuredProps.configurationProperties.presentation);
|
|
1108
|
+
result.command.options = CommandOptions.assignProperties(result.command.options, configuredProps.configurationProperties.options);
|
|
1109
|
+
result.runOptions = RunOptions.assignProperties(result.runOptions, configuredProps.runOptions);
|
|
1110
|
+
const contributedConfigProps = contributedTask.configurationProperties;
|
|
1111
|
+
fillProperty(resultConfigProps, contributedConfigProps, 'group');
|
|
1112
|
+
fillProperty(resultConfigProps, contributedConfigProps, 'isBackground');
|
|
1113
|
+
fillProperty(resultConfigProps, contributedConfigProps, 'dependsOn');
|
|
1114
|
+
fillProperty(resultConfigProps, contributedConfigProps, 'problemMatchers');
|
|
1115
|
+
fillProperty(resultConfigProps, contributedConfigProps, 'promptOnClose');
|
|
1116
|
+
fillProperty(resultConfigProps, contributedConfigProps, 'detail');
|
|
1117
|
+
result.command.presentation = CommandConfiguration.PresentationOptions.fillProperties(result.command.presentation, contributedConfigProps.presentation);
|
|
1118
|
+
result.command.options = CommandOptions.fillProperties(result.command.options, contributedConfigProps.options);
|
|
1119
|
+
result.runOptions = RunOptions.fillProperties(result.runOptions, contributedTask.runOptions);
|
|
1120
|
+
if (contributedTask.hasDefinedMatchers === true) {
|
|
1121
|
+
result.hasDefinedMatchers = true;
|
|
1122
|
+
}
|
|
1123
|
+
return result;
|
|
1124
|
+
}
|
|
1125
|
+
CustomTask.createCustomTask = createCustomTask;
|
|
1126
|
+
})(CustomTask || (CustomTask = {})));
|
|
1127
|
+
var TaskParser;
|
|
1128
|
+
( (function(TaskParser) {
|
|
1129
|
+
function isCustomTask(value) {
|
|
1130
|
+
const type = value.type;
|
|
1131
|
+
const customize = value.customize;
|
|
1132
|
+
return customize === undefined && (type === undefined || type === null || type === CUSTOMIZED_TASK_TYPE || type === 'shell' || type === 'process');
|
|
1133
|
+
}
|
|
1134
|
+
const builtinTypeContextMap = {
|
|
1135
|
+
shell: ShellExecutionSupportedContext,
|
|
1136
|
+
process: ProcessExecutionSupportedContext
|
|
1137
|
+
};
|
|
1138
|
+
function from(externals, globals, context, source, registry) {
|
|
1139
|
+
const result = { custom: [], configured: [] };
|
|
1140
|
+
if (!externals) {
|
|
1141
|
+
return result;
|
|
1142
|
+
}
|
|
1143
|
+
const defaultBuildTask = { task: undefined, rank: -1 };
|
|
1144
|
+
const defaultTestTask = { task: undefined, rank: -1 };
|
|
1145
|
+
const schema2_0_0 = context.schemaVersion === 2 ;
|
|
1146
|
+
const baseLoadIssues = Objects.deepClone(context.taskLoadIssues);
|
|
1147
|
+
for (let index = 0; index < externals.length; index++) {
|
|
1148
|
+
const external = externals[index];
|
|
1149
|
+
const definition = external.type ? registry?.get?.(external.type) || TaskDefinitionRegistry.get(external.type) : undefined;
|
|
1150
|
+
let typeNotSupported = false;
|
|
1151
|
+
if (definition && definition.when && !context.contextKeyService.contextMatchesRules(definition.when)) {
|
|
1152
|
+
typeNotSupported = true;
|
|
1153
|
+
}
|
|
1154
|
+
else if (!definition && external.type) {
|
|
1155
|
+
for (const key of ( Object.keys(builtinTypeContextMap))) {
|
|
1156
|
+
if (external.type === key) {
|
|
1157
|
+
typeNotSupported = !ShellExecutionSupportedContext.evaluate(context.contextKeyService.getContext(null));
|
|
1158
|
+
break;
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
if (typeNotSupported) {
|
|
1163
|
+
context.problemReporter.info(( nls.localizeWithPath(
|
|
1164
|
+
'vs/workbench/contrib/tasks/common/taskConfiguration',
|
|
1165
|
+
'taskConfiguration.providerUnavailable',
|
|
1166
|
+
'Warning: {0} tasks are unavailable in the current environment.\n',
|
|
1167
|
+
external.type
|
|
1168
|
+
)));
|
|
1169
|
+
continue;
|
|
1170
|
+
}
|
|
1171
|
+
if (isCustomTask(external)) {
|
|
1172
|
+
const customTask = CustomTask.from(external, context, index, source);
|
|
1173
|
+
if (customTask) {
|
|
1174
|
+
CustomTask.fillGlobals(customTask, globals);
|
|
1175
|
+
CustomTask.fillDefaults(customTask, context);
|
|
1176
|
+
if (schema2_0_0) {
|
|
1177
|
+
if ((customTask.command === undefined || customTask.command.name === undefined) && (customTask.configurationProperties.dependsOn === undefined || customTask.configurationProperties.dependsOn.length === 0)) {
|
|
1178
|
+
context.problemReporter.error(( nls.localizeWithPath(
|
|
1179
|
+
'vs/workbench/contrib/tasks/common/taskConfiguration',
|
|
1180
|
+
'taskConfiguration.noCommandOrDependsOn',
|
|
1181
|
+
'Error: the task \'{0}\' neither specifies a command nor a dependsOn property. The task will be ignored. Its definition is:\n{1}',
|
|
1182
|
+
customTask.configurationProperties.name,
|
|
1183
|
+
JSON.stringify(external, undefined, 4)
|
|
1184
|
+
)));
|
|
1185
|
+
continue;
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
else {
|
|
1189
|
+
if (customTask.command === undefined || customTask.command.name === undefined) {
|
|
1190
|
+
context.problemReporter.warn(( nls.localizeWithPath(
|
|
1191
|
+
'vs/workbench/contrib/tasks/common/taskConfiguration',
|
|
1192
|
+
'taskConfiguration.noCommand',
|
|
1193
|
+
'Error: the task \'{0}\' doesn\'t define a command. The task will be ignored. Its definition is:\n{1}',
|
|
1194
|
+
customTask.configurationProperties.name,
|
|
1195
|
+
JSON.stringify(external, undefined, 4)
|
|
1196
|
+
)));
|
|
1197
|
+
continue;
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
if (customTask.configurationProperties.group === TaskGroup.Build && defaultBuildTask.rank < 2) {
|
|
1201
|
+
defaultBuildTask.task = customTask;
|
|
1202
|
+
defaultBuildTask.rank = 2;
|
|
1203
|
+
}
|
|
1204
|
+
else if (customTask.configurationProperties.group === TaskGroup.Test && defaultTestTask.rank < 2) {
|
|
1205
|
+
defaultTestTask.task = customTask;
|
|
1206
|
+
defaultTestTask.rank = 2;
|
|
1207
|
+
}
|
|
1208
|
+
else if (customTask.configurationProperties.name === 'build' && defaultBuildTask.rank < 1) {
|
|
1209
|
+
defaultBuildTask.task = customTask;
|
|
1210
|
+
defaultBuildTask.rank = 1;
|
|
1211
|
+
}
|
|
1212
|
+
else if (customTask.configurationProperties.name === 'test' && defaultTestTask.rank < 1) {
|
|
1213
|
+
defaultTestTask.task = customTask;
|
|
1214
|
+
defaultTestTask.rank = 1;
|
|
1215
|
+
}
|
|
1216
|
+
customTask.addTaskLoadMessages(context.taskLoadIssues);
|
|
1217
|
+
result.custom.push(customTask);
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
else {
|
|
1221
|
+
const configuredTask = ConfiguringTask.from(external, context, index, source, registry);
|
|
1222
|
+
if (configuredTask) {
|
|
1223
|
+
configuredTask.addTaskLoadMessages(context.taskLoadIssues);
|
|
1224
|
+
result.configured.push(configuredTask);
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
context.taskLoadIssues = Objects.deepClone(baseLoadIssues);
|
|
1228
|
+
}
|
|
1229
|
+
const defaultBuildGroupName = Types.isString(defaultBuildTask.task?.configurationProperties.group) ? defaultBuildTask.task?.configurationProperties.group : defaultBuildTask.task?.configurationProperties.group?._id;
|
|
1230
|
+
const defaultTestTaskGroupName = Types.isString(defaultTestTask.task?.configurationProperties.group) ? defaultTestTask.task?.configurationProperties.group : defaultTestTask.task?.configurationProperties.group?._id;
|
|
1231
|
+
if ((defaultBuildGroupName !== TaskGroup.Build._id) && (defaultBuildTask.rank > -1) && (defaultBuildTask.rank < 2) && defaultBuildTask.task) {
|
|
1232
|
+
defaultBuildTask.task.configurationProperties.group = TaskGroup.Build;
|
|
1233
|
+
}
|
|
1234
|
+
else if ((defaultTestTaskGroupName !== TaskGroup.Test._id) && (defaultTestTask.rank > -1) && (defaultTestTask.rank < 2) && defaultTestTask.task) {
|
|
1235
|
+
defaultTestTask.task.configurationProperties.group = TaskGroup.Test;
|
|
1236
|
+
}
|
|
1237
|
+
return result;
|
|
1238
|
+
}
|
|
1239
|
+
TaskParser.from = from;
|
|
1240
|
+
function assignTasks(target, source) {
|
|
1241
|
+
if (source === undefined || source.length === 0) {
|
|
1242
|
+
return target;
|
|
1243
|
+
}
|
|
1244
|
+
if (target === undefined || target.length === 0) {
|
|
1245
|
+
return source;
|
|
1246
|
+
}
|
|
1247
|
+
if (source) {
|
|
1248
|
+
const map = Object.create(null);
|
|
1249
|
+
target.forEach((task) => {
|
|
1250
|
+
map[task.configurationProperties.name] = task;
|
|
1251
|
+
});
|
|
1252
|
+
source.forEach((task) => {
|
|
1253
|
+
map[task.configurationProperties.name] = task;
|
|
1254
|
+
});
|
|
1255
|
+
const newTarget = [];
|
|
1256
|
+
target.forEach(task => {
|
|
1257
|
+
newTarget.push(map[task.configurationProperties.name]);
|
|
1258
|
+
delete map[task.configurationProperties.name];
|
|
1259
|
+
});
|
|
1260
|
+
( Object.keys(map)).forEach(key => newTarget.push(map[key]));
|
|
1261
|
+
target = newTarget;
|
|
1262
|
+
}
|
|
1263
|
+
return target;
|
|
1264
|
+
}
|
|
1265
|
+
TaskParser.assignTasks = assignTasks;
|
|
1266
|
+
})(TaskParser || (TaskParser = {})));
|
|
1267
|
+
var Globals;
|
|
1268
|
+
( (function(Globals) {
|
|
1269
|
+
function from(config, context) {
|
|
1270
|
+
let result = fromBase(config, context);
|
|
1271
|
+
let osGlobals = undefined;
|
|
1272
|
+
if (config.windows && context.platform === 3 ) {
|
|
1273
|
+
osGlobals = fromBase(config.windows, context);
|
|
1274
|
+
}
|
|
1275
|
+
else if (config.osx && context.platform === 1 ) {
|
|
1276
|
+
osGlobals = fromBase(config.osx, context);
|
|
1277
|
+
}
|
|
1278
|
+
else if (config.linux && context.platform === 2 ) {
|
|
1279
|
+
osGlobals = fromBase(config.linux, context);
|
|
1280
|
+
}
|
|
1281
|
+
if (osGlobals) {
|
|
1282
|
+
result = Globals.assignProperties(result, osGlobals);
|
|
1283
|
+
}
|
|
1284
|
+
const command = CommandConfiguration.from(config, context);
|
|
1285
|
+
if (command) {
|
|
1286
|
+
result.command = command;
|
|
1287
|
+
}
|
|
1288
|
+
Globals.fillDefaults(result, context);
|
|
1289
|
+
Globals.freeze(result);
|
|
1290
|
+
return result;
|
|
1291
|
+
}
|
|
1292
|
+
Globals.from = from;
|
|
1293
|
+
function fromBase(config, context) {
|
|
1294
|
+
const result = {};
|
|
1295
|
+
if (config.suppressTaskName !== undefined) {
|
|
1296
|
+
result.suppressTaskName = !!config.suppressTaskName;
|
|
1297
|
+
}
|
|
1298
|
+
if (config.promptOnClose !== undefined) {
|
|
1299
|
+
result.promptOnClose = !!config.promptOnClose;
|
|
1300
|
+
}
|
|
1301
|
+
if (config.problemMatcher) {
|
|
1302
|
+
result.problemMatcher = ProblemMatcherConverter.from(config.problemMatcher, context).value;
|
|
1303
|
+
}
|
|
1304
|
+
return result;
|
|
1305
|
+
}
|
|
1306
|
+
Globals.fromBase = fromBase;
|
|
1307
|
+
function isEmpty(value) {
|
|
1308
|
+
return !value || value.command === undefined && value.promptOnClose === undefined && value.suppressTaskName === undefined;
|
|
1309
|
+
}
|
|
1310
|
+
Globals.isEmpty = isEmpty;
|
|
1311
|
+
function assignProperties(target, source) {
|
|
1312
|
+
if (isEmpty(source)) {
|
|
1313
|
+
return target;
|
|
1314
|
+
}
|
|
1315
|
+
if (isEmpty(target)) {
|
|
1316
|
+
return source;
|
|
1317
|
+
}
|
|
1318
|
+
assignProperty(target, source, 'promptOnClose');
|
|
1319
|
+
assignProperty(target, source, 'suppressTaskName');
|
|
1320
|
+
return target;
|
|
1321
|
+
}
|
|
1322
|
+
Globals.assignProperties = assignProperties;
|
|
1323
|
+
function fillDefaults(value, context) {
|
|
1324
|
+
if (!value) {
|
|
1325
|
+
return;
|
|
1326
|
+
}
|
|
1327
|
+
CommandConfiguration.fillDefaults(value.command, context);
|
|
1328
|
+
if (value.suppressTaskName === undefined) {
|
|
1329
|
+
value.suppressTaskName = ((context.schemaVersion === 2) );
|
|
1330
|
+
}
|
|
1331
|
+
if (value.promptOnClose === undefined) {
|
|
1332
|
+
value.promptOnClose = true;
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1335
|
+
Globals.fillDefaults = fillDefaults;
|
|
1336
|
+
function freeze(value) {
|
|
1337
|
+
if (value.command) {
|
|
1338
|
+
CommandConfiguration.freeze(value.command);
|
|
1339
|
+
}
|
|
1340
|
+
}
|
|
1341
|
+
Globals.freeze = freeze;
|
|
1342
|
+
})(Globals || (Globals = {})));
|
|
1343
|
+
var ExecutionEngine;
|
|
1344
|
+
( (function(ExecutionEngine) {
|
|
1345
|
+
function from(config) {
|
|
1346
|
+
const runner = config.runner || config._runner;
|
|
1347
|
+
let result;
|
|
1348
|
+
if (runner) {
|
|
1349
|
+
switch (runner) {
|
|
1350
|
+
case 'terminal':
|
|
1351
|
+
result = ExecutionEngine$1.Terminal;
|
|
1352
|
+
break;
|
|
1353
|
+
case 'process':
|
|
1354
|
+
result = ExecutionEngine$1.Process;
|
|
1355
|
+
break;
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
const schemaVersion = JsonSchemaVersion.from(config);
|
|
1359
|
+
if (schemaVersion === 1 ) {
|
|
1360
|
+
return result || ExecutionEngine$1.Process;
|
|
1361
|
+
}
|
|
1362
|
+
else if (schemaVersion === 2 ) {
|
|
1363
|
+
return ExecutionEngine$1.Terminal;
|
|
1364
|
+
}
|
|
1365
|
+
else {
|
|
1366
|
+
throw new Error('Shouldn\'t happen.');
|
|
1367
|
+
}
|
|
1368
|
+
}
|
|
1369
|
+
ExecutionEngine.from = from;
|
|
1370
|
+
})(ExecutionEngine || (ExecutionEngine = {})));
|
|
1371
|
+
var JsonSchemaVersion;
|
|
1372
|
+
( (function(JsonSchemaVersion) {
|
|
1373
|
+
const _default = 2 ;
|
|
1374
|
+
function from(config) {
|
|
1375
|
+
const version = config.version;
|
|
1376
|
+
if (!version) {
|
|
1377
|
+
return _default;
|
|
1378
|
+
}
|
|
1379
|
+
switch (version) {
|
|
1380
|
+
case '0.1.0':
|
|
1381
|
+
return 1 ;
|
|
1382
|
+
case '2.0.0':
|
|
1383
|
+
return 2 ;
|
|
1384
|
+
default:
|
|
1385
|
+
return _default;
|
|
1386
|
+
}
|
|
1387
|
+
}
|
|
1388
|
+
JsonSchemaVersion.from = from;
|
|
1389
|
+
})(JsonSchemaVersion || (JsonSchemaVersion = {})));
|
|
1390
|
+
class UUIDMap {
|
|
1391
|
+
constructor(other) {
|
|
1392
|
+
this.current = Object.create(null);
|
|
1393
|
+
if (other) {
|
|
1394
|
+
for (const key of ( Object.keys(other.current))) {
|
|
1395
|
+
const value = other.current[key];
|
|
1396
|
+
if (Array.isArray(value)) {
|
|
1397
|
+
this.current[key] = value.slice();
|
|
1398
|
+
}
|
|
1399
|
+
else {
|
|
1400
|
+
this.current[key] = value;
|
|
1401
|
+
}
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
start() {
|
|
1406
|
+
this.last = this.current;
|
|
1407
|
+
this.current = Object.create(null);
|
|
1408
|
+
}
|
|
1409
|
+
getUUID(identifier) {
|
|
1410
|
+
const lastValue = this.last ? this.last[identifier] : undefined;
|
|
1411
|
+
let result = undefined;
|
|
1412
|
+
if (lastValue !== undefined) {
|
|
1413
|
+
if (Array.isArray(lastValue)) {
|
|
1414
|
+
result = lastValue.shift();
|
|
1415
|
+
if (lastValue.length === 0) {
|
|
1416
|
+
delete this.last[identifier];
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1419
|
+
else {
|
|
1420
|
+
result = lastValue;
|
|
1421
|
+
delete this.last[identifier];
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
if (result === undefined) {
|
|
1425
|
+
result = UUID.generateUuid();
|
|
1426
|
+
}
|
|
1427
|
+
const currentValue = this.current[identifier];
|
|
1428
|
+
if (currentValue === undefined) {
|
|
1429
|
+
this.current[identifier] = result;
|
|
1430
|
+
}
|
|
1431
|
+
else {
|
|
1432
|
+
if (Array.isArray(currentValue)) {
|
|
1433
|
+
currentValue.push(result);
|
|
1434
|
+
}
|
|
1435
|
+
else {
|
|
1436
|
+
const arrayValue = [currentValue];
|
|
1437
|
+
arrayValue.push(result);
|
|
1438
|
+
this.current[identifier] = arrayValue;
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
return result;
|
|
1442
|
+
}
|
|
1443
|
+
finish() {
|
|
1444
|
+
this.last = undefined;
|
|
1445
|
+
}
|
|
1446
|
+
}
|
|
1447
|
+
var TaskConfigSource;
|
|
1448
|
+
( (function(TaskConfigSource) {
|
|
1449
|
+
TaskConfigSource[TaskConfigSource["TasksJson"] = 0] = "TasksJson";
|
|
1450
|
+
TaskConfigSource[TaskConfigSource["WorkspaceFile"] = 1] = "WorkspaceFile";
|
|
1451
|
+
TaskConfigSource[TaskConfigSource["User"] = 2] = "User";
|
|
1452
|
+
})(TaskConfigSource || (TaskConfigSource = {})));
|
|
1453
|
+
class ConfigurationParser {
|
|
1454
|
+
constructor(workspaceFolder, workspace, platform, problemReporter, uuidMap) {
|
|
1455
|
+
this.workspaceFolder = workspaceFolder;
|
|
1456
|
+
this.workspace = workspace;
|
|
1457
|
+
this.platform = platform;
|
|
1458
|
+
this.problemReporter = problemReporter;
|
|
1459
|
+
this.uuidMap = uuidMap;
|
|
1460
|
+
}
|
|
1461
|
+
run(fileConfig, source, contextKeyService) {
|
|
1462
|
+
const engine = ExecutionEngine.from(fileConfig);
|
|
1463
|
+
const schemaVersion = JsonSchemaVersion.from(fileConfig);
|
|
1464
|
+
const context = {
|
|
1465
|
+
workspaceFolder: this.workspaceFolder,
|
|
1466
|
+
workspace: this.workspace,
|
|
1467
|
+
problemReporter: this.problemReporter,
|
|
1468
|
+
uuidMap: this.uuidMap,
|
|
1469
|
+
namedProblemMatchers: {},
|
|
1470
|
+
engine,
|
|
1471
|
+
schemaVersion,
|
|
1472
|
+
platform: this.platform,
|
|
1473
|
+
taskLoadIssues: [],
|
|
1474
|
+
contextKeyService
|
|
1475
|
+
};
|
|
1476
|
+
const taskParseResult = this.createTaskRunnerConfiguration(fileConfig, context, source);
|
|
1477
|
+
return {
|
|
1478
|
+
validationStatus: this.problemReporter.status,
|
|
1479
|
+
custom: taskParseResult.custom,
|
|
1480
|
+
configured: taskParseResult.configured,
|
|
1481
|
+
engine
|
|
1482
|
+
};
|
|
1483
|
+
}
|
|
1484
|
+
createTaskRunnerConfiguration(fileConfig, context, source) {
|
|
1485
|
+
const globals = Globals.from(fileConfig, context);
|
|
1486
|
+
if (this.problemReporter.status.isFatal()) {
|
|
1487
|
+
return { custom: [], configured: [] };
|
|
1488
|
+
}
|
|
1489
|
+
context.namedProblemMatchers = ProblemMatcherConverter.namedFrom(fileConfig.declares, context);
|
|
1490
|
+
let globalTasks = undefined;
|
|
1491
|
+
let externalGlobalTasks = undefined;
|
|
1492
|
+
if (fileConfig.windows && context.platform === 3 ) {
|
|
1493
|
+
globalTasks = TaskParser.from(fileConfig.windows.tasks, globals, context, source).custom;
|
|
1494
|
+
externalGlobalTasks = fileConfig.windows.tasks;
|
|
1495
|
+
}
|
|
1496
|
+
else if (fileConfig.osx && context.platform === 1 ) {
|
|
1497
|
+
globalTasks = TaskParser.from(fileConfig.osx.tasks, globals, context, source).custom;
|
|
1498
|
+
externalGlobalTasks = fileConfig.osx.tasks;
|
|
1499
|
+
}
|
|
1500
|
+
else if (fileConfig.linux && context.platform === 2 ) {
|
|
1501
|
+
globalTasks = TaskParser.from(fileConfig.linux.tasks, globals, context, source).custom;
|
|
1502
|
+
externalGlobalTasks = fileConfig.linux.tasks;
|
|
1503
|
+
}
|
|
1504
|
+
if (context.schemaVersion === 2 && globalTasks && globalTasks.length > 0 && externalGlobalTasks && externalGlobalTasks.length > 0) {
|
|
1505
|
+
const taskContent = [];
|
|
1506
|
+
for (const task of externalGlobalTasks) {
|
|
1507
|
+
taskContent.push(JSON.stringify(task, null, 4));
|
|
1508
|
+
}
|
|
1509
|
+
context.problemReporter.error(( nls.localizeWithPath(
|
|
1510
|
+
'vs/workbench/contrib/tasks/common/taskConfiguration',
|
|
1511
|
+
{ key: 'TaskParse.noOsSpecificGlobalTasks', comment: ['\"Task version 2.0.0\" refers to the 2.0.0 version of the task system. The \"version 2.0.0\" is not localizable as it is a json key and value.'] },
|
|
1512
|
+
'Task version 2.0.0 doesn\'t support global OS specific tasks. Convert them to a task with a OS specific command. Affected tasks are:\n{0}',
|
|
1513
|
+
taskContent.join('\n')
|
|
1514
|
+
)));
|
|
1515
|
+
}
|
|
1516
|
+
let result = { custom: [], configured: [] };
|
|
1517
|
+
if (fileConfig.tasks) {
|
|
1518
|
+
result = TaskParser.from(fileConfig.tasks, globals, context, source);
|
|
1519
|
+
}
|
|
1520
|
+
if (globalTasks) {
|
|
1521
|
+
result.custom = TaskParser.assignTasks(result.custom, globalTasks);
|
|
1522
|
+
}
|
|
1523
|
+
if ((!result.custom || result.custom.length === 0) && (globals.command && globals.command.name)) {
|
|
1524
|
+
const matchers = ProblemMatcherConverter.from(fileConfig.problemMatcher, context).value ?? [];
|
|
1525
|
+
const isBackground = fileConfig.isBackground ? !!fileConfig.isBackground : fileConfig.isWatching ? !!fileConfig.isWatching : undefined;
|
|
1526
|
+
const name = CommandString.value(globals.command.name);
|
|
1527
|
+
const task = new CustomTask$1(context.uuidMap.getUUID(name), Object.assign({}, source, { config: { index: -1, element: fileConfig, workspaceFolder: context.workspaceFolder } }), name, CUSTOMIZED_TASK_TYPE, {
|
|
1528
|
+
name: undefined,
|
|
1529
|
+
runtime: undefined,
|
|
1530
|
+
presentation: undefined,
|
|
1531
|
+
suppressTaskName: true
|
|
1532
|
+
}, false, { reevaluateOnRerun: true }, {
|
|
1533
|
+
name: name,
|
|
1534
|
+
identifier: name,
|
|
1535
|
+
group: TaskGroup.Build,
|
|
1536
|
+
isBackground: isBackground,
|
|
1537
|
+
problemMatchers: matchers
|
|
1538
|
+
});
|
|
1539
|
+
const taskGroupKind = GroupKind.from(fileConfig.group);
|
|
1540
|
+
if (taskGroupKind !== undefined) {
|
|
1541
|
+
task.configurationProperties.group = taskGroupKind;
|
|
1542
|
+
}
|
|
1543
|
+
else if (fileConfig.group === 'none') {
|
|
1544
|
+
task.configurationProperties.group = undefined;
|
|
1545
|
+
}
|
|
1546
|
+
CustomTask.fillGlobals(task, globals);
|
|
1547
|
+
CustomTask.fillDefaults(task, context);
|
|
1548
|
+
result.custom = [task];
|
|
1549
|
+
}
|
|
1550
|
+
result.custom = result.custom || [];
|
|
1551
|
+
result.configured = result.configured || [];
|
|
1552
|
+
return result;
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1555
|
+
const uuidMaps = ( new Map());
|
|
1556
|
+
const recentUuidMaps = ( new Map());
|
|
1557
|
+
function parse(workspaceFolder, workspace, platform, configuration, logger, source, contextKeyService, isRecents = false) {
|
|
1558
|
+
const recentOrOtherMaps = isRecents ? recentUuidMaps : uuidMaps;
|
|
1559
|
+
let selectedUuidMaps = recentOrOtherMaps.get(source);
|
|
1560
|
+
if (!selectedUuidMaps) {
|
|
1561
|
+
recentOrOtherMaps.set(source, ( new Map()));
|
|
1562
|
+
selectedUuidMaps = recentOrOtherMaps.get(source);
|
|
1563
|
+
}
|
|
1564
|
+
let uuidMap = selectedUuidMaps.get(( workspaceFolder.uri.toString()));
|
|
1565
|
+
if (!uuidMap) {
|
|
1566
|
+
uuidMap = ( new UUIDMap());
|
|
1567
|
+
selectedUuidMaps.set(( workspaceFolder.uri.toString()), uuidMap);
|
|
1568
|
+
}
|
|
1569
|
+
try {
|
|
1570
|
+
uuidMap.start();
|
|
1571
|
+
return (( new ConfigurationParser(workspaceFolder, workspace, platform, logger, uuidMap))).run(configuration, source, contextKeyService);
|
|
1572
|
+
}
|
|
1573
|
+
finally {
|
|
1574
|
+
uuidMap.finish();
|
|
1575
|
+
}
|
|
1576
|
+
}
|
|
1577
|
+
function createCustomTask(contributedTask, configuredProps) {
|
|
1578
|
+
return CustomTask.createCustomTask(contributedTask, configuredProps);
|
|
1579
|
+
}
|
|
1580
|
+
|
|
1581
|
+
export { ExecutionEngine, GroupKind, ITaskIdentifier, JsonSchemaVersion, ProblemMatcherConverter, RunOnOptions, RunOptions, TaskConfigSource, TaskParser, UUIDMap, createCustomTask, parse };
|