Configuring a dependent task in vscode

I have the nrfConnect task that builds my project in vscode.

I need to add a script to execute before the nrfConnect task.

I added a task to my tasks.json but the task that I need to execute before the nrfConnect build, does not execute;;

I even replaced the script with a simple echo command and it still does not execute - I do not see the string "I AM A SUBTASK" in the terminal output

My tasks.json script below

What am I missing?

Thanks

Andy

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "subtask1",
            "type": "shell",
            "command": "echo I AM A SUBTASK"
        },
        {
            "type": "nrf-connect-build",
            "config": "${workspaceFolder}/build",
            "runCmake": false,
            "problemMatcher": [
                "$gcc",
                "$cmake",
                "$kconfig",
                "$kconfig_syntax",
                "$kconfig_syntax_files",
                "$dts",
                "$dts_syntax"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "label": "nRF Connect: Build myproject/build (active-debug)",
            "dependsOn": [
                "subtask1"
            ],

        }
    ]
}

Parents
  • I can execute my "subtask1" task by selecting "terminal->run build task" but not together with the nrf-connect build task

    I set the default task to be subtask1" .But when I select " build" or "pristine build" vscode still bypasses "subtask1" and executes the nrf-connect" build task. How can I make them run one after another - first "subtask1" THEN "nrf-connect-build" task??
    Everything is so complicated in vscode even the simplest things. Very frustrating

Reply
  • I can execute my "subtask1" task by selecting "terminal->run build task" but not together with the nrf-connect build task

    I set the default task to be subtask1" .But when I select " build" or "pristine build" vscode still bypasses "subtask1" and executes the nrf-connect" build task. How can I make them run one after another - first "subtask1" THEN "nrf-connect-build" task??
    Everything is so complicated in vscode even the simplest things. Very frustrating

Children
  • Hi,

    I have made my own test on this and I can see "I AM A SUBTASK" in the VS Code Terminal.
    You need to add the following line <"dependsOrder": "sequence",>. You can put this line just before "dependsOn" line.

    Best regards,
    Dejan