Here's how it works. Every ANT task has its own API, its own behavior, and a very limited way of operating.
Example: foreach. I cannot pass in a list of module names, referenced from an XML Property file, into foreach for processing. Can't be done. Why? Because the coder didn't code that in.
But why did the coder have to specify the types of data a foreach statement could take? Why is a generic iterator required to go beyond iteration? And yet foreach does; apparently it must, presumably because ANT has insufficient expression power.
If that's a fundamental limitation of the ANT core system, then why didn't the original writer write ANT in a more generic fashion? This blows me away. It's insane.
If we're going to create a de facto script language out of XML, let's do it right, folks.
(1) Accept a LIST, and nothing more. If this means ANT needs a foundational LIST type, then so be it. If this means foreach needs to be rewritten to accept a LIST and only a LIST, then so be it. To do anything else is INSANE.
(2) Define tasks to be performed inside the foreach. After all, this is control flow. Don't make me perform an assembly-language-like JUMP. Do It Right.
<foreach list="${my.modules}" param="item">
<compile sourcePath="${item.sourcePath}"
destPath="${item.destPath}"/>
</foreach>
No comments:
Post a Comment