The macro retrieves approval information for the specified work item and searches for the specified approval. If the approval is found, and if it has a cumulative state of "Approved", the specified property will be set to true.
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 |
| approval | The name of the approval to check. | Yes |
| workItemId | The ID of the work item containing the approval. | Yes |
| property |
Name of the Ant property in which to return the state of the approval. If the cumulative state of the approval is "Approved" this property is set to true. In all other cases, the property is set to false.
|
Yes |
/buildsystem/buildtoolkit/scripts/extensions/imports" folder of the EWM Build System Toolkit. To use the macro you must import the WorkItemMacros Ant script into your Ant script. To avoid hard-coding a location for the file, you may import WorkItemMacros into any Ant script by including the following Ant snippet in the script’s top-level section:
<import>
<javaresource name="scripts/extensions/imports/WorkItemMacros.xml"/>
</import>
Check for approvals
Checks for "Code review" approvals in the specified work item and returns true in the specified property if all are in a cumulative state of "Approved".
<target name="main" description="main">
<CheckForApprovals
repositoryAddress="${repositoryAddress}"
userId="${userId}"
password="${password}"
approval="Code review"
property="approved"
workItemId="${workItem}"
/>
<echo>${approved}</echo>
</target>
An example Ant script is located in: "install_location/buildsystem/buildtoolkit/scripts/extensions/imports"