dreadedmonkeygod . net

Mathmatical Comparrisons in Ant?

Since publicly revealing my ignorance seems to magically summon proof of just how ignorant I am, and since that proof is invariably an obvious solution to my problem, I'm invoking the debugging gods here in hope that it'll help me through my current dilemma.

I need to conditionally execute an Ant task based on whether a certain quantity reaches a specified threshold.

In other words, I need something like this:

<if test="${n} > ${magic.threshold}">
  <exec executable="dostuff.sh" />
</if>

How is it that this doesn't already exist? Am I really pushing Ant that far outside it's proper domain?

Now, the obvious solution, since I'm calling an outside shell script anyway, is just to pass two arguments: n and threshold, and let the script do the comparison. But this seems... inelegant. It means that the script has to know about this condition, and the reason we need these values isn't obvious from just looking at the Ant code, or from looking at the script.

Anyway. I've performed the ritual. Let's see if a (more elegant) solution presents itself.

Post a Comment

Name:
Email (Never, ever displayed.)
URL:
Remember me next time.
Comments (Sorry, no HTML allowed. Space paragraphs with a blank line.):