Skip to content

Commit 67420b7

Browse files
authored
Merge pull request #35 from sync2brain/fix_sgDeps
Fix sg deps
2 parents d268b0a + 1a9e167 commit 67420b7

File tree

17 files changed

+91
-62
lines changed

17 files changed

+91
-62
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
3131
- name: Run MATLAB command
3232
run: |
33-
&"$env:ProgramFiles\MATLAB\$env:MATLAB_VER\bin\matlab.exe" -batch "openProject(pwd); cd('buildUtilities'); buildtool test('') package('${{ github.ref_name }}','${{ github.actor }}')"
33+
&"$env:ProgramFiles\MATLAB\$env:MATLAB_VER\bin\matlab.exe" -batch "openProject(pwd); cd('buildUtilities'); buildtool test('bdConnected') package('${{ github.ref_name }}','${{ github.actor }}')"
3434
3535
# Create new release
3636
- name: Release

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
work
2+
.buildtool
23
toolbox/html
4+
toolbox/dependencies/sg
5+
toolbox/dependencies/firmware
36

47
# Autosave files
58
*.asv

buildUtilities/buildfile.m

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,18 @@
1919
Actions = @(~) updateSGdeps,...
2020
Outputs = fullfile(projObj.RootFolder,"toolbox/dependencies/sg/**"));
2121

22+
plan("updateFirmwareDeps") = Task( ...
23+
Description = "Update Firmware dependencies", ...
24+
Actions = @(~) updateFirmwareDeps,...
25+
Outputs = fullfile(projObj.RootFolder,"toolbox/dependencies/firmware/**"));
26+
2227
% Create the "test" task and add it to the plan
2328
plan("test") = Task( ...
2429
Description = "Run unit tests", ...
2530
Actions = @(~,tags) testTask(tags),...
2631
Inputs = [fullfile(projObj.RootFolder,'**/*.m'),...
27-
plan("updateSGdeps").Outputs]);
32+
plan("updateSGdeps").Outputs,...
33+
plan("updateFirmwareDeps").Outputs]);
2834

2935
plan("buildDoc") = Task( ...
3036
Description = "Build HTML doc from sources", ...
@@ -37,7 +43,7 @@
3743
Description = "Package toolbox", ...
3844
Dependencies = ["check" "test"], ...
3945
Actions = @(~,toolboxVer,authorName) releaseTask(toolboxVer,authorName),...
40-
Inputs = [plan("buildDoc").Outputs, plan("updateSGdeps").Outputs]);
46+
Inputs = [plan("buildDoc").Outputs, plan("updateSGdeps").Outputs plan("updateFirmwareDeps").Outputs]);
4147

4248
% Set default tasks in the plan
4349
plan.DefaultTasks = ["check" "test"];

buildUtilities/releaseTask.m

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,14 @@
1-
function toolboxOptions = releaseTask(toolboxVersion, authorName, shareFolder)
1+
function toolboxOptions = releaseTask(toolboxVersion, authorName)
22
%GENERATETOOLBOX Function that generates a toolbox for the boss device API
33

44
arguments
55
toolboxVersion string {mustBeTextScalar} = '0.0'
66
authorName string {mustBeTextScalar} = "sync2brain" % Use committer name when packaging from CI
7-
shareFolder {mustBeFolder} = getenv('firmwareSharePath')
87
end
98

109
% Get current project object
1110
projObj = currentProject;
1211

13-
% Copy firmware in local share folder to toolbox to facilitate distribution
14-
if ~isempty(shareFolder)
15-
copyfile(shareFolder,fullfile(projObj.RootFolder,'toolbox/dependencies/firmware/'));
16-
else
17-
warning('Share folder not found. Firmware dependencies will not be packaged in toolbox.');
18-
end
19-
2012
% Remove v from toolboxVersion
2113
options.toolboxVersion = erase(toolboxVersion,"v");
2214

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
function updateFirmwareDeps(shareFolder)
2+
3+
arguments
4+
shareFolder {mustBeFolder} = getenv('firmwareSharePath')
5+
end
6+
7+
projObj = currentProject;
8+
9+
% Copy firmware in local share folder to toolbox to facilitate distribution
10+
if ~isempty(shareFolder)
11+
copyfile(shareFolder,fullfile(projObj.RootFolder,'toolbox/dependencies/firmware/'));
12+
else
13+
error('Share folder not found. Firmware dependencies will not be packaged in toolbox.');
14+
end
15+
16+
end

buildUtilities/updateSGdeps.m

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22

33
projObj = currentProject;
44

5-
assert(exist('speedgoatroot','file'),'Speedgoat dependencies not found installed in local system.');
5+
[isSGinstalled, sgDefaultPath] = bossapi.isSpeedgoatBlocksetInstalled;
66

7-
fprintf('Updating Speedgoat dependencies in local project from %s...\n',speedgoatroot);
7+
assert(isSGinstalled,'Speedgoat dependencies not found installed in local system.');
8+
9+
fprintf('Updating Speedgoat dependencies in local project from %s...\n',sgDefaultPath);
810

911
% Figure out list of Speedgoat tools to copy
10-
sgTools = dir(fullfile(speedgoatroot,'sg_resources'));
12+
sgTools = dir(fullfile(sgDefaultPath,'sg_resources'));
1113
sgTools = sgTools(~[sgTools.isdir]);
1214

1315
% Create dependencies folder in local toolbox
@@ -22,8 +24,9 @@
2224
end
2325

2426
% Copy common Speedgoat functions
25-
copyfile(fullfile(speedgoatroot,'sg_functions','+sg'),fullfile(destFolder,'+sg'));
26-
copyfile(fullfile(speedgoatroot,'sg_functions','+speedgoat'),fullfile(destFolder,'+speedgoat'));
27+
copyfile(fullfile(sgDefaultPath,'speedgoatroot.p'),destFolder);
28+
copyfile(fullfile(sgDefaultPath,'sg_functions','+sg'),fullfile(destFolder,'+sg'));
29+
copyfile(fullfile(sgDefaultPath,'sg_functions','+speedgoat'),fullfile(destFolder,'+speedgoat'));
2730

2831
fprintf('Speedgoat dependencies updated in toolbox.\n');
2932

resources/project/-yj-zgdEElpZjlogbAXxP8XBgk4/D_dPBt9q0E2OY6IbuGPfcwyWnjId.xml

Lines changed: 0 additions & 2 deletions
This file was deleted.

resources/project/-yj-zgdEElpZjlogbAXxP8XBgk4/D_dPBt9q0E2OY6IbuGPfcwyWnjIp.xml

Lines changed: 0 additions & 2 deletions
This file was deleted.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?xml version='1.0' encoding='UTF-8'?>
2+
<Info Ref="toolbox/html" Type="Relative"/>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?xml version='1.0' encoding='UTF-8'?>
2+
<Info location="824f7d17-4701-47e2-be96-1e9afe06c88f" type="Reference"/>

0 commit comments

Comments
 (0)