Perforce Public Knowledge Base - How to Automatically Create Build Version Files
Downloads Blog Company Integrations Careers Contact Try Free
Menu Search
Reset Search



How to Automatically Create Build Version Files

« Go Back



I use a text file containing the latest changelist number as a version string for my software when it is built. Can Perforce create this file automatically for me?

Yes, Perforce can do this.  The easiest way involves creation of a text file that allows RCS keywords (file type 'text+k') and contains the '$Change$' RCS keyword.  In addition, there must be a way of ensuring that the file is always submitted, and doing so requires a trigger script or daemon of some kind.

One method is to use a 'change-commit' trigger that updates the relevant text file every time code is submitted to a particular branch. Examples of change-commit triggers can be found here.

It is important to note that either the trigger script or the trigger definitions must exclude the version file itself from causing the trigger to fire. For example the following trigger table stops '' being fired when 'version.txt' is submitted:

  version change-commit //depot/... "/path/"
  version change-commit -//depot/.../version.txt "/path/"

Another method is to use a review daemon that gets notified of every change and submits the file when certain conditions are met (such as the path of a submitted file). Configuring the Review Daemon (

Related Links



Was this article helpful?



Please tell us how we can make this article more useful.

Characters Remaining: 255