1616 cnomex = cnomex & ~HasTag(" windows" );
1717end
1818
19- % cmex = HasTag("mex");
20-
21- cjava = HasTag(" java" ) & ~HasTag(" exe" );
22-
2319pkg_root = fullfile(plan .RootFolder , " +stdlib" );
2420test_root = fullfile(plan .RootFolder , " test" );
2521
2622if isMATLABReleaseOlderThan(" R2023b" )
27- plan(" test_exe" ) = matlab .buildtool .Task(Actions = @(context ) legacy_test(context , HasTag(" exe" )), Dependencies= " exe" );
28- elseif isMATLABReleaseOlderThan(" R2024b" )
29- plan(" test_exe" ) = matlab .buildtool .tasks .TestTask(test_root , Tag= " exe" , Dependencies= " exe" );
30- end
23+ % Matlab == R2023a
24+ plan(" test_exe" ) = matlab .buildtool .Task(Actions = @() test_main(HasTag(" exe" )), Dependencies= " exe" );
3125
32- if isMATLABReleaseOlderThan(" R2024b" )
26+ elseif isMATLABReleaseOlderThan(" R2024b" )
3327
34- plan(" test_java" ) = matlab .buildtool .Task(Actions = @(context ) legacy_test(context , cjava ));
35- plan(" test_main" ) = matlab .buildtool .Task(Actions = @(context ) legacy_test(context , cnomex ));
28+ plan(" test_java" ) = matlab .buildtool .Task(Actions = @() test_main(cjava ));
29+ plan(" test_main" ) = matlab .buildtool .Task(Actions = @(context ) test_main(context , cnomex ));
30+ plan(" test_exe" ) = matlab .buildtool .tasks .TestTask(test_root , Tag= " exe" , Dependencies= " exe" );
3631
3732elseif isMATLABReleaseOlderThan(" R2025a" )
3833 % Matlab == R2024b
39- plan(" test:java" ) = matlab .buildtool .Task(Actions = @(context ) legacy_test(context , cjava ));
4034 plan(" test:exe" ) = matlab .buildtool .tasks .TestTask(test_root , Tag= " exe" , Dependencies= " exe" );
41- plan(" test:main" ) = matlab .buildtool .Task(Actions = @(context ) legacy_test(context , cnomex ));
42- % plan("test:mex") = matlab.buildtool.Task(Actions=@(context) legacy_test(context, cmex), Dependencies="mex");
35+ plan(" test:main" ) = matlab .buildtool .Task(Actions = @(context ) test_main(context , cnomex ));
4336
4437else
4538 % Matlab >= R2025a
5346 SourceFiles= pkg_root , RunOnlyImpactedTests= true ,...
5447 TestResults= " TestResults_nomex.xml" , Strict= true );
5548
56- % plan("test:mex") = matlab.buildtool.tasks.TestTask(test_root, Description="Test mex targts",...
57- % Selector=cmex, ...
58- % SourceFiles=[pkg_root, plan.RootFolder + "/src"], RunOnlyImpactedTests=true,...
59- % Dependencies="mex", TestResults="TestResults_mex.xml", Strict=true);
49+ end
6050
61- plan(" test:java" ) = matlab .buildtool .tasks .TestTask(test_root , Description= " test Java targets" , ...
62- Selector= cjava , ...
63- SourceFiles= pkg_root , RunOnlyImpactedTests= true ,...
64- TestResults= " TestResults_java.xml" , Strict= true );
51+
52+ if ~isMATLABReleaseOlderThan(' R2024b' )
53+
54+ plan(" test:python" ) = matlab .buildtool .tasks .TestTask(...
55+ test_root , Description= " test Python targets" , ...
56+ Tag = " python" , ...
57+ TestResults= " TestResults_java.xml" , Strict= true );
58+
59+ plan(" test:java" ) = matlab .buildtool .tasks .TestTask(...
60+ test_root , Description= " test Java targets" , ...
61+ Tag = " java" , ...
62+ TestResults= " TestResults_java.xml" , Strict= true );
63+
64+ plan(" test:java_exe" ) = matlab .buildtool .tasks .TestTask(...
65+ test_root , Description= " test Java exe targets" , ...
66+ Tag = " java_exe" , ...
67+ TestResults= " TestResults_java_exe.xml" , Strict= true );
6568
6669 addons = matlab .addons .installedAddons ;
6770 if contains(addons .Name , " Matlab Test" )
6871 plan(" coverage" ) = matlab .buildtool .tasks .TestTask(test_root , ...
6972 Description= " code coverage" , ...
7073 Dependencies= " exe" , ...
7174 SourceFiles= pkg_root , ...
72- Selector= cnomex | HasTag(" java" ) | HasTag(" exe" ) | HasTag(" python" ), ...
7375 Strict= false ).addCodeCoverage(matlabtest .plugins .codecoverage .StandaloneReport(" coverage-report.html" ));
7476 end
7577
76- % plan("clean_mex") = matlab.buildtool.Task(Actions=@clean_mex, Description="Clean only MEX files to enable incremental tests");
7778end
7879
7980if isMATLABReleaseOlderThan(" R2023a" ), return , end
8081
8182srcs = [" stdout_stderr_c.c" , " stdin_cpp.cpp" , " printenv.cpp" , " sleep.cpp" ];
82- exes = [" stdout_stderr_c.exe" , " stdin_cpp.exe" , " printenv.exe" , " sleep.exe" ];
8383if ~isempty(get_compiler(" fortran" ))
8484 srcs = [srcs , " stdout_stderr_fortran.f90" , " stdin_fortran.f90" ];
85- exes = [exes , " stdout_stderr_fortran.exe" , " stdin_fortran.exe" ];
8685end
86+ [~ , exes ] = fileparts(srcs );
87+ exes = exes + " .exe" ;
8788
8889srcs = fullfile(test_root , srcs );
8990exes = fullfile(test_root , exes );
9091
9192plan(" exe" ) = matlab .buildtool .Task(Inputs = srcs , Outputs= exes , Actions= @build_exe , ...
92- Description= " build test exe's for test subprocess " );
93+ Description= " build demo executables for testing java_run " );
9394
9495if ~isMATLABReleaseOlderThan(" R2024a" )
9596 plan(" check" ) = matlab .buildtool .tasks .CodeIssuesTask(plan .RootFolder , ...
9697 IncludeSubfolders= true , ...
9798 WarningThreshold= 0 , Results= " CodeIssues.sarif" );
9899end
99100
100-
101- %% MexTask
102- if ~isMATLABReleaseOlderThan(" R2024b" )
103- % for s = get_mex_sources()
104- % src = s{1};
105- % [~, name] = fileparts(src(1));
106- %
107- % % name of MEX target function is name of first source file
108- % plan("mex:" + name) = matlab.buildtool.tasks.MexTask(src, pkg_root, ...
109- % Description="Build MEX target " + name, ...
110- % Options=get_compiler_options());
111- % end
112- end
113-
114- end
115-
116-
117- % function clean_mex(context)
118- % run(context.Plan, "clean", {"mex"});
119- % end
120-
121-
122- function legacy_test(context , sel )
123- import matlab .unittest .TestSuite
124-
125- suite = TestSuite .fromFolder(fullfile(context .Plan .RootFolder , ' test' ));
126- suite = suite .selectIf(sel );
127-
128- runner = testrunner();
129-
130- r = run(runner , suite );
131-
132- assert(~isempty(r ), " No tests were run" )
133- assertSuccess(r )
134101end
135102
136103
@@ -143,27 +110,3 @@ function publishTask(context)
143110 " https://github.com/geospace-code/matlab-stdlib" , ...
144111 outdir )
145112end
146-
147-
148- function srcs = get_mex_sources(build_all )
149- arguments (Input )
150- build_all (1 ,1 ) logical = false
151- end
152- arguments (Output )
153- srcs cell
154- end
155-
156- srcs = {
157- % "src/remove.cpp", ...
158- % ["src/normalize.cpp", "src/normalize_fs.cpp", "src/pure.cpp"], ...
159- % "src/set_permissions.cpp"
160- };
161-
162- if ~stdlib .has_python() || build_all
163- srcs{end + 1 } = " src/is_char_device.cpp" ;
164- srcs{end + 1 } = [" src/is_admin.cpp" , " src/admin_fs.cpp" ];
165- % srcs{end+1} = "src/disk_available.cpp";
166- % srcs{end+1} = "src/disk_capacity.cpp";
167- end
168-
169- end
0 commit comments