ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <>
Subject RE: <foreach> & <propertycopy> (was 'RE: Automated source config model?')
Date Thu, 05 Sep 2002 18:13:35 GMT
You can easily check for that case using:

<condition or if>
  <equals arg1="${comptag}" arg2="$${comptag}" />
</condition or if>

You could also use a pseudo-tag called 'head', and check for the value
specifically. And that would allow to add a

<fail message="..." unless="comptag" />

to fail with a nice message if comptag ends up really being not defined!

Cheers, --DD

-----Original Message-----
From: Matt Lyon [] 
Sent: Thursday, September 05, 2002 12:52 PM
To: Ant Users List
Subject: RE: <foreach> & <propertycopy> (was 'RE: Automated source config


Yes it was. Thanks. However, I'm actually not out of the woods yet, as it
turns out, contrary to my previous response (a rush to irrational
exuberance, perhaps?).

I'm still wrestling with the ${comptag} property value. It appears that I
have a bit of a catch-22. It seems that I need to set the nested <param
name="comptag" value="${comptag}"/> element in my <foreach task> in my
"checkout-dirs" target to pass this along to the subsequent "checkout-dir"
target to get it to recognize the tags, because if I don't, the target sees
${comptag} as not defined and checks out from the main code line. However,
if I do so and comment out one of the ${component}.tag values in my
properties file, it causes the value to be passed in as ${comptag}, which
results in:
     [echo] checking out starman/src/com/stargus/web with tag ${comptag}
      [cvs] cvs [server aborted]: no such tag ${comptag}

Let me post the two targets I've got now:

  <target name="checkout-dirs"> 
    <propertycopy name="complist"
    <propertycopy name="comptag"
    <echo message="complist is set to ${complist}"/>
    <echo message="comptag is set to ${comptag}"/>
    <foreach list="${complist}"
      <!--param name="comptag" value="${comptag}"/-->

  <target name="checkout-dir">
      <isset property="comptag"/>
        <echo message="checking out ${ckout.pkg} with tag ${comptag}"/>
        <cvs cvsRoot="${cvsRoot}"
             command="co -P -r ${comptag} ${ckout.pkg}"/>
        <echo message="NOTE: no tag defined for ${ckout.pkg}; checking out
from main code line"/> 
        <cvs cvsRoot="${cvsRoot}"
            command="co -PA ${ckout.pkg}"/>

Basically, the requirement is that I need to be able to define named value
pairs (tags and srcdirs), have ant iterate over them, and checkout the
srcdirs from the defined tag, or from the main code line if the tag is not
defined. So I either need to figure out how to make isset in my <if> task
recognize when comptag is not set to a legitimate value or perhaps figure
out how to get ${comptag} passed without having to use a nested <param>

-----Original Message-----
From: Diane Holt []
Sent: Thursday, September 05, 2002 1:38 PM
To: Ant Users List
Subject: RE: <foreach> & <propertycopy> (was 'RE: Automated source
config model?')

--- Matt Lyon <> wrote:
> 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...

When I fix the two typo's you had in your listing, this is what I get
(changed the <cvs> stuff to just echo out the 'co' command line):
  command="co -P -r V1_0_6_183 starman/src/com/stargus/platform"

  command="co -P -r V1_0_6_183 starman/src/com/stargus/web"

  command="co -P -r V1_0_6_183 starman/src/web"

  command="co -P -r V1_0_7_184 starman/src/com/stargus/platform/content"

That's what you wanted, right?



Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message