CNMAT's Versioning and Publishing System

CNMAT now has a coherent, automatic way to handle version numbers, author name(s), short descriptive text, etc., for our Max/MSP externals.

All these data live in a name/value table inside a comment near the top of the main C file for each external. For example, here's the name/value table for the current version of the threefates object:

/*
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
NAME: threefates
DESCRIPTION: Deal with track birth/death for sinusoids~
AUTHORS: Tim Madden and Matt Wright
COPYRIGHT_YEARS: 2000,01,02,03,04,05
SVN_REVISION: $LastChangedRevision: 415 $
VERSION 0.2: 041229 MW: Handles arbitrary-length partial parameter lists
VERSION 0.2.1: New version/makefile system
VERSION 0.2.2: Proper use of name/value tags
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
*/

All of these fields are required. This information automatically appears in multiple places:

  • When the object loads, the copyright and version info print in the Max window
  • You can send the object a "version" message to print the same info
  • When you say "Get Info" on an external in the OSX finder, it shows the correct version number
  • The download files (small archives for each object with the external, the help patch, etc.) will include the object's name and version number in their filename, e.g., threefates_0.2.2.sit
  • The automatically-generated web downloads page has columns for name, description, authors, etc., plus an option to view the version history for any object.

A special Makefile (that relies on features in gnumake 3.81 or higher) and perl script turns this into a C header file called version.h as well as a text file called objectname-platform-objinfo.txt that's used by the web downloads system.

Note that the colon between the variable name and its value is required.

Automatically getting the SVN respository version

The value of the variable SVN_REVISION in the example above is the special syntax "$LastChangedRevision: 415$", which Subversion will automatically update to be the current revision number of the repository whenever you commit a new version of the file. Unfortunately, this is not Subversion's default behavior, so you have to set the "property" of keeping this variable up to date on a per-file basis. For example, for the threefates object, you'd have to issue this command:

svn propset svn:keywords "LastChangedRevision" threefates.c