提交 fa6145fc 编写于 作者: D Dirk Baeumer

Fixes #29446: Issue a error if version 2.0.0 defines global OS specific tasks.

上级 7b90f16e
......@@ -245,9 +245,14 @@ definitions.commandConfiguration.properties.isShellCommand = Objects.deepClone(s
definitions.options.properties.shell = {
$ref: '#/definitions/shellConfiguration'
};
definitions.taskRunnerConfiguration.properties.isShellCommand = Objects.deepClone(shellCommand);
definitions.taskRunnerConfiguration.properties.type = Objects.deepClone(taskType);
definitions.taskRunnerConfiguration.properties.version = Objects.deepClone(version);
let osSpecificTaskRunnerConfiguration = Objects.deepClone(definitions.taskRunnerConfiguration);
delete osSpecificTaskRunnerConfiguration.properties.tasks;
osSpecificTaskRunnerConfiguration.additionalProperties = false;
definitions.osSpecificTaskRunnerConfiguration = osSpecificTaskRunnerConfiguration;
const schema: IJSONSchema = {
oneOf: [
......@@ -259,15 +264,15 @@ const schema: IJSONSchema = {
properties: {
version: Objects.deepClone(version),
windows: {
'$ref': '#/definitions/taskRunnerConfiguration',
'$ref': '#/definitions/osSpecificTaskRunnerConfiguration',
'description': nls.localize('JsonSchema.windows', 'Windows specific command configuration')
},
osx: {
'$ref': '#/definitions/taskRunnerConfiguration',
'$ref': '#/definitions/osSpecificTaskRunnerConfiguration',
'description': nls.localize('JsonSchema.mac', 'Mac specific command configuration')
},
linux: {
'$ref': '#/definitions/taskRunnerConfiguration',
'$ref': '#/definitions/osSpecificTaskRunnerConfiguration',
'description': nls.localize('JsonSchema.linux', 'Linux specific command configuration')
}
}
......
......@@ -1649,12 +1649,27 @@ class ConfigurationParser {
}
context.namedProblemMatchers = ProblemMatcherConverter.namedFrom(fileConfig.declares, context);
let globalTasks: Tasks.CustomTask[];
let externalGlobalTasks: (ConfiguringTask | CustomTask)[];
if (fileConfig.windows && Platform.platform === Platform.Platform.Windows) {
globalTasks = TaskParser.from(fileConfig.windows.tasks, globals, context).custom;
externalGlobalTasks = fileConfig.windows.tasks;
} else if (fileConfig.osx && Platform.platform === Platform.Platform.Mac) {
globalTasks = TaskParser.from(fileConfig.osx.tasks, globals, context).custom;
externalGlobalTasks = fileConfig.osx.tasks;
} else if (fileConfig.linux && Platform.platform === Platform.Platform.Linux) {
globalTasks = TaskParser.from(fileConfig.linux.tasks, globals, context).custom;
externalGlobalTasks = fileConfig.linux.tasks;
}
if (context.schemaVersion === Tasks.JsonSchemaVersion.V2_0_0 && globalTasks && globalTasks.length > 0 && externalGlobalTasks && externalGlobalTasks.length > 0) {
let taskContent: string[] = [];
for (let task of externalGlobalTasks) {
taskContent.push(JSON.stringify(task, null, 4));
}
context.problemReporter.error(
nls.localize(
'TaskParse.noOsSpecificGlobalTasks',
'Task version 2.0.0 doesn\'t support gloabl OS specific tasks. Convert them to a task with a OS specific command. Affected tasks are:\n{0}', taskContent.join('\n'))
);
}
let result: TaskParseResult = { custom: undefined, configured: undefined };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册