ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: Bug in Ant? Custom tasks aren't executed (set methods are called though) only when "antcall" is used.
Date Mon, 07 Oct 2002 06:53:20 GMT
On Fri, 4 Oct 2002, Ryan Cuprak <507107@corpmail.kodak.com> wrote:

>    <target name="setup">
>      <typedef name="RCGenericLog" 
>               classname="com.kodak.sis.ant.RCG" 
>               classpath="${g_ant_extensions}"/>
>    </target>

unless this is a cut-n-paste error or typo, here is your problem.
That should by <taskdef>, not <typedef>.

I think I know what's going on and can explain why it works when you
invoke your target directly (this is the real bug, BTW) but not if you
call it via <antcall>.

When Ant parses your build-file and reaches this one

> <RCGenericLog file="${generic.log}" message="-utilities-build-being run.">

it will try to look up a task named "RCGenericLog" and fail, then it
will look for a data-type of that name and fail again.  Then it will
mark this thing as unknown and keep an instance of UnknownElement as a
placeholder until this task is going to be executed.

When your target gets run the "normal" (i.e. non-<antcall>) way, the
typedef has defined RCGenericLog as a data-type.  UnknownElement will
replace itself with an instace of the corresponding class and (and
here is the bug) call execute() on the instance without checking
whether it is a task or a data-type.

Now consider the <antcall> execution.

The child build process inherits all task and data-type definitions of
the parent build.  When Ant now parses the build-file again (it does
so in <antcall>) it will know the data-type "RCGenericLog".  It will
call the setters (and handle nested child elements if present), but it
will not call execute() on it, as this is the only difference between
handling data-types and tasks.

Stefan

--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message