first post, please be gentle…
When building, I need to include the git HEAD’s commit hash into a header, so I can have the program print out its version/commit (and whether the tree was dirty or not) on startup. For C++/CMAKE projects, I use GetGitRevisionDescription.cmake. Is there something like this in platformio?
I was thinking to use “extra_scripts = pre:custom.py” and have that append the output of “git rev-parse HEAD” to a file that already contains "#define GIT_SHA1 ". That would work, right?
And then I thought it’d be nice to put this magic into a library, so that I can just include e.g. the version.h from that library and re-use that in multiple projects.
And then it seems like this probably has been done before, or maybe even is a standard feature in platformio that haven’t found yet?
What’s the best way of doing this?