By default, for a c++ project, “WPILib Build” in VSCode builds the project six times: Athena debug/release, simulation debug/release, and test debug/release. Even when deploying, it still builds the code for both debug and release. Besides being slow, it’s annoying to see the same compiler errors repeated six times. Is there a way to only build the debug OR release build?
When deploying, Gradle will only build what it needs to. Are you certain that it is actually building both release and debug on deploy? You can run with ./gradlew deploy -Pdeploy-dry --console=plain
, which should give some insight into what tasks are being run
Well, that only starts compiling release, but it also terminates early as I’m not connected to a RIO. And the ordinary ./gradlew build
builds all six still.
This is still an issue in 2020. ./gradlew build
or WPILib: Build Robot Code from VSCode will build six times. Is there still no way to change this behavior?
Yes, this is as intended. Build should build everything. It should be incremental when only small changes occur, and then things like deploy still only build the single binary needed to deploy.
With some gradle knowledge it is possible to build just a single binary, but from the extension perspective we’re not sure which platform the user actually wants to build for at that point. So everything just gets built.
If you want to just build a single thing, you can call gradle manually, and pass it the task you want directly for a specific binary. That will cause only 1 build to occur.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.