The distribution file AppleCommander-version-ac.jar provides an Ant task that can be used as part of Ant-based builds.
Using the Apple Commander Ant task
The AppleCommander ant task mirrors the ac command line as much as possible. The advantage over using the ant task over simply calling the AppleCommander command line directly is speed. It is much faster to call on the ant task than it is for ant to shell out to the system, fire up a Java instance, and then execute your command.
As with any external ant task, the first thing that must be done is to declare a taskdef:<taskdef name="appleCommander" classname="com.webcodepro.applecommander.ui.AntTask" classpath="AppleCommander-${version}-ac.jar"/>Where ${version} would need to be defined by you to be the version of the command-line AppleCommander you are using. The first version of the AC command line that included this ant task support is 1.3.5.13.
Once you have the taskdef defined, it can be called from within ant like this:
<!-- Call AppleCommander to print information about the disk image --> <appleCommander command="i" imagename="${myDiskImage}" />The values for command that the ant task understands generally mirror those of the command line. Here's a list of them, along with their required and optional parameters:
i <imagename> display information about an image. ls <imagename> list brief directory of an image. l <imagename> list directory of an image. ll <imagename> list detailed directory of an image. e <imagename> <filename> export file from image to stdout. x <imagename> [<outputpath>] extract all files from image to outputpath, or the current working directory if blank. g <imagename> <filename> get raw file from image to stdout. p <imagename> <filename> <type> [[$|0x]<addr>] put stdin in filename on image, using file type and address [0x2000]. d <imagename> <filename> delete file from image. k <imagename> <filename> lock file on image. u <imagename> <filename> unlock file on image. n <imagename> <volname> change volume name (ProDOS or Pascal). cc65 <imagename> <filename> <type> put stdin with cc65 header in filename on image, using file type and address from header. dos140 <imagename> create a 140K DOS 3.3 image. pro140 <imagename> <volname> create a 140K ProDOS image. pro800 <imagename> <volname> create an 800K ProDOS image. pas140 <imagename> <volname> create a 140K Pascal image. pas800 <imagename> <volname> create an 800K Pascal image. convert <filename> <imagename> [<sizeblocks>] uncompress a ShrinkIt or Binary II file; or convert a DiskCopy 4.2 image into a ProDOS disk image.For the commands that require a type parameter, their values depend on the operating system of the underlying image's operating system:
<appleCommander command="p" input="manifest.mf" imagename="${myDiskImage}" filename="MANIFEST" type="T" />AppleCommander ant tasks can be told to ignore errors with the failonerror parameter:
<appleCommander command="p" failonerror="false" input="${hugeFileExpectFailure}" imagename="${pro800image}" filename="BLOWUP" type="txt" />