| “Strategies in (*)ability” | [iDareMedia] [JWare] [PET] [CI-Dashboard] |
[guide] $criteria: |
The $criteria: (or $test:) value uri lets you call an AntX <criteria>, <tally>, or other condition. The result of the condition is returned as either “true” or “false”. The general Ant condition task <condition> is not a supported target because it does not support the Ant Condition interface (as of Ant 1.6.3). You would normally use a condition uri as the check value in some AntX flow-control task like <domatch> or <do>. You must explicitly install this value uri’s handler; read the Examples section to see how this is done.
The general form of the uri is: $criteria:condition-refid where condition-refid is the reference identifier for the AntX criteria or condition to call. You can use the AntX value uri property reference syntax $(…) to refer to condition names stored as project properties or you can pipe the result of either a $property: or $variable: uri directly into it.
1) The following snippet declares the two default scheme names for the criteria value uri handler: $criteria: and $test:. This is usually done by an “init” target or at the project’s top level.
<manageuris action="install">
<parameter name="test"
value="com.idaremedia.antx.condition.solo.ConditionValueURIHandler"/>
<parameter name="criteria"
value="com.idaremedia.antx.condition.solo.ConditionValueURIHandler"/>
</manageuris>
2) The following snippet executes a <do> block if the criteria named by the variable “testname” returns true.
<do true="${$var:testname|$test:}">
[...tasks to run]
</do>
3) The following snippet shows part of a build script that calls a criteria customfilters-exist to determine how to process.
<foreach i="filetype" items="template.filetypes" mode="local">
<domatch value="${$test:customfilters-exist}">
<true>
[...work if filters exist]
<otherwise>
[...alternative if not]
</domatch>
</foreach>