Skip to content

Commit 46c8b6f

Browse files
committed
buildfile: also work without Matlab Test robustly
1 parent 84f8111 commit 46c8b6f

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

buildfile.m

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,18 @@
6363
test_root, Description="test Java exe targets", ...
6464
Tag = "java_exe", Dependencies="exe", Strict=true);
6565

66+
coverageReport = fullfile(reportDir, 'coverage-report.html');
67+
if isempty(license('inuse', 'MATLAB_Test'))
68+
cvg = coverageReport;
69+
else
70+
cvg = @() matlabtest.plugins.codecoverage.StandaloneReport(coverageReport);
71+
end
6672

67-
if ~isempty(license('inuse', 'MATLAB_Test'))
68-
plan("coverage") = matlab.buildtool.tasks.TestTask(test_root, ...
73+
plan("coverage") = matlab.buildtool.tasks.TestTask(test_root, ...
6974
Description="Run code coverage", ...
7075
Dependencies="exe", ...
7176
SourceFiles=pkg_root, ...
72-
Strict=false).addCodeCoverage(...
73-
matlabtest.plugins.codecoverage.StandaloneReport(reportDir + "/coverage-report.html"));
74-
end
75-
77+
Strict=false).addCodeCoverage(cvg());
7678
end
7779

7880
srcs = ["stdout_stderr_c.c", "stdin_cpp.cpp", "printenv.cpp", "sleep.cpp"];

0 commit comments

Comments
 (0)