| “Strategies in (*)ability” | [iDareMedia] [JWare] [PET] [CI-Dashboard] |
How do I turn on all builtin value URI handlers? [0.5+]
The AntX distributions include an antlib in com/idaremedia/antx/valueuri that has declarations for all of the builtin AntX value URI handlers. In this antlib, we’ve used only the verbose but easy-to-understand URI protocol names. You can create your own local antlib file that uses shorter names; for example, you could shorten $string: to just $str: or $isnotwhitespace: to just $notws:.
To use our value URI antlib as is, either declare your AntX tasks using the com/idaremedia/antx/install antlib or copy either of the snippets below. Note that to enable the uri handlers (instead of just installing them), you must set the jware.antx.defaults.valueuris.flag property to “yes” before loading the antlib or manually call <manageuris action="enable"/> after loading the antlib.
[Using 'enable' property on load]
<property name="jware.antx.defaults.valueuris.flag" value="yes"/>
<typedef resource="com/idaremedia/antx/valueuri/antlib.xml"/>
[Using <manageuris> ourselves]
<typedef resource="com/idaremedia/antx/valueuri/antlib.xml"/>
…
<manageuris action="enable"/>
If you want to install AntX in a custom namespace, you must use the same uri when loading the valueuri/antlib.xml file like the following examples do. In all the examples, AntX is installed into the namepsace marked by the “t:” xml prefix.
[Plain XML namespace] <project name="sample" xmlns:t="jware.antx"...> <taskdef resource="com/idaremedia/antx/antlib.xml" uri="jware.antx"/> … <typedef resource="com/idaremedia/antx/valueuri/antlib.xml" uri="jware.antx"/> <t:manageuris action="enable"/> … <echo message="Started: ${$longdatetime:}"/> … </project> [Special "antlib:" namespace] <project name="sample" xmlns:t="antlib:com.idaremedia.antx"...> … <typedef resource="com/idaremedia/antx/valueuri/antlib.xml" uri="antlib:com.idaremedia.antx"/> <t:manageuris action="enable"/> … <echo message="Started: ${$longdatetime:}"/> … </project> [Special "antlib:" namespace using antx/install antlib] <project name="sample" xmlns:t="antlib:com.idaremedia.antx.install"...> … <t:manageuris action="enable"/> … <echo message="Started: ${$longdatetime:}"/> … </project>