|
1 | 1 | function plan = buildfile |
2 | 2 | import matlab.unittest.selectors.HasTag |
| 3 | +import matlab.buildtool.tasks.TestTask |
| 4 | +import matlabtest.plugins.codecoverage.StandaloneReport |
| 5 | + |
3 | 6 | assert(~isMATLABReleaseOlderThan("R2022b"), "MATLAB R2022b or newer is required for this buildfile") |
4 | 7 |
|
5 | 8 | plan = buildplan(localfunctions); |
|
27 | 30 | if isMATLABReleaseOlderThan("R2023b") |
28 | 31 | plan("test_exe") = matlab.buildtool.Task(Actions=@(context) legacy_test(context, HasTag("exe")), Dependencies="exe"); |
29 | 32 | elseif isMATLABReleaseOlderThan("R2024b") |
30 | | - plan("test_exe") = matlab.buildtool.tasks.TestTask(test_root, Tag="exe", Dependencies="exe"); |
| 33 | + plan("test_exe") = TestTask(test_root, Tag="exe", Dependencies="exe"); |
31 | 34 | end |
32 | 35 |
|
33 | 36 | if isMATLABReleaseOlderThan("R2024b") |
|
39 | 42 | elseif isMATLABReleaseOlderThan("R2025a") |
40 | 43 | % Matlab == R2024b |
41 | 44 | plan("test:java") = matlab.buildtool.Task(Actions=@(context) legacy_test(context, cjava)); |
42 | | - plan("test:exe") = matlab.buildtool.tasks.TestTask(test_root, Tag="exe", Dependencies="exe"); |
| 45 | + plan("test:exe") = TestTask(test_root, Tag="exe", Dependencies="exe"); |
43 | 46 | plan("test:nomex") = matlab.buildtool.Task(Actions=@(context) legacy_test(context, cnomex), Dependencies="clean"); |
44 | 47 | plan("test:mex") = matlab.buildtool.Task(Actions=@(context) legacy_test(context, cmex), Dependencies="mex"); |
45 | 48 |
|
46 | 49 | else |
47 | 50 | % Matlab >= R2025a |
48 | | - plan("test:exe") = matlab.buildtool.tasks.TestTask(test_root, Tag="exe", Description="test subprocess",... |
| 51 | + plan("test:exe") = TestTask(test_root, Tag="exe", Description="test subprocess",... |
49 | 52 | SourceFiles=[pkg_root, test_root + ["/*.cpp", "/*.c", "/*.f90"]], ... |
50 | 53 | RunOnlyImpactedTests=true,... |
51 | 54 | Dependencies="exe", TestResults="TestResults_exe.xml", Strict=true); |
52 | 55 |
|
53 | | - plan("test:nomex") = matlab.buildtool.tasks.TestTask(test_root, Description="Test non-MEX targets",... |
| 56 | + plan("test:nomex") = TestTask(test_root, Description="Test non-MEX targets",... |
54 | 57 | Selector=cnomex, ... |
55 | 58 | SourceFiles=pkg_root, RunOnlyImpactedTests=true,... |
56 | 59 | dependencies="clean_mex", TestResults="TestResults_nomex.xml", Strict=true); |
57 | 60 |
|
58 | | - plan("test:mex") = matlab.buildtool.tasks.TestTask(test_root, Description="Test mex targts",... |
| 61 | + plan("test:mex") = TestTask(test_root, Description="Test mex targts",... |
59 | 62 | Selector=cmex, ... |
60 | 63 | SourceFiles=[pkg_root, plan.RootFolder + "/src"], RunOnlyImpactedTests=true,... |
61 | 64 | Dependencies="mex", TestResults="TestResults_mex.xml", Strict=true); |
62 | 65 |
|
63 | | - plan("test:java") = matlab.buildtool.tasks.TestTask(test_root, Description="test Java targets", ... |
| 66 | + plan("test:java") = TestTask(test_root, Description="test Java targets", ... |
64 | 67 | Selector=cjava, ... |
65 | 68 | SourceFiles=pkg_root, RunOnlyImpactedTests=true,... |
66 | 69 | TestResults="TestResults_java.xml", Strict=true); |
67 | 70 |
|
68 | | - plan("test:python") = matlab.buildtool.tasks.TestTask(test_root, Description="test Python targets", ... |
| 71 | + plan("test:python") = TestTask(test_root, Description="test Python targets", ... |
69 | 72 | Tag="python", ... |
70 | 73 | SourceFiles=pkg_root, RunOnlyImpactedTests=true,... |
71 | 74 | TestResults="TestResults_python.xml", Strict=true); |
72 | | - |
73 | | - plan("coverage") = matlab.buildtool.tasks.TestTask(test_root, ... |
| 75 | + |
| 76 | + plan("coverage") = TestTask(test_root, ... |
74 | 77 | Description="code coverage", ... |
75 | | - Dependencies=["clean", "exe"], ... |
| 78 | + Dependencies=["clean_mex", "exe"], ... |
76 | 79 | SourceFiles=pkg_root, ... |
77 | 80 | Selector=cnomex | HasTag("java") | HasTag("exe") | HasTag("python"), ... |
78 | | - Strict=false, ... |
79 | | - CodeCoverageResults=["code-coverage.xml", "code-coverage.html"]); |
| 81 | + Strict=false).addCodeCoverage(StandaloneReport("coverage-report.html")); |
80 | 82 |
|
81 | 83 | plan("clean_mex") = matlab.buildtool.Task(Actions=@clean_mex, Description="Clean only MEX files to enable incremental tests"); |
82 | 84 | end |
|
0 commit comments