Shouldn't this be a Condition and not Task? This would allow using it as part of more complex conditions <and/> <or/>.
It also means it should just return a boolean value and not set any properties that is for the <condition/> task to do. Jose Alberto > -----Original Message----- > From: Peter Reilly [mailto:[EMAIL PROTECTED] > Sent: 22 January 2004 10:36 > To: Ant Developers List > Subject: Re: task available task > > > Some quick answers without writing code; > > Steve Loughran wrote: > > > > > just thought...who else thinks it would be handy to have a task that > > probed for a task being defined at that point in the build. > > > > > > e.g. > > > > <taskavailable property="nice.present" task="nice"/> > > > > To date we can do the thing with the classname, but that requires > > knowing the full classname, an implementation detail that > should not > > matter, > > > > > > Assuming this is a good thing, > > > > 1. what is the trick for looking up a taskname? > > Use def = ComponentHelper#getDefinition(componentname) > note that in ant1.6.0 tasks and datatypes are in the same map - so > this would return the anttypedefinion > for "fileset" as well as "echo". Note that this will return > sucessfully > for optional tasks - like "script". > The available task would also need to check if the class of the > anttypedefintion can be found: > i.e. if def.getExposedClass(getProject()) is present. > > > > > 2. what should the task do? It could set the property to the name of > > the impl class. > > In ant1.6.0 things are a little more compilicated - macrodefs, > scriptdefs etc are also tasks - it would > make more sense to set the property to "yes". > > > > > 3. what about namespaces? > > Namespaces URIs + task name are mapped to a component name as > URI + ":" > + taskname > > so > ComponentHelper#getDefinition("antlib:net.sf.antcontrib:for") would > work for: > > <project xmlns:ac="antlib:net.sf.antcontrib"> > > <taskavailable property="for.present" > task="antlib:net.sf.antcontrib:for"/> > > </project> > > > Users may expect the following: > > <project xmlns:ac="antlib:net.sf.antcontrib"> > > <taskavailable property="for.present" task="ac:for"/> > > </project> > > Peter > > > > > -steve > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]