ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Reeves, Paul C" <pcre...@sandia.gov>
Subject RE: Rant on immutable properties
Date Tue, 03 Aug 2004 13:21:01 GMT
Have a look at this snip of code.  I am iterating over a list of properties
that have numbers embedded in the property name:

${ant.project.name}.build_command.###.antfile
${ant.project.name}.build_command.###.dir
${ant.project.name}.build_command.###.target

In the <for> loop I increment a variable counter (build_cnt), which is a
<var>.  It is increased by "1" each iteration of the loop.



    <var name="build_cnt"  value="0"/>
    <var name="incr" value="1"/>
    <var name="op"   value="+"/>
    
    <!--Iterate over the custom ant build commands -->                      
    <for list       = "${proj.build_commands}" 
         delimiter  = ","
         param      = "string">

      <sequential>
      
        <math result    = "build_cnt" 
              operand1  = "${build_cnt}" 
              operation = "+" 
              operand2  = "${incr}" 
              datatype  = "int"/>
              
        <propertycopy name     = "proj.ant_build.antfile"  
                      from     =
"${ant.project.name}.build_command.${build_cnt}.antfile"
                      override = "true"
                      silent   = "true"/>
        <propertycopy name     = "proj.ant_build.dir"  
                      from     =
"${ant.project.name}.build_command.${build_cnt}.dir"
                      override = "true"
                      silent   = "true"/>
        <propertycopy name     = "proj.ant_build.target"  
                      from     =
"${ant.project.name}.build_command.${build_cnt}.target"
                      override = "true"
                      silent   = "true"/>



-----Original Message-----
From: mail.laconiadatasystems.com
[mailto:webmaster@laconiadatasystems.com]
Sent: Monday, August 02, 2004 8:02 PM
To: Ant Users List
Subject: Re: Rant on immutable properties


Yes that is what I am using now-
But I need an integer property/variable
Thanks,
Martin
----- Original Message -----
From: "Rhino" <rhino1@sympatico.ca>
To: "Ant Users List" <user@ant.apache.org>
Sent: Monday, August 02, 2004 8:53 AM
Subject: Re: Rant on immutable properties


>
> ----- Original Message -----
> From: "Martin Gainty" <mgainty@hotmail.com>
> To: <user@ant.apache.org>
> Sent: Friday, July 30, 2004 1:23 PM
> Subject: Rant on immutable properties
>
>
> > Hello All
> >
> > I have need to set the value of a property based on user input
> > but cannot do so because properties are immutable?
> >
> > Is there a workaround?
> >
> Have you considered the 'input' core task? You could ask the user to
supply
> a value while the script executes and use the returned value in your
script.
>
> Rhino
>
>
> ---------------------------------------------------------------------
> 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