VSCode 任务取决于 运行,任务本身不

VSCode tasks dependsOn being run, task itself not

我的 tasks.json 中有 2 个任务。第一个是 CMAKE,运行 正确。第二个是 make,这取决于 CMAKE 首先是 运行。当我使用选项 dependsOn cmake 和 运行 任务 make 时,它​​仅 运行s cmake 任务但之后没有 make 任务。

{
    "version": "2.0.0",
    "command": "sh",
    "args": [
        "-c"
    ],
    "presentation": {
        "echo": true,
        "reveal": "always",
        "focus": true,
        "panel": "new"
    },
    "tasks": [
        {
            "label": "cmake",
            "type": "shell",
            "options": {
                "cwd": "${workspaceRoot}/build"
            },
            "args": [
                "cmake -DCMAKE_BUILD_TYPE=Debug .."
            ]
        },
        {
            "label": "make",
            "type": "shell",
            "args": [
                "make -j8"
            ],
            "options": {
                "cwd": "${workspaceRoot}/build"
            },
            "dependsOn": [
                "cmake"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "problemMatcher": [
                "$gcc"
            ]
        }
    ]
}

执行的make任务的输出:

Executing task: sh -c 'cmake -DCMAKE_BUILD_TYPE=Debug ..' <

-- Configuring done
-- Generating done
-- Build files have been written to: /home/gertjan/multiply/build

Press any key to close the terminal.

这显然与我任务顶部的 sh -c 有关。我还更改了 args 以命令任务。我生成的 tasks.json 文件:

{
    "version": "2.0.0",
    "presentation": {
        "echo": true,
        "reveal": "always",
        "focus": true,
        "panel": "new"
    },
    "tasks": [
        {
            "label": "cmake",
            "type": "shell",
            "command": "cmake -DCMAKE_BUILD_TYPE=Debug ..",
            "options": {
                "cwd": "${workspaceRoot}/build"
            }
        },
        {
            "label": "make",
            "type": "shell",
            "options": {
                "cwd": "${workspaceRoot}/build"
            },
            "command": "make -j8",
            "dependsOn": [
                "cmake"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}