PlatformIO Community

Extra_scripts: run only once, only for true build of main program


I have attached two pre:extra_scripts. However, I have noticed, they are run 1 two 5 times for each “build” and also for “minor” actions, like building the filesystem buildfs or even just checking size.

My question would be, is there a way to limit execution of extra_scripts to just ONE time? Reason: I use it to generate some hashes and version numbers. And, more importantly, set PROGNAME + ESP8266_FS_IMAGE_NAME.

I have read into the topic of targets and can check, which targets are “run” (via BUILD_TARGETS python object). However, for a “plain build” run, this object is empty and the script is nevertheless called a few time, which of course is undesired, as hash values change between runs and firmware image is generated not in the last run.

Any idea, where to start?

It seems, that COMMAND_LINE_TARGETS list holds the target values, which satisfies our needs for now.