| “Strategies in (*)ability” | [iDareMedia] [JWare] [PET] [CI-Dashboard] |
[guide] $truefalse: |
The $truefalse: value uri lets you normalize any Ant-compatible boolean string into either the string “true” or the string “false”. This uri is useful when you need to pass boolean values outside of the Ant environment (where synonyms like “yes“ may not work). 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: $truefalse:booleanstring[?TRUEstring[,,FALSEstring]] where booleanstring is the Ant compatible boolean setting and TRUEstring and FALSEstring are optional true and false string values. Note that the arguments are separated by a double comma (,,). You can use use the option strings to specify other pairs of normalized values like “PASS” and “FAIL”, or “t” and “nil”.
1) The following snippet declares the default scheme name for the truefalse uri handler: $truefalse:. This is usually done by an “init” target or at the project’s top level.
<manageuris action="install">
<parameter name="truefalse"
value="com.idaremedia.antx.valueuri.TFValueNormalizer"/>
</manageuris>
2) The following snippet normalizes an Ant script boolean string @{flag} before it is passed out to another process.
<exec executable=...>
<arg line="-Dflag=${$truefalse:@{flag}}"/>
...
3) The following snippet sets the value of a status file to either “PASS” or “FAIL” based on whether some Ant boolean strings are set.
<checkpoint tofile="${dashboard}/tests.status" includesource="no"
message="${$isset:tests.unclean|$truefalse:?FAIL,,PASS}"/>