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

Fixes #40905: Operating system specific args don't override args defined in the task

上级 7a629db3
......@@ -858,7 +858,7 @@ namespace CommandConfiguration {
osConfig = fromBase(config.linux, context);
}
if (osConfig) {
result = assignProperties(result, osConfig);
result = assignProperties(result, osConfig, context.schemaVersion === Tasks.JsonSchemaVersion.V2_0_0);
}
return isEmpty(result) ? undefined : result;
}
......@@ -929,7 +929,7 @@ namespace CommandConfiguration {
return _isEmpty(value, properties);
}
export function assignProperties(target: Tasks.CommandConfiguration, source: Tasks.CommandConfiguration): Tasks.CommandConfiguration {
export function assignProperties(target: Tasks.CommandConfiguration, source: Tasks.CommandConfiguration, overwriteArgs: boolean): Tasks.CommandConfiguration {
if (isEmpty(source)) {
return target;
}
......@@ -941,7 +941,7 @@ namespace CommandConfiguration {
assignProperty(target, source, 'taskSelector');
assignProperty(target, source, 'suppressTaskName');
if (source.args !== void 0) {
if (target.args === void 0) {
if (target.args === void 0 || overwriteArgs) {
target.args = source.args;
} else {
target.args = target.args.concat(source.args);
......
......@@ -1585,6 +1585,56 @@ suite('Tasks version 2.0.0', () => {
presentation().echo(true);
testConfiguration(external, builder);
});
test('Arg overwrite', () => {
let external: ExternalTaskRunnerConfiguration = {
version: '2.0.0',
tasks: [
{
label: 'echo',
type: 'shell',
command: 'echo',
args: [
'global'
],
windows: {
args: [
'windows'
]
},
linux: {
args: [
'linux'
]
},
osx: {
args: [
'osx'
]
}
}
]
};
let builder = new ConfiguationBuilder();
if (Platform.isWindows) {
builder.task('echo', 'echo').
command().suppressTaskName(true).args(['windows']).
runtime(Tasks.RuntimeType.Shell).
presentation().echo(true);
testConfiguration(external, builder);
} else if (Platform.isLinux) {
builder.task('echo', 'echo').
command().suppressTaskName(true).args(['linux']).
runtime(Tasks.RuntimeType.Shell).
presentation().echo(true);
testConfiguration(external, builder);
} else if (Platform.isMacintosh) {
builder.task('echo', 'echo').
command().suppressTaskName(true).args(['osx']).
runtime(Tasks.RuntimeType.Shell).
presentation().echo(true);
testConfiguration(external, builder);
}
});
});
suite('Bugs / regression tests', () => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册