The macro is a wrapper method for calling tasks that support all Team Build login options; it handles all login option processing, as well as, all task-specific processing needs. The macro greatly reduces the volume of code needed to support all of the login attributes and options for a Team Build task.
The macro supports Team Build Attributes, as well as, its own macro specific attributes. Click on a link for more information on the common attributes.
The following table describes the macro specific attributes for the macro:
| Macro Specific Attributes | ||
| Attribute | Description | Required |
| task | The name of the Team Build task to invoke. For example: startBuildActivity. One of either the task or refid attributes is required. If the task is referenced simply by its name, specify that name with this attribute. | No |
| refid | A reference ID supplied by addReference which allows the TeamTask macro to support Ant tasks that are referenced by a namespace. One of either the task or refid attributes is required. If the task is referenced by a namespace, specify an addReference generated reference ID with this attribute. A refid is only required for tasks referenced by a namespace. | No |
A Task Attribute element is required for each attribute to be passed to the called Team Build task that is not one of the common Team Build attributes documented here. For example: if the task is startBuildActivity, you would specify three Task Attribute elements, one each for: autoComplete, buildResultUUID, and label.
The following table describes the valid Task Attribute element attributes and their options:
| Task Attribute Element Attributes | ||
| Attribute | Description | Required |
| name | The name of the attribute. | Yes |
| value | The value of the attribute. | Yes |
Some Team Build tasks support embedded elements. The TeamTask macro supports embedded elements with Task Element elements. Specify each Team Build task embedded element in an embedded Task Element element. Thankfully, the Task Element element does not support attributes.
<TeamTask
task="startBuildActivity"
repositoryAddress="${repositoryAddress}"
userId="${userId}"
password="${password}"
>
<taskAttribute name="autoComplete" value="true"/>
<taskAttribute name="buildResultUUID" value="${buildResultUUID}"/>
<taskAttribute name="label" value="${label}"/>
</TeamTask>
<TeamTask
task="startBuildActivity"
repositoryAddress="${repositoryAddress}"
userId="${userId}"
password="${password}"
certificateFile="${certificateFile}"
integratedWindows="${integratedWindows}"
kerberos="${kerberos}"
passwordFile="${passwordFile}"
repositoriesFile="${repositoriesFile}"
smartCard="${smartCard}"
failOnError="${failOnError}"
reuseLoginOption="${reuseLoginOption}"
verbose="${verbose}"
>
<taskAttribute name="autoComplete" value="true"/>
<taskAttribute name="buildResultUUID" value="${buildResultUUID}"/>
<taskAttribute name="label" value="${label}"/>
</TeamTask>
<xt:addReference>
<xt:getWorkItem id="getWorkItemTaskReference"/>
</xt:addReference>
<TeamTask
refid="getWorkItemTaskReference"
repositoryAddress="${repositoryAddress}"
userId="${userId}"
password="${password}"
certificateFile="${certificateFile}"
integratedWindows="${integratedWindows}"
kerberos="${kerberos}"
passwordFile="${passwordFile}"
repositoriesFile="${repositoriesFile}"
smartCard="${smartCard}"
failOnError="${failOnError}"
reuseLoginOption="${reuseLoginOption}"
verbose="${verbose}"
>
<taskAttribute name="workItemId" value="${workItemId}"/>
<taskElement>
<xt:fetch name="approvals" property="lcl.approvals" ApprovalsJson="true"/>
</taskElement>
</TeamTask>