stevel 2005/02/24 16:33:01 Modified: docs/manual/CoreTasks fixcrlf.html src/etc/testcases/taskdefs/fixcrlf build.xml src/main/org/apache/tools/ant/taskdefs FixCRLF.java src/testcases/org/apache/tools/ant/taskdefs FixCrLfTest.java . WHATSNEW Log: fixcrlf gets a new attribute to make it easier to fix a single file. no nested filesets for <fileset file>, see. Also put the schemavalidate in the right place in WHATSNEW. Revision Changes Path 1.17 +7 -1 ant/docs/manual/CoreTasks/fixcrlf.html Index: fixcrlf.html =================================================================== RCS file: /home/cvs/ant/docs/manual/CoreTasks/fixcrlf.html,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- fixcrlf.html 9 Feb 2004 21:50:05 -0000 1.16 +++ fixcrlf.html 25 Feb 2005 00:33:00 -0000 1.17 @@ -51,9 +51,15 @@ <tr> <td valign="top">srcDir</td> <td valign="top">Where to find the files to be fixed up.</td> - <td valign="top" align="center">Yes</td> + <td valign="top" align="center">Either file or srcDir</td> </tr> <tr> + <td valign="top">file</td> + <td valign="top">Name of a single file to fix. Since Ant1.7</td> + <td valign="top" align="center">Either file or srcDir</td> + </tr> + + <tr> <td valign="top">destDir</td> <td valign="top">Where to place the corrected files. Defaults to srcDir (replacing the original file)</td> 1.11 +9 -1 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.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- build.xml 9 Jan 2004 17:36:15 -0000 1.10 +++ build.xml 25 Feb 2005 00:33:00 -0000 1.11 @@ -1,5 +1,5 @@ <?xml version="1.0"?> -<project default="cleanup" basedir="."> +<project name="fixcrlf" default="cleanup" basedir="."> <target name="init"> <mkdir dir="result" /> </target> @@ -162,4 +162,12 @@ <fixcrlf srcdir="." destdir="result" includes="input/Junk1.java"/> </target> + <target name="testFixFile" depends="init"> + <fixcrlf file="input/longlines.crlf" destdir="result" /> + </target> + + <target name="testFixFileExclusive" depends="init"> + <fixcrlf file="input/longlines.crlf" srcdir="input" destdir="result"/> + </target> + </project> 1.64 +21 -2 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.63 retrieving revision 1.64 diff -u -r1.63 -r1.64 --- FixCRLF.java 6 Jan 2005 12:05:05 -0000 1.63 +++ FixCRLF.java 25 Feb 2005 00:33:00 -0000 1.64 @@ -121,11 +121,13 @@ private File srcDir; private File destDir = null; + private File file; /** * Encoding to assume for the files */ private String encoding = null; + public static final String ERROR_FILE_AND_SRCDIR = "srcdir and file are mutually exclusive"; /** * Defaults the properties based on the system type. @@ -172,6 +174,14 @@ this.javafiles = javafiles; } + /** + * set a single file to convert + * @since Ant1.7 + * @param file + */ + public void setFile(File file) { + this.file = file; + } /** * Specify how EndOfLine characters are to be handled. @@ -314,6 +324,15 @@ public void execute() throws BuildException { // first off, make sure that we've got a srcdir and destdir + if(file!=null) { + if(srcDir!=null) { + throw new BuildException(ERROR_FILE_AND_SRCDIR); + } + //patch file into the fileset + fileset.setFile(file); + //set our parent dir + srcDir=file.getParentFile(); + } if (srcDir == null) { throw new BuildException("srcdir attribute must be set!"); } @@ -745,7 +764,7 @@ } - class OneLiner implements Enumeration { + protected class OneLiner implements Enumeration { private int state = javafiles ? LOOKING : NOTJAVA; 1.23 +12 -0 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.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- FixCrLfTest.java 17 Dec 2004 14:12:08 -0000 1.22 +++ FixCrLfTest.java 25 Feb 2005 00:33:00 -0000 1.23 @@ -175,6 +175,18 @@ new File(System.getProperty("root"), "src/etc/testcases/taskdefs/fixcrlf/result/fixlastfalse.lf")); } + public void testFixFile() throws Exception { + executeTarget("testFixFile"); + File created= new File(System.getProperty("root"), + "src/etc/testcases/taskdefs/fixcrlf/result/longlines.crlf"); + assertTrue("didnt create output file",created.exists()); + } + + public void testFixFileExclusive() throws Exception { + expectBuildExceptionContaining("testFixFileExclusive", + FixCRLF.ERROR_FILE_AND_SRCDIR, FixCRLF.ERROR_FILE_AND_SRCDIR); + } + /** * Bugzilla Report 20840 * 1.756 +5 -3 ant/WHATSNEW Index: WHATSNEW =================================================================== RCS file: /home/cvs/ant/WHATSNEW,v retrieving revision 1.755 retrieving revision 1.756 diff -u -r1.755 -r1.756 --- WHATSNEW 24 Feb 2005 20:18:21 -0000 1.755 +++ WHATSNEW 25 Feb 2005 00:33:00 -0000 1.756 @@ -116,6 +116,11 @@ * Tighten security by sending storepass and keypass to signjar via the input stream of the forked process. +* New task <schemavalidate> extends <xmlvalidate> with extra support + for XML Schema (XSD) files. + +* <fixcrlf> supports a file attribute for easy fixup of a single file. + Changes from Ant 1.6.2 to current Ant 1.6 CVS version ===================================================== @@ -222,9 +227,6 @@ * Pathconvert no longer requires that one of (targetos|pathsep|dirsep) be set; platform defaults are used when this is the case. - -* New task <schemavalidate> extends <xmlvalidate> with extra support - for XML Schema (XSD) files. Fixed bugs: -----------
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]