ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dominique Devienne" <ddevie...@gmail.com>
Subject RE: Probs with property expansion in <for> loops
Date Tue, 30 Aug 2005 13:57:50 GMT
> From: Rebhan, Gilbert [mailto:Gilbert.Rebhan@huk-coburg.de]
> i have a problem with properties in <for>
> <snip/>
> Once the first time the updatelist and deletelist are loaded for the
> first environment = @{Lum} it cannot be overwrited for the next
> environment in the list ${Lums}.
> <snip/>
> How to make that loops work with a list of input properties,
> properties expanded correct ?
> <snip/>
> Any hints ?

This is a recognized problem Gilbert. There has been discussions on how to
address it using property scopes, temp name generator, etc...

Currently, the 'canonical' work around is to use a property name which uses
in part a macro param (a for param in your case) to make the name unique.

This translate into roughly the following code:

<for list="${Lums}" param="Lum">
<sequential>
  ..
  <loadfile property="server-@{Lum}"
            srcFile="K:\r1p1l01a1\server_@{Lum}" />

  <loadfile property="updatelist-@{Lum}"
            srcFile="K:\r1p1l01a1/@{Lum}/temp/deleted.txt" />

  ...
  <for list="${server-@{Lum}}" param="server">
    <sequential>
      <for list="${deletelist-@{Lum}}" param="delfile">
      ...

The property name is defined in terms of @{Lum} to make it unique, and
referenced as usual, even though it looks a bit weird, as ${foo-@{Lum}}.

We're hoping to have a better solution for Ant 1.7. --DD


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


Mime
View raw message