Perforce Public Knowledge Base - How to Automatically Create Build Version Files
× PRODUCTS SOLUTIONS CUSTOMERS LEARN SUPPORT
Downloads Blog Company Integrations Careers Contact Try Free
Menu Search
Perforce
Reset Search
 

 

Article

How to Automatically Create Build Version Files

« Go Back

Information

 
Problem

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?

Solution
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 'mytrigger.sh' being fired when 'version.txt' is submitted:

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


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 (p4review.py).

Related Links

Feedback

 

Was this article helpful?


   

Feedback

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

Characters Remaining: 255