Skip to content
Snippets Groups Projects
Commit 00015a1e authored by Mark Winter's avatar Mark Winter
Browse files

New versioning paradigm.

- Added auto-generated version information and all version info should now be retrieved using the Helper.GetVersion call.
parent 8eba11f6
No related branches found
No related tags found
No related merge requests found
......@@ -25,11 +25,24 @@
totalTime = tic();
% Give a messagebox warning if there are uncommitted changes.
% Note: even committed changes may not have been pushed to server.
[status,result] = system('git status --porcelain');
if ( status == 0 && (length(result) > 1) )
questionStr = sprintf('%s\n%s','There are uncommitted changes in your working directory','Are you sure you wish to continue with the build?');
result = questdlg(questionStr,'Build Warning','Yes','No','No');
if ( strcmpi(result,'No') )
return;
end
end
vstoolroot = getenv('VS100COMNTOOLS');
if ( isempty(vstoolroot) )
error('Cannot compile MTC and mexMAT without Visual Studio 2010');
end
Dev.MakeVersion();
comparch = computer('arch');
if ( strcmpi(comparch,'win64') )
buildbits = '64';
......@@ -108,17 +121,17 @@ system(['copy "' mcrfile '" "' bindir '\"']);
tic();
fprintf('\nMATLAB Compiling: %s...\n', 'LEVer');
!mcc -R -startmsg -m LEVer.m -a LEVER_logo.tif
!mcc -R -startmsg -m LEVer.m -a LEVER_logo.tif -a +Helper\GetVersion.m -a +Helper\VersionInfo.m
fprintf('Done (%f sec)\n', toc());
tic();
fprintf('\nMATLAB Compiling: %s...\n', 'Segmentor');
!mcc -R -startmsg -m Segmentor.m -a +Segmentation\*FrameSegmentor.m
!mcc -R -startmsg -m Segmentor.m -a +Segmentation\*FrameSegmentor.m -a +Helper\GetVersion.m -a +Helper\VersionInfo.m
fprintf('Done (%f sec)\n', toc());
tic();
fprintf('\nMATLAB Compiling: %s...\n', 'LEVER_SegAndTrackFolders');
!mcc -R -startmsg -m LEVER_SegAndTrackFolders.m
!mcc -R -startmsg -m LEVER_SegAndTrackFolders.m -a +Helper\GetVersion.m -a +Helper\VersionInfo.m
fprintf('Done (%f sec)\n', toc());
% tic();
......
function verInfo = MakeVersion(bTransientUpdate)
funcString = {
'%% versionInfo = VersionInfo()'
'%% Return the version info structure'
'%%'
'%% Note: This file is autogenerated by build script DO NOT MODIFY!!'
''
'function versionInfo = VersionInfo()'
' versionInfo = struct(...'
' ''majorVersion'',{%d},...'
' ''minorVersion'',{%d},...'
' ''branchName'',{''%s''},...'
' ''buildNumber'',{''%s''},...'
' ''buildMachine'',{''%s''});'
' end'};
if ( ~exist('bTransientUpdate', 'var') )
bTransientUpdate = 0;
end
verInfo = struct(...
'majorVersion',{0},...
'minorVersion',{0},...
'branchName',{'UNKNOWN'},...
'buildNumber',{'UNKNOWN'},...
'buildMachine',{'UNKNOWN'});
% Get version info from git tag
[status,verTag] = system('git describe --tags --match v[0-9]*.[0-9]* --abbrev=0');
if ( status ~= 0 )
fprintf('WARNING: There was an error retrieving current version information:\n %s\n', verTag);
else
verTag = strtrim(verTag);
numTok = regexp(verTag, '[Vv]([0-9]+)[.]([0-9]+).*', 'tokens', 'once');
if ( length(numTok) >= 2 )
verInfo.majorVersion = str2double(numTok{1});
verInfo.minorVersion = str2double(numTok{2});
verInfo.minorVersion = verInfo.minorVersion + 1;
end
end
% Get a timestamp build-number
c = clock();
verInfo.buildNumber = sprintf('%d.%02d.%02d.%02d', c(1), c(2), c(3), c(4));
% Try to get a branch name
[status,branchName] = system('git rev-parse --abbrev-ref HEAD');
if ( status ~= 0 )
fprintf('WARNING: There was an error retrieving current branch information:\n %s\n', branchName);
else
verInfo.branchName = strtrim(branchName);
end
% Get machine ID
[status,buildMachine] = system('hostname');
if ( status ~= 0 )
fprintf('WARNING: There was an error retrieving hostname:\n %s\n', buildMachine);
else
verInfo.buildMachine = strtrim(buildMachine);
end
if ( ~bTransientUpdate )
% Concatenate the template function lines into one giant string
templateString = [];
for i=1:length(funcString)
templateString = [templateString funcString{i} '\n'];
end
% Now insert all our arguments into the template and write to a file.
fid = fopen('+Helper\VersionInfo.m', 'wt');
if ( fid <= 0 )
error('Unable to open +Helper\VersionInfo.m for writing');
end
fprintf(fid, templateString, verInfo.majorVersion, verInfo.minorVersion, verInfo.branchName, verInfo.buildNumber, verInfo.buildMachine);
fclose(fid);
end
end
# Specifically ignore autogenerated version info file
VersionInfo.m
\ No newline at end of file
% version = GetVersion(command)
% Get a version string or number depending on the command argument. This
% m-file serves as a single repository for all version-related information.
%
% Note: Uses autogenerated version information in +Helper\VersionInfo.m
function version = GetVersion(command)
version = [];
if ( isdeployed )
verInfo = Helper.VersionInfo();
else
verInfo = Dev.MakeVersion(1);
end
if ( ~exist('command','var') )
command = 'string';
end
if ( strcmpi(command, 'string') || strcmpi(command, 'versionString') )
version = [num2str(verInfo.majorVersion) '.' num2str(verInfo.minorVersion) ' ' verInfo.branchName];
return;
end
if ( strcmpi(command, 'buildString') )
version = [verInfo.buildNumber '/' verInfo.buildMachine];
return;
end
if ( strcmpi(command, 'fullString') )
version = [num2str(verInfo.majorVersion) '.' num2str(verInfo.minorVersion) '.' verInfo.buildNumber '/' verInfo.buildMachine ' ' verInfo.branchName];
return;
end
if ( strcmpi(command, 'major') )
version = verInfo.majorVersion;
return
end
if ( strcmpi(command, 'minor') )
version = verInfo.minorVersion;
return;
end
end
......@@ -29,8 +29,9 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function opened = OpenData()
global Figures Colors CONSTANTS softwareVersion
global Figures Colors CONSTANTS
softwareVersion = Helper.GetVersion();
if(isempty(Figures))
fprintf('LEVer ver %s\n***DO NOT DISTRIBUTE***\n\n', softwareVersion);
end
......
No preview for this file type
......@@ -64,11 +64,13 @@ else
im=255*ones(339,608);
end
imagesc(im)
global softwareVersion
softwareVersion = Helper.GetVersion();
buildNumber = Helper.GetVersion('buildString');
cDate = clock();
if ( ~isempty(softwareVersion) )
set(handles.text1,'string',{['LEVER : ' softwareVersion] ; [] ; ['(c) 2012'] });
set(handles.text1,'string',{['LEVER: ' softwareVersion] ; [' ' buildNumber ' '] ;[] ; ['(c) ' num2str(cDate(1))] });
else
set(handles.text1,'string',{['LEVER : (version unknown)' ] ; [] ; ['(c) 2012'] });
set(handles.text1,'string',{['LEVER: (version unknown)' ] ; []; [] ; ['(c) ' num2str(cDate(1))] });
end
% UIWAIT makes about wait for user response (see UIRESUME)
......
......@@ -7,11 +7,11 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% mcc -m LEVER_SegAndTrackFolders.m
function LEVER_SegAndTrackFolders(outputDir, maxProcessors)
global CONSTANTS softwareVersion;
global CONSTANTS;
CONSTANTS=[];
softwareVersion = '7.1 Multi-Cell';
softwareVersion = Helper.GetVersion();
cellType = Load.QueryCellType();
Load.AddConstant('cellType',cellType,1);
......
......@@ -25,7 +25,7 @@
function LEVer()
global Figures softwareVersion ReplayEditActions CONSTANTS
global Figures ReplayEditActions CONSTANTS
%if LEVer is already opened, save state just in case the User cancels the
%open
......@@ -34,8 +34,6 @@ if(~isempty(Figures))
previousOpened = 1;
end
softwareVersion = '7.1 Multi-Cell';
if(Load.OpenData())
Editor.ReplayableEditAction(@Editor.InitHistory);
elseif(previousOpened)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment