Clicking the Build button rebuilds EVERYTHING in VS Code

When I click the build button in VS Code, it rebuilds the entire project and takes quite a while (a few minutes). This is extremely inefficient when I am making small changes to a couple files and want to iterate builds and testing quickly.

Is there a way to get the build button to just rebuild changed files with the west setup?

On a related note, can I disable building before flashing? When I flash, it also rebuilds everything, but when I debug it does not. Ideally, it would only build when I click build and not when I click flash.

Thanks for the support!

Jon

Parents
  • If you change any build configs you will have to rebuild your build system and re-compile your project. 

    You can change the task behaviour of buttons and hotkeys in VS code however you like, see https://code.visualstudio.com/docs/editor/tasks. This applies to both the 'build' and 'flash' buttons in our VS code extension.

    Also, make sure you exclude the SDK from anti-virus tracking, windows's Antimalware Service is especially trigger happy with Zephyr's build system. And Linux builds in almost half the time compared to Windows.

  • That makes sense if I change and build configs, but if I click build, then click it again a second time after it is done it will run through the whole build again and rebuild all the source files, including Zephyr. Does it not do the same for your builds?

    I'll look into that link to configure the tasks.

  • If you hover your mouse over the build button in the Actions pane, what does the contextual info box say?

    Here's mine for reference:

    Also, here's a log where I rebuild a project without any changes:

    * Executing task: nRF Connect: Build: peripheral_hr/build (active)

    Building peripheral_hr
    C:\WINDOWS\system32\cmd.exe /d /s /c "west build --build-dir c:/Users/****/ncs/v2.4.0/zephyr/samples/bluetooth/peripheral_hr/build c:/Users/****/ncs/v2.4.0/zephyr/samples/bluetooth/peripheral_hr"

    ninja: no work to do.
    * Terminal will be reused by tasks, press any key to close it.

Reply
  • If you hover your mouse over the build button in the Actions pane, what does the contextual info box say?

    Here's mine for reference:

    Also, here's a log where I rebuild a project without any changes:

    * Executing task: nRF Connect: Build: peripheral_hr/build (active)

    Building peripheral_hr
    C:\WINDOWS\system32\cmd.exe /d /s /c "west build --build-dir c:/Users/****/ncs/v2.4.0/zephyr/samples/bluetooth/peripheral_hr/build c:/Users/****/ncs/v2.4.0/zephyr/samples/bluetooth/peripheral_hr"

    ninja: no work to do.
    * Terminal will be reused by tasks, press any key to close it.

Children
Related