Skip to content

MS Visual Studio header generator for VERSIONINFO from git-describe during pre-build event.

Notifications You must be signed in to change notification settings

Thell/git-vs-versioninfo-gen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 

Repository files navigation

Git - Visual Studio VERSIONINFO Generator
=========================================

Overview
--------
This project uses an MS-DOS batch file to parse the output of git-describe and
generate a header to be included in a project's file version resource.  For
building from source without having git the script can use a version file or
embedded default value.

Usage
-----
This can be run from the command line.  It uses the following arguments:

	usage: [--help] ^| ^| [--test] ^| [--quiet] [--force] [CACHE PATH] [OUT FILE]

	When called without arguments version information writes to console.

	--help      - displays this output.

	--test      - run internal tests to demonstrate output with current settings.

	--quiet     - Supress console output.
	--force     - Ignore cached version information.
	CACHE PATH  - Path for non-tracked file to store git-describe version.
	OUT FILE    - Path to writable file that is included in the project's rc file.

	Version information is expected to be in the format: vMajor.Minor.Fix[-stage#]
	Where -stage# is alpha, beta, or rc. ( example: v1.0.0-alpha0 )

	Example pre-build event:
	CALL $(SolutionDir)GIT-VS-VERSION-GEN.bat "$(IntDir)\" "$(SolutionDir)..\src\gen-versioninfo.h"

Notes
-----
Generated definitions:
  - GEN_VER_VERSION_STRING
    Terminated string of the git tag minus the leading 'v'.

  - GEN_VER_DIGITAL_VERSION
    16 bit int values representing Major, Minor, Fix, Patches.

  - GEN_VER_VERSION_HEX
    Concatenated hex representation of padded Major, Minor, Fix, Patches.

  - GEN_VER_COMMENT_STRING
    Git tag message value with pre-release stage info appended.

  - GEN_VER_PRIVATE_FLAG
  - GEN_VER_PRIVATE_STRING
    When HEAD is dirty flag is set.  String is set to 'Custom Build'.

  - GEN_VER_PATCHED_FLAG
    Set when there are commits between the tag and the commit being built.

  - GEN_VER_PRERELEASE_FLAG
    Set when the tag includes 'alpha', 'beta' or 'rc'.

Executing the script with the --test argument will generate an example
repository with tagged commits from an alpha stage to next full version
release along with a few maintenance patches and examples of building from
non-tagged commits and then output the data in comma separated format.

Sample test output:
TAG, Version, Hex, Maj, Min, Fix, Patches (from fix), PreRelease, Private, Patched, Comment
v1.0.0, 1.0.0, 1, 0, 0, 24, 0x0001000000000018, 0, 0, 0, Major Version Release
v1.0.0-alpha0, 1.0.0.alpha0, 1, 0, 0, 0, 0x0001000000000000, VS_FF_PRERELEASE, 0, 0, Alpha Release 0
v1.0.0-alpha1, 1.0.0.alpha1, 1, 0, 0, 4, 0x0001000000000004, VS_FF_PRERELEASE, 0, 0, Alpha Release 1
v1.0.0-beta0, 1.0.0.beta0, 1, 0, 0, 8, 0x0001000000000008, VS_FF_PRERELEASE, 0, 0, Beta Release 0
v1.0.0-beta1, 1.0.0.beta1, 1, 0, 0, 12, 0x000100000000000C, VS_FF_PRERELEASE, 0, 0, Beta Release 1
v1.0.0-rc0, 1.0.0.rc0, 1, 0, 0, 16, 0x0001000000000010, VS_FF_PRERELEASE, 0, 0, Release Candidate 0
v1.0.0-rc1, 1.0.0.rc1, 1, 0, 0, 20, 0x0001000000000014, VS_FF_PRERELEASE, 0, 0, Release Candidate 1
v1.0.0.1, 1.0.0.1, 1, 0, 0, 28, 0x000100000000001C, 0, 0, 0, Maintanence Version Release
v1.0.0.2, 1.0.0.2, 1, 0, 0, 30, 0x000100000000001E, 0, 0, 0, Maintanence Version Release
v1.0.1-alpha0, 1.0.1.alpha0, 1, 0, 1, 0, 0x0001000000010000, VS_FF_PRERELEASE, 0, 0, Alpha Release 0
v1.0.0-rc1-3-g4b88e7f, 1.0.0.rc1.3.g4b88e, 1, 0, 0, 23, 0x0001000000000017, VS_FF_PRERELEASE, 0, VS_FF_PATCHED, Release Candidate 1
v1.0.0-rc1-3-g4b88e7f, 1.0.0.rc1.3.g4b88e.dirty, 1, 0, 0, 23, 0x0001000000000017, VS_FF_PRERELEASE, VS_FF_PRIVATEBUILD, VS_FF_PATCHED, Release Candidate 1
v1.0.0, 1.0.0.dirty, 1, 0, 0, 24, 0x0001000000000018, 0, VS_FF_PRIVATEBUILD, VS_FF_PATCHED, Major Version Release
v1.0.0-1-g8321e15, 1.0.0.1.g8321e, 1, 0, 0, 25, 0x0001000000000019, 0, VS_FF_PRIVATEBUILD, VS_FF_PATCHED, Major Version Release
v1.0.0-custom, 1.0.0.custom, 1, 0, 0, 25, 0x0001000000000019, 0, VS_FF_PRIVATEBUILD, VS_FF_PATCHED, Major Version Release
v1.0.0.1, 1.0.0.1.dirty, 1, 0, 0, 28, 0x000100000000001C, 0, VS_FF_PRIVATEBUILD, VS_FF_PATCHED, Major Version Release
v1.0.0.1-1-gc2c9f0d, 1.0.0.1.1.gc2c9f, 1, 0, 0, 29, 0x000100000000001D, 0, VS_FF_PRIVATEBUILD, VS_FF_PATCHED, Major Version Release
v1.0.0.1-custom, 1.0.0.1.custom, 1, 0, 0, 29, 0x000100000000001D, 0, VS_FF_PRIVATEBUILD, VS_FF_PATCHED, Major Version Release

About

MS Visual Studio header generator for VERSIONINFO from git-describe during pre-build event.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages