Skip to content

Commit a9469fa

Browse files
committed
incremntal test and build for R2025a+
1 parent 155ca83 commit a9469fa

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

buildfile.m

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
%% Self-test setup
1212
plan("clean") = matlab.buildtool.tasks.CleanTask;
1313

14+
1415
cnomex = ~HasTag("exe") & ~HasTag("mex");
1516
if isMATLABReleaseOlderThan("R2024b")
1617
cnomex = cnomex & ~HasTag("symlink");
@@ -35,23 +36,22 @@
3536
plan("test:nojavamex") = matlab.buildtool.Task(Actions=@(context) legacy_test(context, cnojavamex), Dependencies="clean");
3637

3738
else
38-
% can't use SourceFiles= if "mex" Task was run, even if plan("test").DisableIncremental = true;
39-
% this means incremental tests can't be used with MEX files (as of R2024b)
4039
plan("test:exe") = matlab.buildtool.tasks.TestTask("test", Tag="exe", ...
4140
Dependencies="exe", TestResults="TestResults_exe.xml", Strict=false);
4241

4342
plan("test:nomex") = matlab.buildtool.tasks.TestTask("test", ...
44-
Selector=cnomex, ...
45-
Dependencies="clean", TestResults="TestResults_nomex.xml", Strict=false);
43+
Selector=cnomex, SourceFiles="+stdlib/", RunOnlyImpactedTests=true,...
44+
dependencies="clean_mex", TestResults="TestResults_nomex.xml", Strict=false);
4645

4746
plan("test:mex") = matlab.buildtool.tasks.TestTask("test", ...
48-
Selector=cmex, ...
47+
Selector=cmex, SourceFiles=["+stdlib/", "src/"], RunOnlyImpactedTests=true,...
4948
Dependencies="mex", TestResults="TestResults_mex.xml", Strict=false);
5049

5150
plan("test:nojavamex") = matlab.buildtool.tasks.TestTask("test", ...
52-
Selector=cnojavamex, ...
53-
Dependencies="clean", TestResults="TestResults_nojavamex.xml", Strict=false);
51+
Selector=cnojavamex, SourceFiles="+stdlib/", RunOnlyImpactedTests=true,...
52+
Dependencies="clean_mex", TestResults="TestResults_nojavamex.xml", Strict=false);
5453

54+
plan("clean_mex") = matlab.buildtool.Task(Actions=@clean_mex);
5555
end
5656

5757
td = plan.RootFolder + "/test";
@@ -107,6 +107,11 @@
107107
end
108108

109109

110+
function clean_mex(context)
111+
run(context.Plan, "clean", {"mex"});
112+
end
113+
114+
110115
function legacy_mex(context, compiler_opt, linker_opt)
111116
bindir = fileparts(context.Task.Outputs.Path);
112117
mex(context.Task.Inputs.Path, "-outdir", bindir, compiler_opt{:}, linker_opt)

0 commit comments

Comments
 (0)