matlab.buildtool.TaskGroup Class
Namespace: matlab.buildtool
Superclasses: matlab.buildtool.Task
Description
The matlab.buildtool.TaskGroup
class provides a way to group tasks that
perform similar actions into a single unit of work in the build tool. For example, you can
create a TaskGroup
object to group all the tasks in your project that build
binary MEX files. Then, you can run all these tasks by running the task group. For more
information about task groups, see Create Groups of Similar Tasks.
Creation
You can create a task group by adding a task whose name contains a colon to a build plan.
For example, this code adds a task named "mygroup:task1"
to the plan.
Because the task name includes a colon, the assignment also creates a task group named
"mygroup"
in the plan. In this example, the "mygroup"
task group contains a single task named "mygroup:task1"
.
import matlab.buildtool.Task plan = buildplan; plan("mygroup:task1") = Task;
To add a task to an existing task group, start the task name with the task group name
followed by a colon. For example, add the "mygroup:task2"
task to the
"mygroup"
task group.
plan("mygroup:task2") = Task;
For another example of creating a task group by adding tasks to a plan, see Build MEX Files Using Task Group.
Alternatively, you can first group your tasks and then add the task group to the plan. To
create a task group without directly adding its tasks to the plan, create a
TaskGroup
instance using the constructor syntaxes in this section.
Description
group = matlab.buildtool.TaskGroup(
creates a task group from the specified tasks. The constructor names the tasks in the
group as tasks
)"task1"
, "task2"
, …,
"taskN"
.
group = matlab.buildtool.TaskGroup(
specifies options using one or more name-value arguments. For example, tasks
,Name=Value
)group =
matlab.buildtool.TaskGroup([mexTask1 mexTask2],Description="Build MEX files")
creates a group of two tasks with the specified description.
Input Arguments
Properties
Examples
Tips
Operating on a task group affects all the tasks in the group. For example:
If you run or skip a task group, the build tool runs or skips all the tasks in the group.
If you delete the outputs of a task group using a
matlab.buildtool.tasks.CleanTask
instance, theCleanTask
instance deletes the outputs of all the tasks in the group.If you add a dependency to a task group, all the tasks in the group observe that dependency.
You can create nested task groups by including more than one colon in a task name. For example, this code creates the
"g1"
task group that contains the"t1"
task as well as the"g2"
task group. (The"g2"
task group contains the"t2"
and"t3"
tasks.)import matlab.buildtool.Task plan = buildplan; plan("g1:t1") = Task; plan("g1:g2:t2") = Task; plan("g1:g2:t3") = Task;
Version History
Introduced in R2024b