-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathbuildfile.m
60 lines (40 loc) · 1.45 KB
/
buildfile.m
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
function plan = buildfile
% Perform build, test, and package actions
% Copyright 2025 The MathWorks, Inc.
% These tasks require R2023b or later
if isMATLABReleaseOlderThan("R2023b")
error("R2023b or later is required for build tools.")
end
% Prepare the build plan
plan = buildplan(localfunctions);
% Clean task
% plan("clean") = matlab.buildtool.tasks.CleanTask;
% Code issues task
plan("check") = matlab.buildtool.tasks.CodeIssuesTask;
plan("check").SourceFiles = fullfile(plan.RootFolder,"widgets");
plan("check").WarningThreshold = 0;
% Test task
plan("test") = matlab.buildtool.tasks.TestTask;
plan("test").SourceFiles = fullfile(plan.RootFolder,"test");
% Package task
plan("archive").Dependencies = ["check","test"];
% Set default tasks
plan.DefaultTasks = ["check","test"];
end %function
function archiveTask(context)
% Package the mltbx file
% Get root
rootFolder = context.Plan.RootFolder;
% Increment the last part of the version number in wtDeployVersion.txt
% (Other changes require commenting this out and making manual edits)
wt.deploy.incrementVersionNumber();
% Increment the last part of the version number in version.txt
toolboxVersion = wt.deploy.readVersionNumber();
% Read in the package options
opts = wt.deploy.getPackageOptions(rootFolder, toolboxVersion);
% Perform the packaging
matlab.addons.toolbox.packageToolbox(opts);
% Open the release folder
releaseFolder = fullfile(rootFolder,"release");
winopen(releaseFolder);
end %function