ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Vernum <Tim.Ver...@macquarie.com.au>
Subject Foreach task...
Date Mon, 23 Apr 2001 12:09:37 GMT

Not sure if this is really a submission or not.
(I don't really expect it to be accepted)

Attached is an optional "foreach" task.
Really it's just AntCallOn.

It supports iterating over filesets, and over a set of parameters.

eg
	<foreach target="doSomething">
		<param name="param1">
			<fileset refid="fset1"/>
		</param>
		<param name="param2">
			<item value="value1"/>
			<item value="value2"/>
		</param>
	</foreach>

The parameters form a cartesian product, so every item in fileset 
"fset1" will be paired against "value1" and then "value2"

It's slightly unfinished (the task is incorrectly formated, and undocmented),
but I'm going on holidays in about 20 hours, and I don't know if I'll have any
time to work on it between now and then.

I don't have any real need for it right now, but with all the "how do I iterate
over a fileset" questions that popup, I thouht it would be work having lying
around somewhere.


 <<foreach.xml>>  <<ForeachTask.java>> 


begin 600 foreach.xml
M/#]X;6P@=F5R<VEO;CTB,2XP(C\^#0H-"CQP<F]J96-T(&YA;64](D9/4D5!
M0T@B(&1E9F%U;'0](FUA:6XB(&)A<V5D:7(](BXB/@T*#0H@(#QT87-K9&5F
M(&YA;64](F9O<F5A8V@B(&-L87-S;F%M93TB;W)G+F%P86-H92YT;V]L<RYA
M;G0N=&%S:V1E9G,N;W!T:6]N86PN1F]R96%C:%1A<VLB+SX-"@T*("`\9FEL
M97-E="!I9#TB9G,Q(B!D:7(](BXB/@T*"3QI;F-L=61E(&YA;64](BHN<V@B
M+SX-"B`@/"]F:6QE<V5T/@T*#0H@(#QF:6QE<V5T(&ED/2)F<S(B(&1I<CTB
M+B(^#0H)/&EN8VQU9&4@;F%M93TB*BYX;6PB+SX-"B`@/"]F:6QE<V5T/@T*
M#0H@(#QT87)G970@;F%M93TB;7-G(CX-"@D\96-H;R!M97-S86=E/2(N+BXN
M+BXN+BXN+BXN+BXN+B(O/@T*"3QE8VAO(&UE<W-A9V4](E`Q.B1[<&%R86TQ
M?2(O/@T*"3QE8VAO(&UE<W-A9V4](E`R.B1[<&%R86TR?2(O/@T*"3QE8VAO
M(&UE<W-A9V4](E`S.B1[<&%R86TS?2(O/@T*("`\+W1A<F=E=#X-"@T*("`\
M=&%R9V5T(&YA;64](FUA:6XB/@T*(`D\9F]R96%C:"!T87)G970](FUS9R(^
M#0H)"3QP87)A;2!N86UE/2)P87)A;3$B/@T*"0D)/&9I;&5S970@<F5F:60]
M(F9S,2(O/@T*"0D\+W!A<F%M/@T*"0D\<&%R86T@;F%M93TB<&%R86TR(CX-
M"@D)"3QI=&5M('9A;'5E/2)V,2(O/@T*"0D)/&ET96T@=F%L=64](G8R(B\^
M#0H)"3PO<&%R86T^#0H)"3QP87)A;2!N86UE/2)P87)A;3,B/@T*"0D)/&9I
M;&5S970@<F5F:60](F9S,B(O/@T*"0D)/&ET96T@=F%L=64](G8S(B\^#0H)
M"3PO<&%R86T^#0H)/"]F;W)E86-H/@T*("`@/"]T87)G970^#0H-"CPO<')O
':F5C=#X-"@==
`
end

begin 600 ForeachTask.java
M+RH-"B`J(%1H92!!<&%C:&4@4V]F='=A<F4@3&EC96YS92P@5F5R<VEO;B`Q
M+C$-"B`J#0H@*B!#;W!Y<FEG:'0@*&,I(#$Y.3D@5&AE($%P86-H92!3;V9T
M=V%R92!&;W5N9&%T:6]N+B`@06QL(')I9VAT<PT*("H@<F5S97)V960N#0H@
M*@T*("H@4F5D:7-T<FEB=71I;VX@86YD('5S92!I;B!S;W5R8V4@86YD(&)I
M;F%R>2!F;W)M<RP@=VET:"!O<B!W:71H;W5T#0H@*B!M;V1I9FEC871I;VXL
M(&%R92!P97)M:71T960@<')O=FED960@=&AA="!T:&4@9F]L;&]W:6YG(&-O
M;F1I=&EO;G,-"B`J(&%R92!M970Z#0H@*@T*("H@,2X@4F5D:7-T<FEB=71I
M;VYS(&]F('-O=7)C92!C;V1E(&UU<W0@<F5T86EN('1H92!A8F]V92!C;W!Y
M<FEG:'0-"B`J"6YO=&EC92P@=&AI<R!L:7-T(&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)I=F5D#0H@*@EF<F]M('1H:7,@<V]F='=A<F4@=VET:&]U
M="!P<FEO<B!W<FET=&5N('!E<FUI<W-I;VXN($9O<B!W<FET=&5N#0H@*@EP
M97)M:7-S:6]N+"!P;&5A<V4@8V]N=&%C="!A<&%C:&5`87!A8VAE+F]R9RX-
M"B`J#0H@*B`U+B!0<F]D=6-T<R!D97)I=F5D(&9R;VT@=&AI<R!S;V9T=V%R
M92!M87D@;F]T(&)E(&-A;&QE9"`B07!A8VAE(@T*("H);F]R(&UA>2`B07!A
M8VAE(B!A<'!E87(@:6X@=&AE:7(@;F%M97,@=VET:&]U="!P<FEO<B!W<FET
M=&5N#0H@*@EP97)M:7-S:6]N(&]F('1H92!!<&%C:&4@1W)O=7`N#0H@*@T*
M("H@5$A)4R!33T945T%212!)4R!04D]6241%1"!@8$%3($E3)R<@04Y$($%.
M62!%6%!215-3140@3U(@24U03$E%1`T*("H@5T%24D%.5$E%4RP@24Y#3%5$
M24Y'+"!"550@3D]4($Q)34E4140@5$\L(%1(12!)35!,245$(%=!4E)!3E1)
M15,-"B`J($]&($U%4D-(04Y404))3$E462!!3D0@1DE43D534R!&3U(@02!0
M05)424-53$%2(%!54E!/4T4@05)%#0H@*B!$25-#3$%)345$+B`@24X@3D\@
M159%3E0@4TA!3$P@5$A%($%004-(12!33T945T%212!&3U5.1$%424].($]2
M#0H@*B!)5%,@0T].5%))0E543U)3($)%($Q)04),12!&3U(@04Y9($1)4D5#
M5"P@24Y$25)%0U0L($E.0TE$14Y404PL#0H@*B!34$5#24%,+"!%6$5-4$Q!
M4EDL($]2($-/3E-%455%3E1)04P@1$%-04=%4R`H24Y#3%5$24Y'+"!"550@
M3D]4#0H@*B!,24U)5$5$(%1/+"!04D]#55)%345.5"!/1B!354)35$E4551%
M($=/3T13($]2(%-%4E9)0T53.R!,3U-3($]&#0H@*B!54T4L($1!5$$L($]2
M(%!23T9)5%,[($]2($)54TE.15-3($E.5$524E505$E/3BD@2$]7159%4B!#
M0553140@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E;G5M(#T@9FEL97-E=',N96QE;65N=',H*2`[#0H)"0EW:&EL92@@
M96YU;2YH87--;W)E16QE;65N=',H*2`I('L-"@T*"0D)"49I;&53970@9FEL
M95-E="`]("A&:6QE4V5T*65N=6TN;F5X=$5L96UE;G0H*2`[#0H)"0D)1&ER
M96-T;W)Y4V-A;FYE<B!S8V%N;F5R(#T@9FEL95-E="YG971$:7)E8W1O<GE3
M8V%N;F5R*'!R;VIE8W0I(#L-"@D)"0E3=')I;F=;72!F:6QE<R`]('-C86YN
M97(N9V5T26YC;'5D961&:6QE<R@I(#L-"@T*"0D)"69O<B@@:6YT(&D],"`[
M(&D\(&9I;&5S+FQE;F=T:"`[(&DK*R`I('L-"@D)"0D)=F%L=65S+F%D9$5L
M96UE;G0H(&9I;&5S6VE=("D@.PT*"0D)"7T-"@D)"7T-"@T*"0D)96YU;2`]
M(&ET96US+F5L96UE;G1S*"D@.PT*"0D)=VAI;&4H(&5N=6TN:&%S36]R945L
M96UE;G1S*"D@*2![#0H-"@D)"0E087)A;4ET96T@:71E;2`]("A087)A;4ET
M96TI96YU;2YN97AT16QE;65N="@I(#L-"@D)"0EV86QU97,N861D16QE;65N
M="@@:71E;2YG971686QU92@I("D@.PT*"0D)?0T*"0D)#0H)"0ER971U<FX@
M=F%L=65S+F5L96UE;G1S*"D@.PT*"0E]#0H-"@E]#0H-"@EP<FEV871E(%-T
M<FEN9R`@("!S=6)487)G970[#0H)<')I=F%T92!696-T;W(@("`@<&%R86US
M(#L-"@EP<FEV871E($AA<VAT86)L92!P<F]P97)T:65S(#L-"@T*"7!U8FQI
M8R!&;W)E86-H5&%S:R@@*2![#0H)"7!A<F%M<R`](&YE=R!696-T;W(H*2`[
M#0H)"7!R;W!E<G1I97,@(#T@;F5W($AA<VAT86)L92@I(#L-"@E]#0H-"@EP
M=6)L:6,@=F]I9"!I;FET*"D@>PT*"7T-"@T*"7!R:79A=&4@=F]I9"!B=6EL
M9%!R;W!E<G1Y*"!3=')I;F<@<')O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=F%L=65S+FAA<TUO<F5%;&5M
M96YT<R@I("D@>R`-"@T*"0D)"5-T<FEN9R!V86P@/2`H4W1R:6YG*79A;'5E
M<RYN97AT16QE;65N="@I(#L-"@D)"0EB=6EL9%!R;W!E<G1Y*"!P87)A;5-E
M="YG971.86UE*"DL('9A;"`I(#L-"@T*"0D)"65X96-U=&5087)A;65T97)S
M*"!P87)A;4YU;6)E<BLQ("D@.PT*"0D)?0T*"0E]#0H)?0T*#0H)<'5B;&EC
M('9O:60@97AE8W5T92@I('L-"@D)#0H)"6EF("AS=6)487)G970@/3T@;G5L
M;"D@>PT*"0D)=&AR;W<@;F5W($)U:6QD17AC97!T:6]N*")!='1R:6)U=&4@
M=&%R9V5T(&ES(')E<75I<F5D+B(L(`T*"0D)"0D)"0D)(&QO8V%T:6]N*3L-
M"@D)?0T*"0D-"@D)97AE8W5T95!A<F%M971E<G,H,"D@.PT*"7T-"@T*"7!U
M8FQI8R!087)A;5-E="!C<F5A=&5087)A;2@I('L-"@D)4&%R86U3970@<&%R
M86T@/2!N97<@4&%R86U3970H*2`[#0H)"7!A<F%M<RYA9&1%;&5M96YT*"!P
M87)A;2`I(#L-"@D)<F5T=7)N('!A<F%M(#L-"@E]#0H-"@EP=6)L:6,@=F]I
M9"!S971487)G970H4W1R:6YG('1A<F=E="D@>PT*"0ES=6)487)G970@/2!T
/87)G970[#0H)?0T*?0T*
`
end

Mime
View raw message