You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Marc Gemis <ma...@belgium.agfa.com> on 2002/06/10 15:26:28 UTC

The old immutable properties trick

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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: The old immutable properties trick

Posted by Stefan Bodewig <bo...@apache.org>.
On 11 Jun 2002, Stefan Bodewig <bo...@apache.org> wrote:

> <http://cvs.apache.org/~bodewig/ant1.5beta/>.

Arghh, <http://cvs.apache.org/~bodewig/gump/ant1.5beta/>

Stefan

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: The old immutable properties trick

Posted by Stefan Bodewig <bo...@apache.org>.
Supposed to be fixed in the 1.5 branch now.  Could you please try the
latest build from <http://cvs.apache.org/~bodewig/ant1.5beta/>.

Stefan

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>