We haven't done this in a while (used the <zip> task), but when we did,
I had this same problem and ended up doing a file copy where your <if>
test is and then calling the <zip> task once with the contents of the
temporary subdirectory as the <fileset>.  Admittedly, there might have
been a more elegant solution, but I was in a hurry at the time and it
didn't seem that big a deal to just copy the files, since the entire
build directory gets purged at the beginning of each build, preventing
bloat.
 
Tony

________________________________

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Shelly
Midha
Sent: Tuesday, May 10, 2005 5:30 AM
To: Nant-users@lists.sourceforge.net
Subject: [Nant-users] including files in a zipfile using <zip> task
Importance: Low



I want to include files in an existing zip file using <zip> task, based
on a specific criterion.

 

If I include the condition with in the <zip> task, it is not supported.
I've written a separate target that includes files in the zip.

 

Every time this target is called, it overwrites the zip file and creates
new one. 

 

Here is the code for the two targets I'm using:

 

<target name="include-db-full">

            <foreach item="File" property="filename">

                        <in>

                              <items>

                                    <include
name="${build.path}\**\*.sql"/>

                              </items>

                        </in>

                        <do>

                              <if test = "${string::contains(filename,
'full')== true}" >

                                    <echo message = "${filename}"/>

                                    <call
target="include-sql-in-package"/>

                              </if>

                        </do>

            </foreach>

      </target>

      

      <target name="include-sql-in-package">

            <zip zipfile="${build.zipfile}" ziplevel="9">   

                  <fileset basedir="${build.path}">

                        <include name="${filename}"/>

                  </fileset>

            </zip>

      </target>

 

Any pointers to resolve the same will be helpful.

 

Thanks 

Shelly



-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_ids93&alloc_id281&op=click
_______________________________________________
Nant-users mailing list
Nant-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to