Echo linebreak在Windows上使用Phing文件 [英] Echo linebreak to file using Phing on Windows

查看:177
本文介绍了Echo linebreak在Windows上使用Phing文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的构建脚本中,我试图将日期和SVN版本号输出到build目录中的一个文件中。我想在日期和修订号码在单独的行,但不能得到linebreak输出到文件。我尝试了各种各样的方法:

 < echo file =$ {build.dir} \build.txt > DATE = $ {DATE} \r\\\
\\\\\\\\\ PHP_EOL< / echo>

是否有其他人设法通过Phing获得换行?我已经看了phing中的代码,它使用fwrite。我只能猜测我的build.xml中的字符串正在以某种方式越过被fwrite处理之前?\\ b
$ b我想我可能不得不诉诸使用ExecTask?

解决方案

您可以使用 $ {line.separator} 请参阅内置属性 文档

 < echo msg =DATE:$ {DATE} $ {line。 SVN修订版:$ {svn.lastrevision} $ {line.separator}file =$ {build.dir} \build.txtappend =true/> 


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?

解决方案

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" />

这篇关于Echo linebreak在Windows上使用Phing文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆