在 Windows 上使用 Phing 将换行符回显到文件
在我的构建脚本中,我尝试将日期和 SVN 修订号输出到构建目录中的文件中。我希望将日期和修订号放在单独的行上,但无法将换行符输出到文件中。我尝试过各种方法:
<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" />
还有其他人设法使用 Phing 进行换行吗?我查看了 phing 中的代码,它使用了 fwrite。我只能猜测 build.xml 中的字符串在被 fwrite 处理之前以某种方式被转义了?
我想我可能不得不求助于使用 ExecTask?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用
${line.separator}
,请参阅 内置属性文档。You can make use of
${line.separator}
, see Built-In PropertiesDocs.