|
4 | 4 |
|
5 | 5 | plan = buildplan(localfunctions); |
6 | 6 |
|
7 | | -pkg_name = "+stdlib"; |
8 | | - |
9 | 7 | if isMATLABReleaseOlderThan("R2023b") |
10 | 8 | plan("clean") =matlab.buildtool.Task(); |
11 | 9 | else |
|
23 | 21 |
|
24 | 22 | cjava = HasTag("java") & ~HasTag("exe"); |
25 | 23 |
|
| 24 | +pkg_root = fullfile(plan.RootFolder, "+stdlib"); |
| 25 | +test_root = fullfile(plan.RootFolder, "test"); |
| 26 | + |
26 | 27 | if isMATLABReleaseOlderThan("R2023b") |
27 | 28 | plan("test_exe") = matlab.buildtool.Task(Actions=@(context) legacy_test(context, HasTag("exe")), Dependencies="exe"); |
28 | 29 | elseif isMATLABReleaseOlderThan("R2024b") |
29 | | - plan("test_exe") = matlab.buildtool.tasks.TestTask("test", Tag="exe", Dependencies="exe"); |
| 30 | + plan("test_exe") = matlab.buildtool.tasks.TestTask(test_root, Tag="exe", Dependencies="exe"); |
30 | 31 | end |
31 | 32 |
|
32 | 33 | if isMATLABReleaseOlderThan("R2024b") |
|
38 | 39 | elseif isMATLABReleaseOlderThan("R2025a") |
39 | 40 |
|
40 | 41 | plan("test:java") = matlab.buildtool.Task(Actions=@(context) legacy_test(context, cjava)); |
41 | | - plan("test:exe") = matlab.buildtool.tasks.TestTask("test", Tag="exe", Dependencies="exe"); |
| 42 | + plan("test:exe") = matlab.buildtool.tasks.TestTask(test_root, Tag="exe", Dependencies="exe"); |
42 | 43 | plan("test:nomex") = matlab.buildtool.Task(Actions=@(context) legacy_test(context, cnomex), Dependencies="clean"); |
43 | 44 | plan("test:mex") = matlab.buildtool.Task(Actions=@(context) legacy_test(context, cmex), Dependencies="mex"); |
44 | 45 |
|
45 | 46 | else |
46 | | - plan("test:exe") = matlab.buildtool.tasks.TestTask("test", Tag="exe", Description="test subprocess",... |
47 | | - SourceFiles=["+stdlib/", "test/*.cpp", "test/*.c", "test/*.f90"], ... |
| 47 | + plan("test:exe") = matlab.buildtool.tasks.TestTask(test_root, Tag="exe", Description="test subprocess",... |
| 48 | + SourceFiles=[pkg_root, test_root + ["/*.cpp", "/*.c", "/*.f90"]], ... |
48 | 49 | RunOnlyImpactedTests=true,... |
49 | 50 | Dependencies="exe", TestResults="TestResults_exe.xml", Strict=true); |
50 | 51 |
|
51 | | - plan("test:nomex") = matlab.buildtool.tasks.TestTask("test", Description="Test non-MEX targets",... |
52 | | - Selector=cnomex, SourceFiles="+stdlib/", RunOnlyImpactedTests=true,... |
| 52 | + plan("test:nomex") = matlab.buildtool.tasks.TestTask(test_root, Description="Test non-MEX targets",... |
| 53 | + Selector=cnomex, ... |
| 54 | + SourceFiles=pkg_root, RunOnlyImpactedTests=true,... |
53 | 55 | dependencies="clean_mex", TestResults="TestResults_nomex.xml", Strict=true); |
54 | 56 |
|
55 | | - plan("test:mex") = matlab.buildtool.tasks.TestTask("test", Description="Test mex targts",... |
56 | | - Selector=cmex, SourceFiles=["+stdlib/", "src/"], RunOnlyImpactedTests=true,... |
| 57 | + plan("test:mex") = matlab.buildtool.tasks.TestTask(test_root, Description="Test mex targts",... |
| 58 | + Selector=cmex, ... |
| 59 | + SourceFiles=[pkg_root, plan.RootFolder + "src/"], RunOnlyImpactedTests=true,... |
57 | 60 | Dependencies="mex", TestResults="TestResults_mex.xml", Strict=true); |
58 | 61 |
|
59 | | - plan("test:java") = matlab.buildtool.tasks.TestTask("test", Description="test Java targets", ... |
60 | | - Selector=cjava, SourceFiles="+stdlib/", RunOnlyImpactedTests=true,... |
| 62 | + plan("test:java") = matlab.buildtool.tasks.TestTask(test_root, Description="test Java targets", ... |
| 63 | + Selector=cjava, ... |
| 64 | + SourceFiles=pkg_root, RunOnlyImpactedTests=true,... |
61 | 65 | TestResults="TestResults_java.xml", Strict=true); |
62 | 66 |
|
63 | | - plan("test:python") = matlab.buildtool.tasks.TestTask("test", Description="test Python targets", ... |
64 | | - Tag="python", SourceFiles="+stdlib/", RunOnlyImpactedTests=true,... |
| 67 | + plan("test:python") = matlab.buildtool.tasks.TestTask(test_root, Description="test Python targets", ... |
| 68 | + Tag="python", ... |
| 69 | + SourceFiles=pkg_root, RunOnlyImpactedTests=true,... |
65 | 70 | TestResults="TestResults_python.xml", Strict=true); |
66 | 71 |
|
67 | | - plan("coverage") = matlab.buildtool.tasks.TestTask(Description="code coverage", ... |
68 | | - Dependencies=["clean", "exe"], SourceFiles="+stdlib/", ... |
| 72 | + plan("coverage") = matlab.buildtool.tasks.TestTask(test_root, ... |
| 73 | + Description="code coverage", ... |
| 74 | + Dependencies=["clean", "exe"], ... |
| 75 | + SourceFiles=pkg_root, ... |
69 | 76 | Selector=cnomex | HasTag("java") | HasTag("exe") | HasTag("python"), ... |
70 | 77 | Strict=false, ... |
71 | 78 | CodeCoverageResults=["code-coverage.xml", "code-coverage.html"]); |
|
75 | 82 |
|
76 | 83 | if isMATLABReleaseOlderThan("R2023a"), return, end |
77 | 84 |
|
78 | | -td = fullfile(plan.RootFolder, 'test'); |
79 | | - |
80 | 85 | srcs = ["stdout_stderr_c.c", "stdin_cpp.cpp", "printenv.cpp", "sleep.cpp"]; |
81 | 86 | exes = ["stdout_stderr_c.exe", "stdin_cpp.exe", "printenv.exe", "sleep.exe"]; |
82 | 87 | if ~isempty(get_compiler("fortran")) |
83 | 88 | srcs = [srcs, "stdout_stderr_fortran.f90", "stdin_fortran.f90"]; |
84 | 89 | exes = [exes, "stdout_stderr_fortran.exe", "stdin_fortran.exe"]; |
85 | 90 | end |
86 | 91 |
|
87 | | -srcs = fullfile(td, srcs); |
88 | | -exes = fullfile(td, exes); |
| 92 | +srcs = fullfile(test_root, srcs); |
| 93 | +exes = fullfile(test_root, exes); |
89 | 94 |
|
90 | 95 | plan("exe") = matlab.buildtool.Task(Inputs=srcs, Outputs=exes, Actions=@build_exe, ... |
91 | 96 | Description="build test exe's for test subprocess"); |
92 | 97 |
|
93 | 98 | if ~isMATLABReleaseOlderThan("R2024a") |
94 | | - plan("check") = matlab.buildtool.tasks.CodeIssuesTask(pkg_name, IncludeSubfolders=true, ... |
| 99 | + plan("check") = matlab.buildtool.tasks.CodeIssuesTask(plan.RootFolder, ... |
| 100 | + IncludeSubfolders=true, ... |
95 | 101 | WarningThreshold=0, Results="CodeIssues.sarif"); |
96 | 102 | end |
97 | 103 |
|
98 | 104 | %% MexTask |
99 | | -bindir = fullfile(plan.RootFolder, pkg_name); |
100 | 105 | [compiler_opt, linker_opt] = get_compiler_options(); |
101 | 106 |
|
102 | 107 | use_legacy_mex = isMATLABReleaseOlderThan("R2024b"); |
|
115 | 120 | if use_legacy_mex |
116 | 121 | mex_name = "mex_" + name; |
117 | 122 | plan(mex_name) = matlab.buildtool.Task(Inputs=src, ... |
118 | | - Outputs=fullfile(bindir, name + "." + mexext()), ... |
| 123 | + Outputs=fullfile(pkg_root, name + "." + mexext()), ... |
119 | 124 | Actions=@(context) legacy_mex(context, compiler_opt, linker_opt), ... |
120 | 125 | Description="Legacy MEX"); |
121 | 126 | mex_deps(end+1) = mex_name; %#ok<AGROW> |
122 | 127 | else |
123 | | - plan("mex:" + name) = matlab.buildtool.tasks.MexTask(src, bindir, ... |
| 128 | + plan("mex:" + name) = matlab.buildtool.tasks.MexTask(src, pkg_root, ... |
124 | 129 | Description="Build MEX target " + name, ... |
125 | 130 | Options=[compiler_opt, linker_opt]); |
126 | 131 | end |
|
0 commit comments