FR: Include git commit hash in ProjectInfo::versionString

It’s very useful to include a commit hash of the current build of a project when you release it.

It is possible to extract the current hash from git via the following command in a shell script:

VERSION_NUM=`git log -1 --pretty=oneline --abbrev-commit|sed s/\ .*//`

It would be really useful to add this information to the ProjectInfo namespace whenever you click the Save and Open in IDE button.

A method of accomplishing this might be as follows:

  • ProJucer looks for a git repository in the same directory as the .jucer file
  • if a git repo is found:
  • Projucer launches a ChildProcess.
  • The child process runs git log -1 --pretty=oneline --abbrev-commit|sed s/\ .*//
  • the output of the child process is captured and JuceHeader.h is written and includes this hash value as a new field
namespace ProjectInfo
{
    const char* const  projectName    = "Encryptor";
    const char* const  companyName    = "";
    const char* const  versionString  = "1.0.0";
    const int          versionNumber  = 0x10000;
    const char* const  commitHash     = "abcd1234";
};