-
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathbuildfile.m
More file actions
64 lines (46 loc) · 1.49 KB
/
buildfile.m
File metadata and controls
64 lines (46 loc) · 1.49 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
53
54
55
56
57
58
59
60
61
62
63
64
function plan = buildfile
plan = buildplan(localfunctions);
pkgDir = fullfile(plan.RootFolder, '+matmap3d');
test_root = fullfile(plan.RootFolder, 'test');
reportDir = fullfile(plan.RootFolder, 'reports');
if ~isfolder(reportDir)
mkdir(reportDir);
end
if isMATLABReleaseOlderThan('R2023a')
plan('test') = matlab.buildtool.Task(Actions=@(context) legacy_test(context, test_root));
else
plan('test') = matlab.buildtool.tasks.TestTask(test_root, SourceFiles=pkgDir);
end
if ~isMATLABReleaseOlderThan('R2024a')
coverageReport = fullfile(reportDir, 'coverage-report.html');
try
report = matlabtest.plugins.codecoverage.StandaloneReport(coverageReport);
catch
report = coverageReport;
end
plan('coverage') = plan('test').addCodeCoverage(report);
plan('coverage').DisableIncremental = true;
end
end
function legacy_test(~, test_root)
r = runtests(test_root);
assert(~isempty(r), 'No tests were run')
assertSuccess(r)
end
function checkTask(context)
root = context.Plan.RootFolder;
c = codeIssues(root, IncludeSubfolders=true);
if isempty(c.Issues)
fprintf('%d files checked OK with %s under %s\n', numel(c.Files), c.Release, root)
else
disp(c.Issues)
error("Errors found in " + join(c.Issues.Location, newline))
end
end
function publishTask(context)
outdir = fullfile(context.Plan.RootFolder, 'docs');
publish_gen_index_html("matmap3d", ...
"Geographic coordinate tranformation functions for Matlab.", ...
"https://github.com/geospace-code/matmap3d", ...
outdir)
end