vscode: task extending another task / passing parameters

Viewed 298

starting position

A tasks.json that defines a working build task (currently the only one, defined as default and working fine, also triggered by [CTRL]+[SHIFT]+[B]).

It triggers an external command (batch/shell script) and passes some parameters. Excerpt:

        {
            "label": "sample task",
            "windows": {
                "command": "${workspaceFolder}\\procedures_win\\doStuff.bat"
            },
            "linux": {
                "command": "${workspaceFolder}/procedures/doStuff.sh"
            },
            "type": "shell",
            "args": [
                "fixedParm",
                "${fileBasename}"
            ]
        }

(the complete one is much longer, mainly because of the amount of entries in the problemMatcher, contains target specific environment settings, 100 lines+ ...)

goal

Create a second task "sample task (check-only)" that is completely identical but passes one extra argument to the script "check-only".

options?

Is it possible to "extend" the given task "overriding" only the args?

If not: Is it possible to have a task actually run (not depend on) another task and setting an environment parameter that may then be used by the original task as "${env:someValue}" (an will either result to the empty string or the requested "check-only")?

As a last resort one possibly could define 5 instead of the two tasks (1 nearly identical to the current one, but taking an input from an external command/file; 2+3 meta tasks depending on 4+5, 4+5 command that creates a file ${workspaceFolder}/.taskmode that contains either nothing or "check-only").

question

How does a working solution without installing extensions look like?

0 Answers
Related