% This function parses the user input and invokes the AppBuilder
% constructor
% Usage: buildapp(appname, entrypointfile, appversion, summary, description, ...
%                             authorname, authorcontact, authorcompany, appicon, ...
%                             appscreenshot, GUID(optional) and/or icons)

%   Copyright 2012 The MathWorks, Inc.
%
function out = buildapp(appname, entrypointfile, appversion, summary, description, ...
                            authorname, authorcontact, authorcompany, appicon, ...
                            appscreenshot, varargin)
    try
        newapp = appcreate.internal.appbuilder(appname, entrypointfile, '', ...
                            '', '', appversion, summary, description, ...
                            authorname, authorcontact, authorcompany, appicon, ...
                            appscreenshot, varargin);
        build(newapp);
        % Create struct with MATLAB app info to pass back to the caller.
        v = ver('MATLAB');
        out = struct('Name', newapp.Name...
                     ,'EntryPoint', newapp.EntryPoint...
                     ,'Version', newapp.Version...
                     ,'MATLABRelease', char(v.Release)...
                     ,'GUID', newapp.GUID);                 
    catch exception
        throw(exception);
    end
end
