B.3 AppendTask

The Append Task appends text or contents of files to a specified file.

In the example above, AppendTask is reading a filename from book/PhingGuide.book, processing the file contents with XSLT, and then appending the result to the file located at ${process.outputfile}. This is a real example from the build file used to generate this book!

Table B.3: Attributes

destFileFilePath of file to which text should be appended. If not specified the console will be used instead.n/aNo
appendStringSpecifies whether or not the file specified by 'destfile' should be appended. Defaults to "yes".yesNo
overwriteBooleanSpecifies whether or not the file specified by 'destfile' should be written to even if it is newer than all source files.yesNo
fixlastlineBooleanSpecifies whether or not to check if each file concatenated is terminated by a new line. If this attribute is "yes" a new line will be appended to the stream if the file did not end in a new line. This attribute does not apply to embedded text.noNo
eolStringSpecifies what the end of line character are for use by the fixlastline attribute. Valid values for this property are:
  • cr: a single CR

  • lf: a single LF

  • crlf: the pair CRLF

  • mac: a single CR

  • unix: a single LF

  • dos: the pair CRLF

The default is platform dependent. For Unix platforms, the default is "lf". For DOS based systems (including Windows), the default is "crlf". For Mac OS, the default is "cr".
fileFilePath to file that should be appended to destFile.n/aNo
textStringSome literal text to append to file.n/aNo

B.3.1 Examples

<append destFile="${process.outputfile}">
                <xsltfilter style="${process.stylesheet}">
                <param name="mode" expression="${process.xslt.mode}"/>
                <filelist dir="book/" listfile="book/PhingGuide.book"/>

B.3.2 Supported Nested Tags

  • filelist

  • fileset

  • filterchain

  • path

  • header, footer Used to prepend or postpend text into the concatenated stream. The text may be in-line or be in a file.

    Table B.4: Attributes

    filteringBooleanWhether to filter the text provided by this sub element.yesNo
    fileStringA file to place at the head or tail of the concatenated text.n/aNo
    trimBooleanWhether to trim the value.noNo
    trimleadingBooleanWhether to trim leading white space on each line.noNo