AutoVersioning plugin

From Code::Blocks
AutoVersioning
AutoVersioningLogo.png
Developer(s): JGM, KILLERBOT
Maintainer(s): JGM
Version: 1.1

An application versioning plug in that increments the version and build number of your application every time a change has been made and stores it in version.h with easy to use variable declarations. Also have a feature for committing changes a la SVN style, a version scheme editor, a change log generator and more...

Introduction

The idea of the AutoVersioning plugin was made during the development of a pre-alpha software that required the version info and status. Been to busy coding, without time to maintain the version number, just decided to develop a plugin that could do the job with little intervention as possible.

Features

Here is the list of features the plugin covers summarized:

  • Supports C and C++.
  • Generates and auto increment version variables.
  • Software status editor.
  • Integrated scheme editor for changing the behavior of the auto incrementation of version values.
  • Date declarations as month, date and year.
  • Ubuntu style version.
  • Svn revision check.
  • Change log generator.
  • Works on Windows and Linux (doesn't have Mac to test).

Sources

Usually source and news about new releases are posted on the Code::Blocks forums on the plugins development section. You can access this plugin topic over [/index.php/topic,6294.msg48225.html#msg48225 here], recent sources are attached on the first post (you have to be logged in to download attachments on the forum).

The plugin also have a project page at www.berlios.de. The link is http://developer.berlios.de/projects/autoversioning/. Submit all features request and bugs on the project page.

Svn check out: svn://svn.berlios.de/autoversioning

Usage

After downloading the sources, compiling them and installing the plugin to Code::Blocks just go to Project->Autoversioning menu. A pop up window like this will appear:

AvAskConfigure.png

When hitting yes on the ask to configure message box, the main auto versioning configuration dialog will open, to let you configure the version info of your project. Each editable control has a tool tip with information that explains you its features, so if you put the mouse on the control the tool tip will pop up. Below is a low quality screenshot showing all the tabs:

AvDialog.png

After configuring your project for auto versioning, the settings that you entered on the configuration dialog will be stored on the project file, and a version.h file will be created. For now, every time that you hit the Project->Autoversioning menu the configuration dialog will popup to let you edit your project version and versioning related settings, unless you don't save the new changes made by the plugin to the project file.

Dialog notebook tabs

Version Values

Here you just enter the corresponding version values or let the auto versioning plugin increment them for you.

  • Major - Increments by 1 when the minor version reaches its maximum
  • Minor - Increments by 1 when the build number pass the barrier of build times, the value is reset to 0 when it reach its maximum value.
  • Build number (also equivalent to Release) - Increments by 1 every time that the revision number is incremented.
  • Revision - Increments randomly when the project has been modified and then compiled.

Status

Some fields to keep track of your software status with a list of predefined values for convenience.

  • Software Status - The typical example should be v1.0 Alpha
  • Abbreviation - Same as software status but like this: v1.0a

Scheme

Lets you edit how the plugin will increment the version values.

  • Minor maximum - The maximum number that the Minor value can reach, after this value is reached the Major is incremented by 1 and next time project is compiled the Minor is set to 0.
  • Build Number maximum - When the value is reached, the next time the project is compiled is set to 0. Put a 0 for unlimited.
  • Revision maximum - Same as Build Number maximum. Put a 0 for unlimited
  • Revision random maximum - The revision increments by random numbers that you decide, if you put here 1, the revision obviously will increment by 1.
  • Build times before incrementing Minor - After successful changes to code and compilation the build history will increment, and when it reaches this value the Minor will increment.

Settings

Here you can set some settings of the auto versioning behavior.

  • Autoincrement Major and Minor - lets the plugin increments this values by you using the scheme. If not marked only the Build Number and Revision will increment.
  • Create date declarations - create entries in the version.h file with dates and ubuntu style version.
  • Do Auto Increment - this tells the plugin to automatically increment the changes when a modification is made, this incrementation will occur before compilation.
  • Header language - select the language output of version.h
  • Ask to increment - if marked, Do Auto Increment, it ask you before compilation (if changes has been made) to increment the version values.
  • svn enabled - search for the svn revision and date in the current folder and generates the correct entries in version.h

Changes Log

This lets you enter every change made to the project to generate a ChangesLog.txt file.

  • Show changes editor when incrementing version - will pop up the changes log editor when incrementing the version.
  • Title Format - a format able title with a list of predefined values.

Including in your code

To use the variables generated by the plugin just #include <version.h> (or the real name in case you changed the default name). An example code would be like the following:

#include <iostream>
#include "version.h"

void main(){
    std::cout<<AutoVersion::MAJOR<<endl;
}

Output of version.h

The generated header file. Here is a sample content of the file on c++ mode:

#ifndef VERSION_H
#define VERSION_H

namespace AutoVersion{
	
	//Date Version Types
	static const char DATE[] = "15";
	static const char MONTH[] = "09";
	static const char YEAR[] = "2007";
	static const double UBUNTU_VERSION_STYLE = 7.09;
	
	//Software Status
	static const char STATUS[] = "Pre-alpha";
	static const char STATUS_SHORT[] = "pa";
	
	//Standard Version Type
	static const long MAJOR = 0;
	static const long MINOR = 10;
	static const long BUILD = 1086;
	static const long REVISION = 6349;
	
	//Miscellaneous Version Types
	static const long BUILDS_COUNT = 1984;
	#define RC_FILEVERSION 0,10,1086,6349
	#define RC_FILEVERSION_STRING "0, 10, 1086, 6349\0"
	static const char FULLVERSION_STRING[] = "0.10.1086.6349";
	
}
#endif //VERSION_h

On C mode is the same as C++ but without the namespace:

#ifndef VERSION_H
#define VERSION_H
	
	//Date Version Types
	static const char DATE[] = "15";
	static const char MONTH[] = "09";
	static const char YEAR[] = "2007";
	static const double UBUNTU_VERSION_STYLE = 7.09;
	
	//Software Status
	static const char STATUS[] = "Pre-alpha";
	static const char STATUS_SHORT[] = "pa";
	
	//Standard Version Type
	static const long MAJOR = 0;
	static const long MINOR = 10;
	static const long BUILD = 1086;
	static const long REVISION = 6349;
	
	//Miscellaneous Version Types
	static const long BUILDS_COUNT = 1984;
	#define RC_FILEVERSION 0,10,1086,6349
	#define RC_FILEVERSION_STRING "0, 10, 1086, 6349\0"
	static const char FULLVERSION_STRING[] = "0.10.1086.6349";
	
#endif //VERSION_h

Change log generator

This dialog is accessible from the menu Project->Changes Log. Also if checked Show changes editor when incrementing version on the changes log settings, the window will open to let you enter the list of changes after a modification to the project sources or an incrementation event. Below is an example screen shot:

AvChangesList.png

Buttons Summary

  • Add - appends a row in to the data grid
  • Edit - enables the modification of the selected cell
  • Delete - removes the current row from the data grid
  • Save - stores into a temporary file (changes.tmp) the actual data for later procesing into the changes log file
  • Write - process the data grid data to the changes log file
  • Cancel - just closes the dialog without taking any action


Here is an example of the output generated by the plugin to the ChangesLog.txt file:

03 September 2007
   released version 0.7.34 of AutoVersioning-Linux

     Change log:
        -Fixed: pointer declaration
        -Bug: blah blah

02 September 2007
   released version 0.7.32 of AutoVersioning-Linux

     Change log:
        -Documented some areas of the code
        -Reorganized the code for readability

01 September 2007
   released version 0.7.30 of AutoVersioning-Linux

     Change log:
        -Edited the change log window
        -If the change log windows is leave blank no changes.txt is modified

Removing AutoVersioning from a project

There is no way to disable AutoVersioning through its GUI, you will have to manually edit the Code::Blocks project (.cbp) file.

  • Close the project.
  • Open the cbp file in a simple text editor like Notepad, gedit or TextEdit.
  • Find the <AutoVersioning> [...] </AutoVersioning> section. Remove it including the opening and closing tags, as well as everything in between. Save the file.
  • Reopen the project and remove the version.h file from it.
  • Delete the version.h file from your file system.