I didn't notice the SCRIPT task, but that may be because I use an older version of Ant that doesn't come with a lot of the recent optional tasks.
One thing to note, in my implementation I actually support script blocks in terms of processing instructions (PI) instead of as <script> tags, because it allows me to use the <, >, and & characters in the code without having to escape them. For example: <?script var foo = 1; var bar = 2; var cond = (foo < bar) && (bar - foo > 0); ?> instead of writing: <script> var foo = 1; var bar = 2; var cond = (foo < bar) && (bar - foo > 0); </script> To support the language attribute in your example, you could simply use a composite PI tag like <?script:JavaScript ... ?> Finally, I exported into the JavaScript engine a couple of objects that allows me to interface back and forth such as sysin, sysout, and syserr which map to System.in, .out, and .err respectively, and sysprops which maps to the Properties object from System.getProperties(). So something similar can be done to interface to targets, tasks, and properties. Stefan Bodewig wrote: > > >>>>> "EB" == Eugene Bekker <[EMAIL PROTECTED]> writes: > > EB> I notice there are more and more requests to beef up the logic > EB> support for tasks, like IFNOT and multiple IFs. One thing to > EB> consider is to drop in an existing logic parser, that would allow > EB> nested and more complicated boolean statements, such as Mozilla's > EB> Rhino JavaScript engine. > > Did you notice the optional script task? It uses BSF as its framework > and Rhino amongst others is supported by it. > > Probably using scripts would make a lot of the conditional compilation > stuff easier. Let's assume that project properties, targets and tasks > are exposed to the scripting language in some way, so you could write > > <script language="JavaScript"> > target["targetid"].setCondition(cond1 || (cond2 && !cond3)); > </script> > > where cond1 may have been calculated by other tasks executed before > this one or set by command line properties or ... > > The drawback of this is that Ant would start to depend on BSF (or any > other scripting framework for that matter). > > Stefan -- Eugene Bekker Chief Architect PowerVision Corporation http://www.powervision.com tel://410/312.7243 cel://443/838.6330
