首页 > 解决方案 > tasks.json 依赖于不等待完成

问题描述

我正在设置一个构建过程,其中包含已定义为第一步的 bash 脚本,以便在我的构建中使用 tasks.json。脚本必须按顺序运行,并且它们必须按顺序运行而不是并行运行,因为后续脚本依赖于先前脚本的输出。

设置"dependsOrder": "sequence"是确保脚本按顺序运行,但存在重叠,即在调用第一个脚本之前调用第二个脚本,依此类推;即:它们仍在并行运行。

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "label": "pageBuilder",
    "tasks": [
        {
            "label": "build",
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "dependsOrder": "sequence",
            "dependsOn": [
                "buildCorePages", "convertMarkdownToHtml", "buildArticles"
            ],
            "problemMatcher": "$gcc"
        },
        {
            "label": "convertMarkdownToHtml",
            "type": "shell",
            "command": "${workspaceRoot}\\build_scripts\\convertMarkdownToHtml.sh"
        },
        {
            "label": "buildCorePages",
            "type": "shell",
            "command": "${workspaceRoot}\\build_scripts\\buildCorePages.sh"
        },
        {
            "label": "buildArticles",
            "type": "shell",
            "command": "${workspaceRoot}\\build_scripts\\buildArticles.sh"
        }
    ]
}

如何强制等待脚本完成?

标签: vscode-tasks

解决方案


推荐阅读