-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbuildfile.m
More file actions
52 lines (36 loc) · 1.34 KB
/
Copy pathbuildfile.m
File metadata and controls
52 lines (36 loc) · 1.34 KB
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
function plan = buildfile
import matlab.buildtool.Task
import matlab.buildtool.tasks.CodeIssuesTask
import matlab.buildtool.tasks.PcodeTask
% Add the source folder to the path
addpath("source");
% Create a plan
plan = buildplan(localfunctions);
% Add a task to run tests
plan("test") = matlab.buildtool.tasks.TestTask("tests");
plan("check") = CodeIssuesTask;
plan("pcode") = PcodeTask("source","source");
plan("coverage") = Task( ...
Description = "Generate decision coverage report", ...
Actions = @decisionCoverageTask);
% plan("deploy").Dependencies = ["check" "test"];
% Make the "test" task the default task in the plan
plan.DefaultTasks = "check";
end
function deployTask(~)
% Deploy standalone application
compiler.build.standaloneApplication('source/timestable.mlapp');
end
function decisionCoverageTask(~)
import matlab.unittest.TestSuite
import matlab.unittest.plugins.CodeCoveragePlugin
import matlab.unittest.plugins.codecoverage.CoberturaFormat
suite = TestSuite.fromFolder("tests", "IncludingSubfolders", true);
runner = matlab.unittest.TestRunner.withTextOutput;
plugin = CodeCoveragePlugin.forFolder("source", ...
"IncludingSubfolders", true, ...
"Producing", CoberturaFormat("coverageReport.xml"), ...
"MetricLevel","decision");
runner.addPlugin(plugin);
runner.run(suite);
end