Quoting John Norvell <[EMAIL PROTECTED]>: > https://sourceforge.net/projects/antcontrib/ extension library has the > <if> task that uses conditions. Would you be able to use that? >
Curiously enough, the whole point of needing to be able to do this is to bootstrap ant-contrib without requiring it to be in a user's ${user.home}/.ant/lib directory. If it is there, then I'd just like to use it (and not force the user, in this case, to define a path with an id called "ant-contrib". See more on this below). If not, then I'd typedef it with a user-defined path, with the id "ant-contrib", which would be required in the absence of ant-contrib.jar in .ant/lib. It's all about flexibility. Now, there would be no problem typedefing the ant-contrib stuff if missing classpathrefs didn't cause failure even when the typedef's onerror is "ignore" or "report". But it does fail, so I need to check if the reference is defined. This would be the condition I mentioned previously. So, as you can see, I need to be able to do this little bit without the help of ant-contrib, since it won't be available until I bootstrap it. Hence, the quest to find a way to return early from a macrodef, which is where I put the <typedef>, to avoid invoking the <typedef> when ant-contrib.jar is already in .ant/lib. Hence, avoiding the need force users to provide the path with id "ant-contrib", which would have the ant-contrib.jar as one of its path elements. Besides this specific case, I can see an early return as being generally useful anyway. So I'm quite curious to find out if it is possible using a scriptdef. For more detailed info on typedef failing with a missing classpathref, even when onerror is "ignore" or "report", see my previous post from a few days ago that never got answered... http://marc.theaimsgroup.com/?l=ant-user&m=116292805430859&w=2 Jake > -J > > Jacob Kjome wrote: > > > > In a macrodef, if I check a condition and that condition is true, I'd like > to > > return early from the macrodef and not run any of the rest of its contents. > Is > > it possible using a <scriptdef> to write a script that can force an early > return > > from the <sequential> part of the macrodef if the condition is met? This > is > > kind of akin to an if/unless on a target. I'm not quite seeing where I > would > > be able to hook into Ant to do such a thing. Is it impossible? I hope > not. > > > > BTW, I'm not talking about <fail/>. I don't want the build to end when the > > condition is met. I just want to skip the rest of the <macrodef> contents > and > > continue processing. > > > > > > Jake > > > > --------------------------------------------------------------------- > > 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]