List Info

Thread: tracing macros?




tracing macros?
country flaguser name
Netherlands
2007-02-20 11:20:28
Hey,

I'm  using  macrodef  a lot (a really great feature). What
I'm looking for 
is a simple
way of tracing which macro is invoked. Something like
"entring macro .. ", 
"leaving
macro ..".

So derived a Trace class from
org.apache.tools.ant.taskdefs.Sequential, 
some-
thing like:

public class Trace extends Sequential {
  public void execute() 
  {
     // entrer trace statements ..
     super.execute();
     // leaving trace statements ..
  }
}

Then I created a task name "trace" and tried
something like

<macrodef name="test">
  <trace>
     <!-- do something -->
  </trace>
</macrodef>

which unfortunatley does NOT work :-( because Macrodef has a

createSequential() 
method while "lacking" a addSequential(Sequential
s)  method.

Wouldn't it be cool to implementent such a trace task? Or do
I miss 
something?
Perhaps Ant (1.7) allows already tracing of macros ???

It would be even cooler  if  my  trace task could figure out
automatically 
that the 
name of its surrounding  macrodef is "test". Is
there a way to do that?? 

Yes, I   k n o w  that I can put my trace task within the
macrodef 
sequential. This
works but it has some disadvantages:
 - performance
 - code bloat (would like to keeps things short and simple)
 
Regards,
Wolfgang.

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )