ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Weintraub" <qazw...@gmail.com>
Subject Re: Variables and zip file comments
Date Wed, 28 Nov 2007 01:00:02 GMT
You cannot reset the value of a property. They are not variables because
they don't vary. Once you set the value of a property, you cannot change it.
There are a couple of ways to handle what you want:
* Use <antcall> or <macrodef>. These allow you to pass parameters that will
set properties inside the calls. See the example below.

* Use the AntContrib's variable task. This (unlike <properties> is a true
variable.
  See http://ant-contrib.sourceforge.net/tasks/tasks/variable_task.html

Here's how to use <antcall> to be able to change the comment. <macrodef> is
very similar:

<target name="main">
    <antcall target="ziptask">
        <param name="zipComment" value="Comment #1"/>
        <param name="zipDir" value="mydir1"/>
        <param name="zipName" value="zip1.zip"/>
    </antcall>

    <antcall task="ziptask">
        <param name="zipComment" value="Comment #2"/>
        <param name="zipDir" value="mydir2"/>
        <param name="zipName" value="zip2.zip"/>
    </antcall>
</target>

<target name="ziptask">
    <zip destfile="${zipName}"
       basedir="${zipDir}"
       comment="${zipComment}"/>
</target>


On Nov 27, 2007 1:15 PM, Chuck Holzwarth <chuck_holzwarth@yahoo.com> wrote:

> The builds I do are differential builds. I use svn diff to gather the
> diffs. The system is composed of several modules. Each module goes into its
> own zip file. When code is released, the zip files require a comment that
> contains, among other things, the names of all of the zip files that are
> part of the release.
>
> I have been trying to set a variable with the list of module file names.
> The problem I have is that when the target where I set the variable exits,
> the variable reverts to the previous value. Is there a way to make a
> variable persistent?
>
> In the mean time, I have been creating a file that contains the zip file
> comment. I have not been able to insert the comment in the zip file using
> the zip comment function.
> Can anyone provide an example of reading a file, carriage returns and all,
> into a variable or property and adding to the zip file as a comment?
> Can anyone provide an example of using the zip target to add the contents
> of a file to the zip file as a comment?
>
> Thank you,
> Chuck Holzwarth
>
>
>
>
>
>  ____________________________________________________________________________________
> Be a better sports nut!  Let your teams follow you
> with Yahoo Mobile. Try it now.
> http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ
>



-- 
--
David Weintraub
qazwart@gmail.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message