【发布时间】:2020-10-07 08:38:48
【问题描述】:
我需要记录项目的构建时间以找出 VSCode 中的平均构建时间。 例如,这就是它在 Xcode 中的实现方式https://github.com/timroesner/BuildTimes。 我已经在launch.json中尝试过“preLaunchTask”、“postDebugTask”,但这并不是我所需要的。
【问题讨论】:
标签: visual-studio-code vscode-tasks
我需要记录项目的构建时间以找出 VSCode 中的平均构建时间。 例如,这就是它在 Xcode 中的实现方式https://github.com/timroesner/BuildTimes。 我已经在launch.json中尝试过“preLaunchTask”、“postDebugTask”,但这并不是我所需要的。
【问题讨论】:
标签: visual-studio-code vscode-tasks
您可以使用Compound tasks。
要执行的任务是:
{
"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
【讨论】: