Cab

Description

The cab task creates Microsoft cab archive files. It is invoked similar to the jar or zip tasks. This task will work on Windows using the external cabarc tool (provided by Microsoft) which must be located in your executable path.

To use this task on other platforms you need to download and compile libcabinet from http://trill.cis.fordham.edu/~barbacha/cabinet_library/.

See the section on directory based tasks, on how the inclusion/exclusion of files works, and how to write patterns.

This task forms an implicit FileSet and supports most attributes of <fileset> (dir becomes basedir) as well as the nested <include>, <exclude> and <patternset> elements.

On non-Unix platforms this task writes the list of files to archive to the temporary directory.

Parameters

Attribute Description Required
cabfile the name of the cab file to create. Yes
basedir the directory to start archiving files from. No
verbose set to "yes" if you want to see the output from the cabarc tool. defaults to "no". No
compress set to "no" to store files without compressing. defaults to "yes". No
options use to set additional command-line options for the cabarc tool. should not normally be necessary. No
includes comma- or space-separated list of patterns of files that must be included. All files are included when omitted. No
includesfile the name of a file. Each line of this file is taken to be an include pattern No
excludes comma- or space-separated list of patterns of files that must be excluded. No files (except default excludes) are excluded when omitted. No
excludesfile the name of a file. Each line of this file is taken to be an exclude pattern No
defaultexcludes indicates whether default excludes should be used or not ("yes"/"no"). Default excludes are used when omitted. No

Parameters specified as nested elements

fileset

The cab task supports one nested <fileset> element to specify the files to be included in the archive. If this is specified, the "basedir" attribute cannot be used.

Examples

<cab cabfile="${dist}/manual.cab"
     basedir="htdocs/manual"
  />

cabs all files in the htdocs/manual directory into a file called manual.cab in the ${dist} directory.

<cab cabfile="${dist}/manual.cab"
     basedir="htdocs/manual"
     excludes="mydocs/**, **/todo.html"
  />

cabs all files in the htdocs/manual directory into a file called manual.cab in the ${dist} directory. Files in the directory mydocs, or files with the name todo.html are excluded.

<cab cabfile="${dist}/manual.cab"
     basedir="htdocs/manual"
     includes="api/**/*.html"
     excludes="**/todo.html"
     verbose="yes"
  />

Cab all files in the htdocs/manual directory into a file called manual.cab in the ${dist} directory. Only html files under the directory api are archived, and files with the name todo.html are excluded. Output from the cabarc tool is displayed in the build output.

<cab cabfile="${dist}/manual.cab"
     verbose="yes">
  <fileset
       dir="htdocs/manual"
       includes="api/**/*.html"
       excludes="**/todo.html"
  />
</cab>

is equivalent to the example above.