function groups = getPostbuildTargetGroups(h,buildInfo)
%

%   Copyright 2014 The MathWorks, Inc.

tools = h.ToolchainInfo.PostbuildTools;
keys = tools.keys();
downloadIdx = find( strcmpi( 'download', keys ) );
executeIdx = find( strcmpi( 'execute', keys ) );
preDownloadIdx = (1:downloadIdx - 1);
postDownloadPreExecuteIdx = (downloadIdx + 1:executeIdx - 1);
postExecuteIdx = (executeIdx + 1:numel( keys ));
groups = [  ];
groups( 1 ).name = 'postbuild';
groups( 1 ).keys = keys( preDownloadIdx );
groups( end + 1 ).name = 'download';
groups( end ).keys = keys( downloadIdx );
groups( end + 1 ).name = 'postdownload_preexecute';
groups( end ).keys = keys( postDownloadPreExecuteIdx );
groups( end + 1 ).name = 'execute';
groups( end ).keys = keys( executeIdx );
groups( end + 1 ).name = 'postexecute';
groups( end ).keys = keys( postExecuteIdx );
end
