Run the ANT build file included at the end on a Win2K machine, and open each
output log file in Notepad, and you'll see that only log2.txt has correct
line terminations for windows. As I said, I think this is a bug of ANT 1.4.1
on Windows, or someone has to explain to me why this is not a bug...
There should be a better way to output multi-line info to a file than:
<echo file="${log2}" append="yes"
message="line 1${nl}" />
<echo file="${log2}" append="yes"
message="line 2${nl}" />
And it should be either of the following:
<echo file="${log2}" append="yes"
message="line 1" />
<echo file="${log2}" append="yes"
message="line 2" />
<echo file="${log2}" append="yes">
line 1
line 2
</echo>
with option to target a specific OS other than the one used for the build,
to have the correct line termination on MacOS/*nix/Win32, and also an option
to strip the very beginning and end of Text section to avoid having to
write:
<echo file="${log2}" append="yes">line 1
line 2</echo>
when one doesn't want the extra line terminations.
I'm sure someone will point out I should use <copy> with a filter instead,
but there's an <echo> task that also serves some purpose, and should be made
to work according to people expectations.
Regards, --DD
<?xml version="1.0"?>
<!-- ANT build file to test a specific feature or bug of ANT.
Dominique Devienne <[EMAIL PROTECTED]> April 2002
-->
<project name="echo-newline" default="test" basedir=".">
<target name="init">
<property name="nl"
value="${line.separator}" />
<property name="outdir"
location="${ant.project.name}" />
<property name="log1"
value="${outdir}/log1.txt" />
<property name="log2"
value="${outdir}/log2.txt" />
<property name="log3"
value="${outdir}/log3.txt" />
<property name="log4"
value="${outdir}/log4.txt" />
<property name="log5"
value="${outdir}/log5.txt" />
<property name="log6"
value="${outdir}/log6.txt" />
<mkdir dir="${outdir}" />
</target>
<target name="test"
depends="init">
<echo message="Output ${log1}" />
<echo file="${log1}" append="yes"
message="line 1" />
<echo file="${log1}" append="yes"
message="line 2" />
<echo message="Output ${log2}" />
<echo file="${log2}" append="yes"
message="line 1${nl}" />
<echo file="${log2}" append="yes"
message="line 2${nl}" />
<echo message="Output ${log3}" />
<echo file="${log3}" append="yes"
message="line 1 " />
<echo file="${log3}" append="yes"
message="line 2 " />
<echo message="Output ${log4}" />
<echo file="${log4}" append="yes">
line 1
line 2
</echo>
<echo message="Output ${log5}" />
<echo file="${log5}" append="yes">
line 1${nl}
line 2${nl}
</echo>
<echo message="Output ${log6}" />
<echo file="${log6}" append="yes">
line 1
line 2
</echo>
</target>
</project>
-----Original Message-----
From: John Keyes [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 29, 2002 12:21 PM
To: Ant Users List
Subject: Re: new line in echo
Try:
<echo file="${logdir}/${logfile}" append="true">WmlDeviceAdapter
Failed </echo>
-John K
> <echo file="${logdir}/${logfile}" append="true">WmlDeviceAdapter Failed
> </echo>
>
> thanks for the reply,
>
>
>
>
> --
> To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>