peterreilly 2004/01/09 09:41:49 Modified: src/etc/testcases/taskdefs/fixcrlf Tag: ANT_16_BRANCH build.xml src/testcases/org/apache/tools/ant/taskdefs Tag: ANT_16_BRANCH FixCrLfTest.java src/main/org/apache/tools/ant/taskdefs Tag: ANT_16_BRANCH FixCRLF.java docs/manual/CoreTasks Tag: ANT_16_BRANCH fixcrlf.html Added: src/etc/testcases/taskdefs/fixcrlf/input Tag: ANT_16_BRANCH fixlastfalse.lf src/etc/testcases/taskdefs/fixcrlf/expected Tag: ANT_16_BRANCH fixlast.dos fixlastfalse.mac Log: Sync with head Revision Changes Path No revision No revision 1.9.2.1 +15 -0 ant/src/etc/testcases/taskdefs/fixcrlf/build.xml Index: build.xml =================================================================== RCS file: /home/cvs/ant/src/etc/testcases/taskdefs/fixcrlf/build.xml,v retrieving revision 1.9 retrieving revision 1.9.2.1 diff -u -r1.9 -r1.9.2.1 --- build.xml 24 Jun 2003 08:32:43 -0000 1.9 +++ build.xml 9 Jan 2004 17:41:49 -0000 1.9.2.1 @@ -142,6 +142,21 @@ /> </target> + <target name="testFixlastDos" depends="init"> + <fixcrlf srcdir="input" destdir="result" + includes="fixlastfalse.lf" + eol="crlf" + /> + </target> + + <target name="testFixlastFalseMac" depends="init"> + <fixcrlf srcdir="input" destdir="result" + includes="fixlastfalse.lf" + eol="cr" + fixlast="false" + /> + </target> + <!-- Bugzilla Report 20840 --> <target name="createParentDirs" depends="init"> <fixcrlf srcdir="." destdir="result" includes="input/Junk1.java"/> No revision No revision 1.14.2.1 +14 -2 ant/src/testcases/org/apache/tools/ant/taskdefs/FixCrLfTest.java Index: FixCrLfTest.java =================================================================== RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/taskdefs/FixCrLfTest.java,v retrieving revision 1.14 retrieving revision 1.14.2.1 diff -u -r1.14 -r1.14.2.1 --- FixCrLfTest.java 24 Jun 2003 08:32:43 -0000 1.14 +++ FixCrLfTest.java 9 Jan 2004 17:41:49 -0000 1.14.2.1 @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2001-2003 The Apache Software Foundation. All rights + * Copyright (c) 2001-2004 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -76,7 +76,7 @@ } public void tearDown() { - executeTarget("cleanup"); + //executeTarget("cleanup"); } public void test1() throws IOException { @@ -200,6 +200,18 @@ executeTarget("testCrCrLfSequence-mac"); assertEqualContent(new File("src/etc/testcases/taskdefs/fixcrlf/expected/crcrlf.mac"), new File("src/etc/testcases/taskdefs/fixcrlf/result/crcrlf")); + } + + public void testFixlastDos() throws IOException { + executeTarget("testFixlastDos"); + assertEqualContent(new File("src/etc/testcases/taskdefs/fixcrlf/expected/fixlast.dos"), + new File("src/etc/testcases/taskdefs/fixcrlf/result/fixlastfalse.lf")); + } + + public void testFixlastFalseMac() throws IOException { + executeTarget("testFixlastFalseMac"); + assertEqualContent(new File("src/etc/testcases/taskdefs/fixcrlf/expected/fixlastfalse.mac"), + new File("src/etc/testcases/taskdefs/fixcrlf/result/fixlastfalse.lf")); } /** No revision No revision 1.54.2.2 +18 -7 ant/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java Index: FixCRLF.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java,v retrieving revision 1.54.2.1 retrieving revision 1.54.2.2 diff -u -r1.54.2.1 -r1.54.2.2 --- FixCRLF.java 14 Oct 2003 13:20:11 -0000 1.54.2.1 +++ FixCRLF.java 9 Jan 2004 17:41:49 -0000 1.54.2.2 @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2000-2003 The Apache Software Foundation. All rights + * Copyright (c) 2000-2004 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -154,6 +154,7 @@ private int ctrlz; private int tabs; private boolean javafiles = false; + private boolean fixlast = true; private File srcDir; private File destDir = null; @@ -339,6 +340,14 @@ } /** + * Specify whether a missing EOL will be added + * to the final line of a file. + */ + public void setFixlast(boolean fixlast) { + this.fixlast = fixlast; + } + + /** * Executes the task. */ public void execute() throws BuildException { @@ -515,11 +524,13 @@ } // end of else (tabs != ASIS) - try { - outWriter.write(eolstr); - } catch (IOException e) { - throw new BuildException(e); - } // end of try-catch + if (!("".equals(line.getEol())) || fixlast) { + try { + outWriter.write(eolstr); + } catch (IOException e) { + throw new BuildException(e); + } // end of try-catch + } //end if non-blank original eol or fixlast } // end of while (lines.hasNext()) No revision No revision 1.1.2.1 +0 -0 ant/src/etc/testcases/taskdefs/fixcrlf/input/fixlastfalse.lf Index: fixlastfalse.lf =================================================================== RCS file: /home/cvs/ant/src/etc/testcases/taskdefs/fixcrlf/input/fixlastfalse.lf,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -u -r1.1 -r1.1.2.1 No revision No revision 1.1.2.1 +0 -0 ant/src/etc/testcases/taskdefs/fixcrlf/expected/fixlast.dos Index: fixlast.dos =================================================================== RCS file: /home/cvs/ant/src/etc/testcases/taskdefs/fixcrlf/expected/fixlast.dos,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -u -r1.1 -r1.1.2.1 1.1.2.1 +0 -0 ant/src/etc/testcases/taskdefs/fixcrlf/expected/fixlastfalse.mac Index: fixlastfalse.mac =================================================================== RCS file: /home/cvs/ant/src/etc/testcases/taskdefs/fixcrlf/expected/fixlastfalse.mac,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -u -r1.1 -r1.1.2.1 No revision No revision 1.14.2.2 +7 -2 ant/docs/manual/CoreTasks/fixcrlf.html Index: fixcrlf.html =================================================================== RCS file: /home/cvs/ant/docs/manual/CoreTasks/fixcrlf.html,v retrieving revision 1.14.2.1 retrieving revision 1.14.2.2 diff -u -r1.14.2.1 -r1.14.2.2 --- fixcrlf.html 9 Oct 2003 21:01:06 -0000 1.14.2.1 +++ fixcrlf.html 9 Jan 2004 17:41:49 -0000 1.14.2.2 @@ -220,6 +220,12 @@ <td valign="top">The encoding of the files</td> <td align="center">No - defaults to default JVM encoding</td> </tr> + <tr> + <td valign="top">fixlast</td> + <td valign="top">Whether to add a missing EOL to the last line + of a processed file. (Since ant 1.6.1)</td> + <td align="center">No - default is <i>true</i></td> + </tr> </table> <h3>Examples</h3> <pre> <fixcrlf srcdir="${src}" @@ -272,9 +278,8 @@ DOS systems, and are removed if run on Unix systems. You never know what editor a user will use to browse README's.</p> <hr> -<p align="center">Copyright © 2000-2003 Apache Software Foundation. All rights +<p align="center">Copyright © 2000-2004 Apache Software Foundation. All rights Reserved.</p> </body> </html> -
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]