STM32CubeIDE headless build delay before terminating

Viewed 514

I use the STM32CubeIDE headless build in an automated build pipeline. The build command itself is in the following form:

stm32cubeidec.exe --launcher.suppressErrors -nosplash -application org.eclipse.cdt.managedbuilder.core.headlessbuild -data <folder> -import <project> -build <project>/Release

This works well, but I noticed that the build itself takes around 15 seconds, but after that the command takes 1 to 2 minutes to exit. This is annoying since it makes the build process take much longer than necessary.

I tried to run the command directly from the command-line and time the running time on two different computers. The results were similar like this:

...
09:30:11 Build Finished. 0 errors, 0 warnings. (took 15s.99ms)

real    2m25.843s

The "Build finished" message is printed after about 20 seconds and at that time the output binaries have been generated, but the command just hangs for a couple of minutes. No error messages are displayed.

1 Answers

In the automated build process, each build starts in a clean environment. When repeating builds on the command-line I found that the delay was only observed for the first build if identical builds were repeated. Furthermore, a .metadata folder was generated in the "data" folder. Removing that folder before a build made the delay happen again. Thus the delay seems to be due to information being cached into the .metadata folder.

It turns out that there is an option -no-indexer with the vague description "Disable indexer". Applying this option eliminates the delay also for clean builds:

stm32cubeidec.exe --launcher.suppressErrors -nosplash -application org.eclipse.cdt.managedbuilder.core.headlessbuild -data <folder> -import <project> -build <project>/Release -no-indexer

Doing this reduced the typical total build time from 2-3 minutes to around 1 minute in my build pipeline.

Related