问题描述
我需要记录项目的构建时间,以在VSCode中找出平均构建时间。 例如,这就是可以在Xcode https://github.com/timroesner/BuildTimes中实现的方式。 我已经在launch.json中尝试过“ prelaunchTask”,“ postDebugTask”,但这并不是我真正需要的。
解决方法
您可以使用Compound tasks。
要执行的任务是:
- 记录开始
- 构建
- 记录结束
{
"version": "2.0.0","tasks": [
{
"label": "Start Build","type": "shell","command": "BuildTimes -start",},{
"label": "End Build","command": "BuildTimes -end",{
"label": "List BuildTime","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