damogranlabs / VS-Code-STM32-IDE

Use VS Code as STM32 IDE with CubeMX
MIT License
247 stars 52 forks source link

Build before download & run task #3

Closed ali80 closed 5 years ago

ali80 commented 5 years ago

If the project is changed, there is no point in downloading the old files to the MCU, so I think there should be an automatic build before download and run if any change is detected. this can be done by adding this to the download and run task in tasks.json file:

"dependsOn":["Build project"]

the same is true for debugging so this should be added to the launch.json file:

"preLaunchTask": "Build project"
schperplata commented 5 years ago

I agree for debug launch configuration, added build dependancy task in the latest commit.

CPU: Download and run task will remain the same. The reason it is configured that way (eg. without previously executed build task) is that you can download some executable file just by manually copying it to the build folder and run task. That way IDE is more versatile, but demands more caution from the user. Download and run task should do only those two things: download and run.

Anyway, you are right, much more common use case is downloading the latest code. I added another CPU: Build, download and run task.

I also updated comments and simplified task creation functions. Note that task creator will not overwrite user tasks (if json file is valid), so update workspace task is safe to use.

ali80 commented 5 years ago

Maybe it would be appropriate to also make the build task the default task although its easy for the user to do so.