ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Gemis <marc.gemis...@belgium.agfa.com>
Subject The old immutable properties trick
Date Mon, 10 Jun 2002 13:26:28 GMT
Hi,

I just subscribed to the mailing list, but found this in the archive. I
would like to add my $-cent.



  <target name="test">
    <property name="p" value="ppp"/>
    <echo>p=${p}</echo>
    <antcall target="test2" inheritAll="false">
      <param name="p" value="aaa"/>
    </antcall> 
  </target>

  <target name="test2">
    <echo>p=${p}</echo>
    <antcall target="test3" inheritAll="false">
      <param name="p" value="bbb"/>
    </antcall> 
 
  </target>

  <target name="test3">
    <echo>p=${p}</echo>
 
  </target>


This gives in 1.4.1

test:
     [echo] p=ppp

test2:
     [echo] p=aaa

test3:
     [echo] p=aaa


after removing both 'inheritAll'

it gives:

test:
     [echo] p=ppp

test2:
     [echo] p=aaa

test3:
     [echo] p=bbb



In 1.5b2 it keeps on giving ppp/aaa/aaa

This is because the parameters set through <param> are considered 'user
properties' and those cannot be changed in the subproject (That's my
interpretation of the manual).


I have a similar problem. I'm trying to split data from logic, i.e. one
build script that reads project files which only data describing the
projects. In this project file, I list e.g. the dependencies on other
projects.

The build script detects this dependency property from the data file,
together with all other properties of the project. My idea was to construct
a build file that would recursively call itself, each time with the new
settings found in the data file. I pass the parameters through an ant-call
with nested properties (antcall with nested params gives the same result).
Targets are basicly doing the same as the above example.

This works for 1.4.1, since this is broken (on purpose ?) in 1.5b2
So far, I haven't found a work-around. Do I need to write my own
implementation of the Ant.java and CallTarget.java classes to work around
this ?

Is there another way to achieve the same result ? I think the new properties
mechanism is reducing the power of ant a lot.


regards


Marc


P.S. I'm using 1.5 since I need some other tasks, and since I want to stay
in tune with the latest release.


--
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