Skip to content

Commit

Permalink
Merge pull request #30 from sync2brain/pack_sg
Browse files Browse the repository at this point in the history
Attach and package Speedgoat dependencies on demand
  • Loading branch information
pablorcum authored Aug 24, 2023
2 parents 8952b58 + ccc963f commit cbb5486
Show file tree
Hide file tree
Showing 20 changed files with 29 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
work
toolbox/html
toolbox/dependencies/firmware
toolbox/dependencies

# Autosave files
*.asv
Expand Down
3 changes: 3 additions & 0 deletions buildUtilities/releaseTask.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
warning('Share folder not found. Firmware dependencies will not be packaged in toolbox.');
end

% Update Speedgoat dependencies
updateSGdeps;

% Remove v from toolboxVersion
options.toolboxVersion = erase(toolboxVersion,"v");

Expand Down
14 changes: 10 additions & 4 deletions buildUtilities/updateSGdeps.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,24 @@

projObj = currentProject;
sgToolsPath = fileparts(which('updateSGtools.p','-all'));
sgToolsPath = sgToolsPath{end}; % Speedgoat I/O blockset path is always below the local project
if isstring(sgToolsPath)
sgToolsPath = sgToolsPath{end}; % Speedgoat I/O blockset path is always below the local project
end

fprintf('Updating Speedgoat dependencies in local project from %s...\n',sgToolsPath);

sgTools = dir(sgToolsPath);
sgTools = sgTools(~[sgTools.isdir]);

destFolder = fullfile(projObj.RootFolder,'toolbox/dependencies/sg',matlabRelease.Release);
if ~isfolder(destFolder)
mkdir(destFolder);
end

for i = 1:numel(sgTools)
copyfile(fullfile(sgTools(i).folder,sgTools(i).name),...
fullfile(projObj.RootFolder,'toolbox/dependencies/sg/'));
copyfile(fullfile(sgTools(i).folder,sgTools(i).name),destFolder);
end

fprintf('Dependencies updated. Please commit and push changes to Git.\n');
fprintf('Speedgoat dependencies updated in toolbox.\n');

end
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info/>
<Info location=".gitkeep" type="File"/>

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info location="176e4c23-7d69-4d8a-99e4-6290316f4773" type="Reference"/>

This file was deleted.

13 changes: 12 additions & 1 deletion toolbox/bossdevice.m
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ function clearPersonalSettings()
ipAddress {mustBeTextScalar} = '';
end

toolboxPath = fileparts(which(mfilename));

% Initialize toolbox settings
s = settings;

Expand All @@ -81,6 +83,16 @@ function clearPersonalSettings()
ipAddress = s.bossdeviceAPI.TargetSettings.TargetIPAddress.FactoryValue;
end

% Check and enable built-in Speedgoat dependencies
if ~exist('updateSGtools.p','file')
addpath(fullfile(toolboxPath,'dependencies','sg',matlabRelease.Release));
elseif exist('speedgoat','file')
% Using own full installation of Speedgoat I/O Blockset
% fprintf('Using own full installation of Speedgoat I/O Blockset v%s.\n',speedgoat.version);
else
error('Speedgoat dependencies not found. Please search out to technical support.');
end

% Use default target if not passing any input argument
tgs = slrealtime.Targets;
if ~contains(tgs.getTargetNames,targetName,'IgnoreCase',true)
Expand All @@ -98,7 +110,6 @@ function clearPersonalSettings()
end

% Search firmware binary and prompt user if not found in MATLAB path
toolboxPath = fileparts(which(mfilename));
firmwareSharePath = fullfile(toolboxPath,'dependencies','firmware',matlabRelease.Release,[obj.appName,'.mldatx']);

if exist([obj.appName,'.mldatx'],"file")
Expand Down
Empty file.
Binary file removed toolbox/dependencies/sg/SGtarlist.p
Binary file not shown.
1 change: 0 additions & 1 deletion toolbox/dependencies/sg/sgtools_qnx710.cksum

This file was deleted.

Binary file removed toolbox/dependencies/sg/sgtools_qnx710.tar
Binary file not shown.
Binary file removed toolbox/dependencies/sg/updateSGtools.p
Binary file not shown.

0 comments on commit cbb5486

Please sign in to comment.