ant-dev mailing list archives

> The only thing I need? A small modification to the javac task:
>
> <target name="compile"
> depends="whatever"
> requires="org.apache.myclass.TheOneINeedToCompile
> action"[fail/ignore]"/>
Sound to me that what you are asking for is a modification to target, not
javac. It also sounds to me like you already have what you need, though
perhaps not in the form that you describe. Here's how you would do it
today:
<available property="myclass.present"
classname="org.apache.myclass.TheOneINeedToCompile" />
<target name="compile"
depends="whatever"
if="myclass.present" />
Note: I'm not sure why you need an action="[fail/ignore]", care to
enlighten me?
The problem I have (or had) is that the javac task is too powerful. For a
while, I couldn't build ant because javac would pick up all java files it
found, including ApacheParser. The solution I opted for at the time was to
fix ApacheParser to use introspection. A much better solution, IMHO, based
on what can be done with Ant today would be to add the following to ant's
build.xml.
<available property="xerces.present"
classname="org.apache.xerces.parsers.DOMParser" />
<javac srcdir="${src.dir}" destdir="${build.classes}"
classpath="${classpath}">
<exclude name="**/ApacheParser.java" unless="xerces.present">
</javac>
I'm hoping that with the above concrete example, you will have an "AHA!"
experience, and decide that this is not merely a "useless complication".
- Sam Ruby
P.S. All kidding aside, I would be greatly troubled if you chose to grab a
version of the ant.jar and drop out. For two reasons:
1) A number of changes being discussed here are not backwards compatible.
Example: Duncan and Stefano are advocating making properties defined inside
a target local to that target. The net is that over time you will likely
find it more difficult to share your build instructions with others.
2) Your dropping out would mean a significant reduction in the number of
ideas in the gene pool (or meme pool). It would be all too easy for us to
go off the deep end, either by steadily accumulating tasks that were needed
to get the job done or by getting too enraptured in the power of one
feature or design pattern. One of ant's main attractions is that it is
simple. Keep keeping us honest.
Just remember that (and I believe that this is one of Murphy's laws), when
all is said and done, a hell of a lot more is said than done.
As applied here (and as Martha Stewart would say), "It's a good thing!".