10

In my build script I'm trying to output the date and SVN revision number to a file in the build directory. I would like the date and revision number on separate line, but can't get a linebreak to output to the file. I've tried all sorts of methods:

    <echo file="${build.dir}\build.txt">DATE = ${DATE} \r\n \\\r\\\n PHP_EOL</echo>
    <echo msg="DATE: ${DATE} \r\n \\\r\\\n PHP_EOL 0x0D0A SVN revision: ${svn.lastrevision} . PHP_EOL" file="${build.dir}\build.txt" append="true" />

Has anyone else managed to get a linebreak through to file with Phing? I've looked at the code in phing, and it uses fwrite. I can only guess the strings in my build.xml are getting escaped in some way before being handled by fwrite?

I guess I may have to resort to using ExecTask?

ChrisA
  • 2,091
  • 1
  • 14
  • 23

1 Answers1

16

You can make use of ${line.separator}, see Built-In PropertiesDocs.

<echo msg="DATE: ${DATE}${line.separator}SVN revision: ${svn.lastrevision}${line.separator}" file="${build.dir}\build.txt" append="true" />
r15ch13
  • 327
  • 2
  • 14
hakre
  • 193,403
  • 52
  • 435
  • 836