Version Control
Overview:
Ragnarok was used up to september 2008 - from here on SubVersion is used.
All source code in the ConSys project is under version control. We use Ragnarok - a software development environment made by Henrik Bærbak Christensen as a PdD project in computer science. Ragnarok deals with the source code in software components. In the ConSys project, most of the basic software components are applications or program libraries. A few of the central libraries containing the core code for ConSys has been split into logically related sub components. The program and library components are arranged in group components according to their content as can be seen by the Ragnarok screen snapshot below. Each component in the Ragnarok system has a single number version. The ConSys program version numbers are based on the Ragnarok version numbers.
The application and library version numbering are based on the Ragnarok component version numbers. The version numbers contain four numbers in the format:
X.X.X.X
1' number: ConSys major version only changed in case of a major change in the ConSys project.
2' number: ConSys minor version. This number is incremented by one for every ConSys release. The ConSys install scripts are denoted by this number.
3' number: The ConSys component Ragnarok version number.
4' number: The application/library Ragnarok component version number.
Maintaining the version numbers
The application/library version numbers are defined in header files included into the programs. The 3' and 4' version number are automatically updated in these header files by Ragnarok checkin/checkout scripts. The 1' and 2' ConSys version number must be updated manually for each release version before check in of the ConSys project.
Updating the 1' version number (ConSys major version):
Obtain a lock on the ConSys component.
In the file 'ConSys.rsl' update the following 4 lines containing the major version number:
AFTERCHECKIN: ConSys
…
puts $f "#define ConSys_MAJOR_VERSION 1"
puts $f "#define ConSys_MAJOR_VERSION_STR \"1\""
…
AFTERCHECKOUT: ConSys
…
puts $f "#define ConSys_MAJOR_VERSION 1"
puts $f "#define ConSys_MAJOR_VERSION_STR \"1\""
…
Updating the 2' version number (ConSys minor version):
Obtain a lock on the ConSys component.
In the file 'ConSys.rsl' update the following 4 lines containing the major version number:
AFTERCHECKIN: ConSys
…
puts $f "#define ConSys_MINOR_VERSION 7"
puts $f "#define ConSys_MINOR_VERSION_STR \"7\""
…
AFTERCHECKOUT: ConSys
…
puts $f "#define ConSys_MINOR_VERSION 7"
puts $f "#define ConSys_MINOR_VERSION_STR \"7\""
Obtain a lock on the 'ConSysClient' component in the 'ConSysKernel' component.
..\ConSysKernel\ConSysClient.h: Update the line
#define CONSYS_CURRENT_VERSION 7
Adding a new application/library to the project
The procedure for adding a new application or library to the revision control system needs to be made carefully in order to make the automatic version numbering work correct.
- Create the new project in the standard way from Microsoft Visual Studio.
- Obtain a lock on the Ragnarok component where the new project should be inserted.
- Create a new component in Ragnarok by dragging the mouse while pressing <shift+ctrl>
- Create a sub component 'res' for the resource files.
- Set up component dependencies.
- Associate the source files to the created components. Include all files with extensions h,cpp,mak,rc,dsw,dsp,txt - and for the resource the 'rc2' file and all binary files (remember to give the file type 'binary' for these files).
- Create a checkin/checkout rsl script to generate the header file with the Ragnarok version number. The file must be given the name: "<component name>.rsl". See the layout of this file below. Remember to change the project names for both the AFTERCHECKIN and AFTERCHECKOUT parts.
- From Visual Studio: Include the rsl file in the project source file. Exclude it from the build.
- Check in the new project and close Ragnarok. (note the component number)
- Start RCM, change to the new component, and obtain the lock.
- Type 'ASSOCSCRIPT'. This command will associate <component name>.rsl to the ragnarok project and assign the corresponding 'after check in' and 'before checkout' procedures.
- Check the component in again and exit RCM. A new file with the name "<Component name>version.h" is now created.
- Start Ragnarok and obtain a lock on the component.
- From Visual Studio: Add the version header file to the project header files.
- Open the XX.rc file as a text file and copy and remove the version information section.
- Insert the version information section into the res\XX.rc2 file. (see below)
- Edit the version information section so it includes the version definitions defined in the version header file. (see below).
- If the program include an about dialog, edit the dialog so it uses the version definitions. (see below).
- Compile and check the file version number.
- Add the project to the ConSys major compile projects and set dependencies for the compilation.
Example from the Console component - substitute 'Console' with your project name:
------------------------------------------ AFTERCHECKIN: Console # Script to create a file project version header file. # # set vers "#define " append vers $SC(Name) append vers "_VERSION " append vers $SC(VersID) set verstr "#define " append verstr $SC(Name) append verstr "_VERSION_STR \"" append verstr $SC(VersID) append verstr $SC(Modification) append verstr "\"" # Build the define identications set ifndef "#ifndef _" append ifndef $SC(Name) append ifndef "_VERSION_" set define "#define _" append define $SC(Name) append define "_VERSION_" # Build component id define set id "#define " append id $SC(Name) append id "_COMPONENT_ID " append id $SC(ID) # Build component log define set log "#define " append log $SC(Name) append log "_LOGGED " append log $SC(Lock) # Build the filename set filename $WorkDirectory append filename $SC(Path) append filename $SC(Name) append filename "version.h" # Debug output: puts $filename # # And output the damn thing! set f [open $filename w] puts $f $ifndef puts $f $define puts $f "" puts $f $vers puts $f $verstr puts $f $id puts $f $log puts $f "" puts $f "#endif" close $f # ------------------------------------------ AFTERCHECKOUT: Console # Script to create a file project version header file. # # set vers "#define " append vers $SC(Name) append vers "_VERSION " append vers $SC(VersID) set verstr "#define " append verstr $SC(Name) append verstr "_VERSION_STR \"" append verstr $SC(VersID) append verstr $SC(Modification) append verstr "\"" # Build the define identications set ifndef "#ifndef _" append ifndef $SC(Name) append ifndef "_VERSION_" set define "#define _" append define $SC(Name) append define "_VERSION_" # Build component id define set id "#define " append id $SC(Name) append id "_COMPONENT_ID " append id $SC(ID) # Build component log define set log "#define " append log $SC(Name) append log "_LOGGED " append log $SC(Lock) # Build the filename set filename $WorkDirectory append filename $SC(Path) append filename $SC(Name) append filename "version.h" # Debug output: puts $filename # # And output the damn thing! set f [open $filename w] puts $f $ifndef puts $f $define puts $f "" puts $f $vers puts $f $verstr puts $f $id puts $f $log puts $f "" puts $f "#endif" close $f #
Version definition in the rc2 file
Example from the Console component - substitute 'Console' with your project name:
#include "ConsoleVersion.h" #include "..\..\ConSysVersion.h" ///////////////////////////////////////////////////////////////////////////// // // Version // VS_VERSION_INFO VERSIONINFO FILEVERSION ConSys_MAJOR_VERSION,ConSys_MINOR_VERSION,ConSys_ROOT_VERSION,Console_VERSION PRODUCTVERSION ConSys_MAJOR_VERSION,ConSys_MINOR_VERSION,ConSys_ROOT_VERSION,Console_VERSION FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L #else FILEFLAGS 0x0L #endif FILEOS 0x4L FILETYPE 0x1L FILESUBTYPE 0x0L BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "080904b0" BEGIN VALUE "CompanyName", "ISA\0" VALUE "FileDescription", "CONSOLE MFC Application\0" VALUE "FileVersion", ConSys_VERSION_STR "." Console_VERSION_STR "\0" VALUE "InternalName", "$Id: Console.rc2 1.2 1998/07/02 07:39:54 tw Exp $\0" VALUE "LegalCopyright", "ISA © 1998\0" VALUE "OriginalFilename", "CONSOLE.EXE\0" VALUE "ProductName", "CONSOLE Application\0" VALUE "ProductVersion", ConSys_VERSION_STR "." Console_VERSION_STR "\0" END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x809, 1200 END END
Version information in the About dialog
Example from the Console component:
Create an about dialog box with a static text box. Create a member variable m_version for this static using the class wizard. Change the code according to the following;
CAboutDialog::CAboutDialog(CWnd* pParent /*=NULL*/) : CDialog(CAboutDialog::IDD, pParent) { //{{AFX_DATA_INIT(CAboutDialog) m_version = _T(""); //}}AFX_DATA_INIT DWORDLONG ver = CLibrary::FileVersion(_T("Console.exe")); m_version.Format("Console version : %d.%d.%d.%d", (UINT)((ver >> 48) & 0xFFFF), (UINT)((ver >> 32) & 0xFFFF), (UINT)((ver >> 16) & 0xFFFF), (UINT)((ver >> 0) & 0xFFFF) ); } void CAboutDialog::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CAboutDialog) DDX_Text(pDX, IDC_CONSOLEVERSION, m_version); //}}AFX_DATA_MAP }
Last Modified 14 January 2019