11function plan = buildfile
22assert(~isMATLABReleaseOlderThan(" R2023a" ), " MATLAB R2023a or newer is required for this buildfile" )
33
4- plan = buildplan();
4+ plan = buildplan(localfunctions );
55
66plan.DefaultTasks = " test" ;
77
1010addpath(plan .RootFolder )
1111
1212if isMATLABReleaseOlderThan(" R2023b" )
13- plan(" test" ) = matlab .buildtool .Task(Actions = @legacyTestTask );
13+ plan(" test" ) = matlab .buildtool .Task(Actions = @legacy_test );
1414else
15- plan(" check" ) = matlab .buildtool .tasks .CodeIssuesTask(pkg_name , IncludeSubfolders= true );
15+ plan(" check" ) = matlab .buildtool .tasks .CodeIssuesTask(pkg_name , IncludeSubfolders= true , ...
16+ WarningThreshold= 0 );
17+
1618 plan(" test" ) = matlab .buildtool .tasks .TestTask(" test" , Strict= false );
17- % can't use SourceFiles= if "mex" Task was run, even if
18- % plan("test").DisableIncremental = true;
19+ % can't use SourceFiles= if "mex" Task was run, even if plan("test").DisableIncremental = true;
1920 % this means incremental tests can't be used with MEX files (as of R2024b)
2021
2122 plan(" clean" ) = matlab .buildtool .tasks .CleanTask ;
2526 plan(" coverage" ) = matlab .buildtool .tasks .TestTask(Description = " code coverage" , Dependencies= " clean" , SourceFiles= " test" , Strict= false , CodeCoverageResults= " code-coverage.xml" );
2627end
2728
28- plan(" publish" ) = matlab .buildtool .Task(Description = " HTML inline doc generate" , Actions= @publishTask );
29-
3029%% MexTask
3130bindir = fullfile(plan .RootFolder , pkg_name );
3231[compiler_opt , linker_opt ] = get_compiler_options();
4645 mex_name = " mex_" + name ;
4746 % specifying .Inputs and .Outputs enables incremental builds
4847 % https://www.mathworks.com/help/matlab/matlab_prog/improve-performance-with-incremental-builds.html
49- plan(mex_name ) = matlab .buildtool .Task(Actions = @(context ) legacyMexTask (context , compiler_opt , linker_opt ));
48+ plan(mex_name ) = matlab .buildtool .Task(Actions = @(context ) legacy_mex (context , compiler_opt , linker_opt ));
5049 plan(mex_name ).Inputs = src ;
5150 plan(mex_name ).Outputs = fullfile(bindir , name + " ." + mexext());
5251 mex_deps(end + 1 ) = mex_name ; % #ok<AGROW>
6362end
6463
6564
66- function legacyMexTask (context , compiler_opt , linker_opt )
65+ function legacy_mex (context , compiler_opt , linker_opt )
6766bindir = fileparts(context .Task .Outputs .Path );
6867mex(context .Task .Inputs .Path , " -outdir" , bindir , compiler_opt{: }, linker_opt )
6968end
7069
7170
72- function legacyTestTask (context )
71+ function legacy_test (context )
7372r = runtests(fullfile(context .Plan .RootFolder , " test" ), Strict= false );
7473% Parallel Computing Toolbox takes more time to startup than is worth it for this task
7574
@@ -79,6 +78,7 @@ function legacyTestTask(context)
7978
8079
8180function publishTask(context )
81+ % publish HTML inline documentation strings to individual HTML files
8282outdir = fullfile(context .Plan .RootFolder , " docs" );
8383
8484publish_gen_index_html(" stdlib" , ...
0 commit comments