-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathbuildfile.m
More file actions
71 lines (48 loc) · 1.95 KB
/
Copy pathbuildfile.m
File metadata and controls
71 lines (48 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
function plan = buildfile
plan = buildplan(localfunctions);
plan("checkToolboxes").Dependencies = "check";
% Define a setup task to add paths
plan("setuppaths").Dependencies = "check";
plan.DefaultTasks = "test";
plan("package").Dependencies = "publishDoc";
plan("publishDoc").Dependencies = "test";
plan("test").Dependencies = "check";
plan("test").Dependencies = "checkToolboxes";
end
function setuppathsTask(context)
toolboxPath = fileparts(mfilename('fullpath')); % Get toolbox folder
addpath(genpath(toolboxPath)); % Add all subfolders
disp("Perceive Toolbox paths added.");
end
function checkTask(context)
% Temporarily add buildUtilities to the path (remove it at the end of the function)
oldPath = addpath(fullfile(context.Plan.RootFolder,"buildUtilities"));
raii = onCleanup(@()(path(oldPath)));
codecheckToolbox(context.Plan.RootFolder);
end
function testTask(context)
% Temporarily add buildUtilities to the path (remove it at the end of the function)
oldPath = addpath(fullfile(context.Plan.RootFolder,"buildUtilities"));
raii = onCleanup(@()(path(oldPath)));
testToolbox() %disable here
end
function publishDocTask(context)
% Generate HTML files
% Temporarily add buildUtilities to the path (remove it at the end of the function)
oldPath = addpath(fullfile(context.Plan.RootFolder,"buildUtilities"));
raii = onCleanup(@()(path(oldPath)));
gendocToolbox(context.Plan.RootFolder)
end
function packageTask(context)
% Package the toolbox in an MLTBX, just incrementing build. Note that GitHub action calls packageToolbox directly.
% Temporarily add buildUtilities to the path (remove it at the end of the function)
oldPath = addpath(fullfile(context.Plan.RootFolder,"buildUtilities"));
raii = onCleanup(@()(path(oldPath)));
packageToolbox("build")
end
function checkToolboxesTask(~)
required = "Statistics and Machine Learning Toolbox";
installed = string({ver().Name});
assert(ismember(required, installed), ...
"Required toolbox missing: %s", required);
end