【问题标题】:Is there a way to track a build time in VSCode and record it to a text file有没有办法在 VSCode 中跟踪构建时间并将其记录到文本文件中
【发布时间】:2020-10-07 08:38:48
【问题描述】:

我需要记录项目的构建时间以找出 VSCode 中的平均构建时间。 例如,这就是它在 Xcode 中的实现方式https://github.com/timroesner/BuildTimes。 我已经在launch.json中尝试过“preLaunchTask”、“postDebugTask”,但这并不是我所需要的。

【问题讨论】:

    标签: visual-studio-code vscode-tasks


    【解决方案1】:

    您可以使用Compound tasks

    要执行的任务是:

    1. 记录开始
    2. 构建
    3. 录制结束
    {
      "version": "2.0.0",
      "tasks": [
        {
          "label": "Start Build",
          "type": "shell",
          "command": "BuildTimes -start",
        },
        {
          "label": "End Build",
          "type": "shell",
          "command": "BuildTimes -end",
        },
        {
          "label": "List BuildTime",
          "type": "shell",
          "command": "BuildTimes -list",
        },
        {
          "label": "Build",
          "command": "gulp",
          "args": ["build"],
          "options": {
            "cwd": "${workspaceFolder}/server"
          }
        },
        {
          "label": "Record Build Time",
          "dependsOrder": "sequence",
          "dependsOn": ["Start Build", "Build", "End Build"]
        }
      ]
    }
    

    Build 任务修改为您需要的。

    在您的 launch.json 中将 preLaunchTask 设置为 Record Build Time

    【讨论】:

    • 你好 rioV8,你的回复,我会试试的
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-02-27
    • 2015-05-21
    • 2021-08-12
    • 2011-10-16
    • 1970-01-01
    相关资源
    最近更新 更多