[OpenLayers-Dev] including the version number *in* the header comments of OpenLayers.js file

Tim Schaub tschaub at openplans.org
Tue May 6 12:56:49 EDT 2008

Christopher Schmidt wrote:
> On Sun, May 04, 2008 at 02:28:12PM -0400, Schuyler Erle wrote:
>> On Sun, 2008-05-04 at 03:26 -0400, Christopher Schmidt wrote:
>>>> When someone copies the file named "OpenLayers.js" and a dir called "img/"
>>>> into some project, it currently has no version number visible. 
>>> OpenLayers.VERSION_NUMBER is in the file, and accessible in Javascript
>>> for that reason: this means that when I'm debugging a page, I don't even
>>> have to bother reading the file to get the version, I just open Firebug
>>> and type "OpenLayers.VERSION_NUMBER" in. In general, I know that I find
>>> that way simpler than opening another webpage and looking through it for
>>> a version.
>> SVN keyword substitution might be another answer.
>> http://svnbook.red-bean.com/en/1.0/ch07s02.html#svn-ch-7-sect-2.3.4
> This is what we use for OpenLayers.VERSION_NUMBER. However, keyword
> substitution only has keywords for "When this file last changed." Since
> the comments at the top of the file are loaded from the LICENSE.txt in
> the build/ directory (which changes very seldom), it would still require    
> manual effort to do a change to the file to get the keywords
> (speciically, Id) to change.
> OpenLayers.js, on the other hand, changes whenever we add a new class,
> which is often enough that we actually do get a reasonable
> VERSION_NUMBER out of it. 
> Regards,

If you're looking for the OpenLayers version number (of a release) 
instead of the revision number (of the repository), it seems like this 
could become part of the release process.  Assuming that you want the 
version number at the top of the single file build, the build script 
could take an additional argument that it would write as a comment above 
the license.txt.

This would require a change to build.py and a modification of step 6.3 
here: http://trac.openlayers.org/wiki/Release/Procedure

./build.py full -c "Version x.y"


More information about the Dev mailing list