11function plan = buildfile
22import matlab .buildtool .Task
3- import matlab .buildtool .tasks .CodeIssuesTask
4- import matlab .buildtool .tasks .TestTask
5- import matlab .unittest .Verbosity
3+ import matlab .buildtool .tasks .*
64
75% Create a plan with no tasks
86plan = buildplan ;
97
108% Add a task to identify and export the code issues
11- plan(" check" ) = CodeIssuesTask([" toolbox" , " tests" ],...
12- WarningThreshold= 0 ,...
9+ plan(" check" ) = CodeIssuesTask([" toolbox" , " tests" ], ...
10+ WarningThreshold= 0 , ...
1311 Results= " code-issues/results.sarif" );
1412
15- plan(" test" ) = Task(...
16- " Description" ," Build toolbox dependencies with vcpkg" ,...
17- " Inputs" ,[" toolbox" , " tests/vcpkg.json" ],...
18- " Outputs" ,[fullfile(" work" ,vcpkg .getHostTriplet), fullfile(" work" ,vcpkg .getTargetTriplet)],...
19- Actions = {@(~) vcpkg .buildVcpkgDeps(' tests' ,' --x-install-root=../work' )});
13+ plan(" unit" ) = TestTask( " tests" , ...
14+ Description= " Run MATLAB unit tests" , ...
15+ SourceFiles= " toolbox" , ...
16+ TestResults= " testResults.xml" );
17+
18+ plan(" integration" ) = Task( ...
19+ Description= " Build sample toolbox dependencies with vcpkg" , ...
20+ Inputs= [" toolbox" , " tests/vcpkg.json" ], ...
21+ Outputs= [fullfile(" work" , vcpkg .getHostTriplet), fullfile(" work" , vcpkg .getTargetTriplet)], ...
22+ Actions= {@(~) vcpkg .buildVcpkgDeps(' tests' , ' --x-install-root=../work' )});
23+
24+ plan(" test" ) = Task( ...
25+ Description= " Run all tests" , ...
26+ Dependencies= [" unit" " integration" ]);
2027
2128% Package toolbox
22- plan(" package" ) = Task(...
23- Description = " Package toolbox" , ...
24- Dependencies = [" check" " test" ], ...
25- Actions = {@(~,toolboxVersion ) packageToolbox(erase(toolboxVersion ," v" ))});
29+ plan(" package" ) = Task( ...
30+ Description= " Package toolbox" , ...
31+ Dependencies= [" check" " test" ], ...
32+ Actions= {@(~, toolboxVersion ) packageToolbox(erase(toolboxVersion , " v" ))});
2633
27- % Make the " test" task the default task in the plan
34+ % Make check and test the default tasks in the plan
2835plan.DefaultTasks = [" check" " test" ];
2936
3037end
0 commit comments