7-Zip Tasks for NAnt

Markus Ewald <[email protected]>
Newsgroups gmane.comp.windows.dotnet.nant.user
Message-ID <[email protected]>
Hi!

Out of personal need (limited bandwidth for my continuous integration 
server) I wrote myself some NAnt tasks for creating 7-Zip archives. I 
intentionally didn't include any of the 7-Zip code but call 7z.exe 
(Windows) or 7za (Linux) which is located using the Registry (Windows 
only) or default paths (Windows and Linux).

Here's a usage example:

<sevenzip-compress archive="archive.7z" level="9" password="secret">
<fileset basedir="..">
<include name="Source/**/*" />
<exclude name="**/*.txt" />
</fileset>
</sevenzip-compress>

<sevenzip-extract archive="archiv.7z" todir="test" password="secret" />

Is there any interest for such a thing for NAnt/NAntContrib?

- I chose to create different tasks for compression and extraction 
because the parameters are different (and I didn't like how NAnt-Contrib 
designed the <svn /> task).
- Relying on an external executable has the advantage of not requiring 
different builds of the DLL for different platforms, but has the 
disadvantage of requiring 7-Zip to be installed on the build system. If 
am thinking about adding a 'path' parameter to the tasks so it's 
possible to specify which 7z.exe/7za to use, but this would also entail 
shipping 7-Zip binaries for all supported platforms with a development 
tree. The fate of the <nunit2 /> task ultimately convinced me that using 
the 7-Zip executable is better.

If anyone wants to check it out:
Source code (VS2010): 
https://devel.nuclex.org/sideprojects/svn/tasks/Nuclex.NAnt.Tasks/trunk/
Binaries: 
https://devel.nuclex.org/teamcity/viewLog.html?buildId=lastSuccessful&tab=artifacts&buildTypeId=bt3&guest=1 
<https://devel.nuclex.org/teamcity/viewLog.html?buildId=lastSuccessful&tab=artifacts&buildTypeId=bt3&guest=1>

The binaries are built against NAnt.Core from NAnt 0.90.3780.0. I 
haven't tried what happens when I attempt to load them with another NAnt 
release.

-Markus-


------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.