classdef ProjectTool < coder.make.BuildTool

% Copyright 2015 The MathWorks, Inc.

properties
end

methods
% -----------------------------------------------------------------
% Constructor
% -----------------------------------------------------------------
function h = ProjectTool(name)
h@coder.make.BuildTool(name);
end

end

methods (Abstract)
[ret, context] = initialize(h, buildInfo, context, varargin);
[ret, context] = createProject(h, buildInfo, context, varargin);
[ret, context] = buildProject(h, buildInfo, context, varargin);
[ret, context] = downloadProject(h, buildInfo, context, varargin);
[ret, context] = runProject(h, buildInfo, context, varargin);
[ret, context] = onError(h, buildInfo, context, varargin);
[ret, context] = terminate(h, buildInfo, context, varargin);
end

methods(Access = protected)
function [ret, context] = replaceMacros(h, inpath, buildInfo, context, varargin) %#ok<INUSL>
macros = regexp( inpath, '\$\((\w+)\)', 'tokens' );
ret = inpath;
comp = varargin{3};
for i = 1:numel(macros)
idx = find(strcmp(macros{i},{comp.Macros(:).macro}));
if ~isempty(idx)
ret = strrep(ret,cell2mat(['$(',macros{i},')']), comp.Macros(idx).value);
end
end
end
end

end

% LocalWords: toolchain