Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Echo linebreak to file using Phing on Windows

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?

like image 393
ChrisA Avatar asked Aug 09 '11 10:08

ChrisA


1 Answers

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" />
like image 85
hakre Avatar answered Oct 09 '22 22:10

hakre