Git User Group

Showing results for 
Search instead for 
Did you mean: 

Git Version ID's and Labview w/Sample Application with Pre Build.

It would be nice to be able to include the Git ID information in the built LabVIEW appliction.

The Project build specs provides a way to do some action prior to the build. A so called "Pre-Build"  can be used to get the Git ID information.

A shell script can be run, here is an example that I used for an mplab project.

echo "#define BUILDNUMBER_STR  " > gitbuild.h

"c:/Program Files (x86)"/Git/bin/git describe --tags >> gitbuild.h

echo -e "\r\n// End of File" >> gitbuild.h

The important features:

1. Create the C define in a .h file.

2. Use the GIT describe command with --tags to get the git ID with tag number, commit number and part of the hash code associated with the tag.

Example:   V1x6Final-1-g3fbdc98 

(Tag, Commit #, Hash code --- V1x6Final, 1, g3fbdc98)

For Labview just the string from the "git describe --tags" is needed. The Pre-Build, can be used to read up the string.

Frankly, I would be inclined to nest a to be called by Pre-Build and put all the code to do the shell script and read the result string in it.

This blog post has resulted in a project with  a sample VI. The zip file contains all the materials to pre build a git id, to save it and have it for use. It is tested under LabVIEW 2012 only. Tests on 2010 failed.

0 Kudos
Message 1 of 1