Skip to content

Commit 46a5b8a

Browse files
committed
buildfile: functions named distinct from Task
1 parent cc86060 commit 46a5b8a

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

buildfile.m

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
function plan = buildfile
22
assert(~isMATLABReleaseOlderThan("R2023a"), "MATLAB R2023a or newer is required for this buildfile")
33

4-
plan = buildplan();
4+
plan = buildplan(localfunctions);
55

66
plan.DefaultTasks = "test";
77

@@ -10,12 +10,13 @@
1010
addpath(plan.RootFolder)
1111

1212
if isMATLABReleaseOlderThan("R2023b")
13-
plan("test") = matlab.buildtool.Task(Actions=@legacyTestTask);
13+
plan("test") = matlab.buildtool.Task(Actions=@legacy_test);
1414
else
15-
plan("check") = matlab.buildtool.tasks.CodeIssuesTask(pkg_name, IncludeSubfolders=true);
15+
plan("check") = matlab.buildtool.tasks.CodeIssuesTask(pkg_name, IncludeSubfolders=true, ...
16+
WarningThreshold=0);
17+
1618
plan("test") = matlab.buildtool.tasks.TestTask("test", Strict=false);
17-
% can't use SourceFiles= if "mex" Task was run, even if
18-
% plan("test").DisableIncremental = true;
19+
% can't use SourceFiles= if "mex" Task was run, even if plan("test").DisableIncremental = true;
1920
% this means incremental tests can't be used with MEX files (as of R2024b)
2021

2122
plan("clean") = matlab.buildtool.tasks.CleanTask;
@@ -25,8 +26,6 @@
2526
plan("coverage") = matlab.buildtool.tasks.TestTask(Description="code coverage", Dependencies="clean", SourceFiles="test", Strict=false, CodeCoverageResults="code-coverage.xml");
2627
end
2728

28-
plan("publish") = matlab.buildtool.Task(Description="HTML inline doc generate", Actions=@publishTask);
29-
3029
%% MexTask
3130
bindir = fullfile(plan.RootFolder, pkg_name);
3231
[compiler_opt, linker_opt] = get_compiler_options();
@@ -46,7 +45,7 @@
4645
mex_name = "mex_" + name;
4746
% specifying .Inputs and .Outputs enables incremental builds
4847
% https://www.mathworks.com/help/matlab/matlab_prog/improve-performance-with-incremental-builds.html
49-
plan(mex_name) = matlab.buildtool.Task(Actions=@(context) legacyMexTask(context, compiler_opt, linker_opt));
48+
plan(mex_name) = matlab.buildtool.Task(Actions=@(context) legacy_mex(context, compiler_opt, linker_opt));
5049
plan(mex_name).Inputs = src;
5150
plan(mex_name).Outputs = fullfile(bindir, name + "." + mexext());
5251
mex_deps(end+1) = mex_name; %#ok<AGROW>
@@ -63,13 +62,13 @@
6362
end
6463

6564

66-
function legacyMexTask(context, compiler_opt, linker_opt)
65+
function legacy_mex(context, compiler_opt, linker_opt)
6766
bindir = fileparts(context.Task.Outputs.Path);
6867
mex(context.Task.Inputs.Path, "-outdir", bindir, compiler_opt{:}, linker_opt)
6968
end
7069

7170

72-
function legacyTestTask(context)
71+
function legacy_test(context)
7372
r = runtests(fullfile(context.Plan.RootFolder, "test"), Strict=false);
7473
% Parallel Computing Toolbox takes more time to startup than is worth it for this task
7574

@@ -79,6 +78,7 @@ function legacyTestTask(context)
7978

8079

8180
function publishTask(context)
81+
% publish HTML inline documentation strings to individual HTML files
8282
outdir = fullfile(context.Plan.RootFolder, "docs");
8383

8484
publish_gen_index_html("stdlib", ...

0 commit comments

Comments
 (0)