ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wolfgang Häfelinger" <ora.et.lab...@web.de>
Subject puzzled with installing my own PropertyHelper
Date Tue, 24 May 2005 17:40:43 GMT
Hi Antees,

I wonder whether someone got his own PropertyHelper installed and what needs
exactly to be done?

What I'm doing is basically this:
1. I'm deriving my PropertyHandler from `org.apache.tools.ant.PropertyHelper'
2. I wrote a `Init' task to install my propery handler. The execute method looks
   like:

   public void execute() throws 
     BuildException 
   {
     PropertyHelper PH = new PropertyHelper(); /* that's my own here */
     Project P = getProject();
     PH.setProject(P);
     P.addReference("ant.PropertyHelper",PH);
   }

I can see that my methods are called, especially the method "replaceProperties()"
of my helper. However, having done this I'm not longer able to resolve ${basedir}
and neither Java system properties 

My build.xml looks basically like:

<project name="ant-test" default="test" basedir=".">
  <taskdef name="my-init" classname="my.Init" />
  <!-- install my property handler -->
 <property name="X" value="Y" />
 <my-init />
 <target name="test">
  <echo> basedir=${basedir} </echo>
  <echo> X=${X}</echo>
 </target>
</project>

This would echo then print
  basedir=${basedir}'
  X=Y
 instead which is a bit unexpected to me.

Note that I can reproduce this with a very basic PropertyHelper:

 public class PropertyHelper extends org.apache.tools.ant.PropertyHelper {
  protected PropertyHelper() {
     super();
   }
 }

Any help available??

Side issue: 
Installing  your  own PropertyHelper is not enough in general. It appears that
task `Property' is not consistently using the PropertyHelper interface. In order
to have  my  fancy  property  handling  installed I also had to subclass class
Property and make a couple of adjustments.

Finally - what is it all about?
I'm investigating build scripts written in our organisation. Lot's of times I found
things like

  classname = "x.y.z"
  filename    = "x/y/z.class

in build.properties. I want to avoid that users need to write things more than 
once if not really required. So what I want to have is this:

  filename = ${subst \\., /, ${classname}}.class   # evaluates to: x/y/z.class

Everythings works fine so far except that my expression evaluator fails to 
resolve ${basedir}  :-(((

Thanks for any help,
Wolfgang.    
______________________________________________________________
Verschicken Sie romantische, coole und witzige Bilder per SMS!
Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193


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


Mime
View raw message