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 Reply Children
  • Hi,

    This is how I did it. I built asset_tracker_v2 example. One small difference from your tasks.json is that I have entered the full path to the build folder in the "config" section.

    {
        "version": "2.0.0",
        "tasks": [
            {
                "label": "subtask1",
                "type": "shell",
                "command": "echo I AM A SUBTASK"
            },
            {
                "type": "nrf-connect-build",
                "config": "c:\\path_to_the_project\\asset_tracker_v2\\build",
                "runCmake": false,
                "problemMatcher": [
                    "$gcc",
                    "$cmake",
                    "$kconfig",
                    "$kconfig_syntax",
                    "$kconfig_syntax_files",
                    "$dts",
                    "$dts_syntax"
                ],
                "group": "build",
                "label": "nRF Connect: Build asset_tracker_v2/build (active)",
                "dependsOrder": "sequence",
                "dependsOn": [
                    "subtask1"
                ],
            }
        ]
    }
    
    


    Best regards,
    Dejan

Related