By the way, <param> is documented as a nested tag of
<foreach>...
http://ant-contrib.sourceforge.net/ant-contrib/manual/tasks/index.html
-Matt
--- Matt Lyon <[EMAIL PROTECTED]> wrote:
> DD,
>
> That rocks! Thanks for the help. If I use your
> second suggestion in conjunction with my original
> "checkout-dirs" target (sans the nested <param> you
> suggested, which also works!) I get exactly the
> functionality I was looking for. I'm still a little
> puzzled as to why I needed the nested <param>
> element to pass ${comptag} to checkout-dir target
> explicitly in scenario 1, but since I have something
> that works now, I won't bother banging my head
> against that one right now. Thanks again...
>
> Matt
>
> -----Original Message-----
> From: Dominique Devienne [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 05, 2002 12:54 PM
> To: 'Ant Users List'
> Subject: RE: <foreach> & <propertycopy> (was 'RE:
> Automated source
> config model?')
>
>
> Two remarks:
>
> 1) Normally <antcall> (used internally by <foreach>)
> passes properties to
> the called project automatically, but since it
> appears it's not in your
> case, try passing it explicitly. I discovered
> (yesterday actually!) that
> <foreach> supports nested <param>, as <antcall>
> does, although it's not
> documented. So try:
>
> <target name="checkout-dirs">
> <propertycopy name="complist"
> from="${component}.dirs" />
> <propertycopy name="comptag"
> from="${component}.tag" />
> <foreach list="${complist}" target="checkout-dir"
> param="ckout.pkg">
> <param name="comptag" value="${comptag}" />
> </foreach>
> </target>
>
> I assume you made sure comptag was property set by
> <propertycopy> in
> 'checkout-dirs'.
>
> 2) 'checkout-dir-notag' might never be called, since
> <propertycopy> might
> define the comptag property anyhow, even if
> ${component}.tag doesn't
> exists???
>
> Personnaly, since you're already using ant-contrib,
> I would simple have
> done:
>
> <target name="checkout-dir">
> <if>
> <isset property="comptag" />
> <then>
> <echo message="checking out ${ckout.pkg}
> with tag ${comptag}"/>
> <cvs cvsRoot="${cvsRoot}"
> dest="${src}"
> command="co -P -r ${comptag}
> ${ckout.pkg}"/>
> </then>
> <else>
> <echo message="NOTE: no tag defined for
> ${ckout.pkg}; checking out
> from main code line"/>
> <cvs cvsRoot="${cvsRoot}"
> dest="${src}"
> command="co -PA ${ckout.pkg}"/>
> </else>
> </if>
> </target>
>
> Hope this helps. --DD
>
> -----Original Message-----
> From: Matt Lyon [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 05, 2002 11:22 AM
> To: Ant Users List
> Subject: <foreach> & <propertycopy> (was 'RE:
> Automated source config
> model?')
>
> DD,
>
> Thanks for the information! The issue I was facing
> seemed to be due to
> property scope/flow control. I had placed a task to
> read in properties from
> an external properties file inside an init target,
> which did not allow the
> subsequent targets to work the <propertycopy> magic
> of expanding nested
> properties in that same property file which you so
> eloquently described. If
> I place the <property file="config.properties"/> at
> the <project> level in
> my buildfile and not inside any target, that gets me
> past the problem.
>
> However, I'm still stuck on a <propertycopy> issue.
> Using Matt McHenry's
> model again, if I have an external properties file
> that lists the following:
>
> #The list of modules
> components=platform,ui,content
>
> #The tag for the 'platform' module
> platform.tag=V1_0_6_183
> #The platform directories
> platform.dirs=starman/src/com/stargus/platform
>
> #The tag for the 'ui' module
> ui.tag=V1_0_6_183
> #The ui directories
> ui.dirs=starman/src/com/stargus/web,starman/src/web
>
> #The tag for the 'content' module
> content.tag=V1_0_7_184
> #The content directories
>
content.dirs=starman/src/com/stargus/platform/content
>
> And a build.xml which contains the following target
> sequence:
>
> <!-- Targets to check out the souce code from CVS.
> -->
> <target name="checkout"
> depends="init"
> description="Checks out tagged directories
> listed in the
> build_config.properties file.">
> <foreach list="${components}"
> target="checkout-dirs"
> param="component"/>
> </target>
>
> <target name="checkout-dirs">
> <propertycopy name="complist"
> from="${component}.dirs"/>
> <propertycopy name="comptag"
> from="${component}.tag"/>
> <foreach list="${complist}"
> target="checkout-dir"
> param="ckout.pkg"/>
> </target>
>
> <target name="checkout-dir-tag"
> if="comptag">
> <echo message="checking out ${ckout.pkg} with
> tag ${comptag}"/>
> <cvs cvsRoot="${cvsRoot}"
> dest="${src}"
> command="co -P -r ${comptag}
> ${ckout.pkg}"/>
> </target>
>
> <target name="checkout-dir-notag"
> unless="comptag">
> <echo message="NOTE: no tag defined for
> ${ckout.pkg}; checking out from
> main code line"/>
> <cvs cvsRoot="${cvsRoot}"
> dest="${src}"
> command="co -PA ${ckout.pkg}"/>
> </target>
>
> <target name="checkout-dir"
> depends=checkout-dir-tag,checkout-dir-no-tag"/>
>
>
> What I'm finding is that the ${complist} property
> value is passed to the
> checkout-dir tag as param ${ckout.pkg} with the
> expected <foreach>
> iterations performed, but the checkout-dir-tag
> target is never executed
> because the ${comptag} property value is either not
> getting defined by
> <propertycopy> or is not recognized by the
> checkout-dir composite target due
> to some sort of flow control or property scope
> issue. How can I force the
> setting and propagation of the ${comptag} property
> value to the subsequent
> targets?
>
> Matt
> -----Original Message-----
> From: Dominique Devienne [mailto:[EMAIL PROTECTED]]
>
=== message truncated ===
__________________________________________________
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>