ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rebhan, Gilbert" <Gilbert.Reb...@huk-coburg.de>
Subject RE: Probs with property expansion in <for> loops
Date Tue, 30 Aug 2005 13:54:16 GMT

Hi, Rick

Thanks a million !! 

you've made my day :-)))

Dealing with for + macrodef ain't easy, as
i never used that before ...

Now i have =

for list="${deletelist.@{Lum}}
and
for list="${updatelist.@{Lum}}

in the inner loops 3 and 4


Gilbert 

-----Original Message-----
From: Rick Genter [mailto:rgenter@silverlink.com] 
Sent: Tuesday, August 30, 2005 3:33 PM
To: Ant Users List
Subject: RE: Probs with property expansion in <for> loops

Try incorporating the name of the lib into the property. Something like:

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

Then use ${updatelist.@{Lum}} throughout.

--
Rick Genter
Principal Engineer
Silverlink Communications
<mailto:rgenter@silverlink.com>
(781) 272-3080 x242

-----Original Message-----
From: Rebhan, Gilbert [mailto:Gilbert.Rebhan@huk-coburg.de] 
Sent: Tuesday, August 30, 2005 9:18 AM
To: user@ant.apache.org
Subject: Probs with property expansion in <for> loops


Hi,

i have a problem with properties in <for>

scenario =

Three lists :
- list with all environments that should be served
  (loaded outside all loops)
- list with all servers of one environment
  (loaded in loop 2)
- list of files to be deleted on those servers
- list of files to be copied to those servers
  (generated in the outer loop 1 by a java class,
    loaded in loop 3 and loop 4)

Buildfile structure :

...

<!-- property = list with all environments -->
<loadfile property="Lums" srcFile="K:\r1p1l01a1\luminfo.txt" />

	<target name="main" depends="doall" />

	<target name="doall">

		<!-- // start loop 1 // -->

	<for list="${Lums}" param="Lum">
	<sequential>
	<untar src="K:\r1p1l01a1/@{Lum}/transfer/tarfile_@{Lum}.tar" 
	   dest="K:\r1p1l01a1/@{Lum}/serverdata"
	   overwrite="true" />
				
	<loadfile property="server" srcFile="K:\r1p1l01a1\server_@{Lum}"
/>

<java classname="de. ... .ParseCCLogs" failonerror="true">
	<arg value="K:\r1p1l01a1/@{Lum}/transfer" />
	<arg value="K:\r1p1l01a1/@{Lum}/temp/updated.txt" />
	<arg value="K:\r1p1l01a1/@{Lum}/temp/deleted.txt" />
...
</java>

<!-- files to be deleted on all servers-->		
<loadfile property="updatelist"
srcFile="K:\r1p1l01a1/@{Lum}/temp/updated.txt" />

<!-- files to be copied to all servers-->
<loadfile property="deletelist"
srcFile="K:\r1p1l01a1/@{Lum}/temp/deleted.txt" />


	<!-- // start loop 2 //  -->
	<for list="${server}" param="server">
	<sequential>
                       <!-- // start loop 3 // -->
		<for list="${deletelist}" param="delfile">
		<sequential>
		<echo message="Delete file -> @{delfile}" />
		</sequential>
		</for> <!-- // end loop 3 // -->
     
                         <!-- // start loop 4 // -->
		<for list="${updatelist}" param="copyfile">
		<sequential>
		<echo message="Copy file -> @{copyfile}" />
		</sequential>
		</for> <!-- // end loop 4 // -->

	</sequential>
	</for>	<!-- // end Loop 2 // -->
</sequential>
</for><!-- // end Loop 1 // -->


Problem =

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

debugmode says :
Override ignored for property updatelist
Override ignored for property deletelist
when getting into the loop for the second @{Lum}

Question =

How to make that loops work with a list of input properties,
properties expanded correct ?

If for loops are the wrong way, what should i do instead ?

I wanted to avoid several foreach loops.

Any hints ?


Regards, Gilbert

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


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


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


Mime
View raw message