Also put the schemavalidate in the right place in WHATSNEW. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277731 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -116,6 +116,11 @@ Other changes: | |||||
| * Tighten security by sending storepass and keypass to signjar | * Tighten security by sending storepass and keypass to signjar | ||||
| via the input stream of the forked process. | 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 | Changes from Ant 1.6.2 to current Ant 1.6 CVS version | ||||
| ===================================================== | ===================================================== | ||||
| @@ -222,9 +227,6 @@ Other changes: | |||||
| * Pathconvert no longer requires that one of (targetos|pathsep|dirsep) | * Pathconvert no longer requires that one of (targetos|pathsep|dirsep) | ||||
| be set; platform defaults are used when this is the case. | 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: | Fixed bugs: | ||||
| ----------- | ----------- | ||||
| @@ -51,8 +51,14 @@ supports all attributes of <code><fileset></code> | |||||
| <tr> | <tr> | ||||
| <td valign="top">srcDir</td> | <td valign="top">srcDir</td> | ||||
| <td valign="top">Where to find the files to be fixed up.</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> | ||||
| <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> | <tr> | ||||
| <td valign="top">destDir</td> | <td valign="top">destDir</td> | ||||
| <td valign="top">Where to place the corrected files. Defaults to | <td valign="top">Where to place the corrected files. Defaults to | ||||
| @@ -1,5 +1,5 @@ | |||||
| <?xml version="1.0"?> | <?xml version="1.0"?> | ||||
| <project default="cleanup" basedir="."> | |||||
| <project name="fixcrlf" default="cleanup" basedir="."> | |||||
| <target name="init"> | <target name="init"> | ||||
| <mkdir dir="result" /> | <mkdir dir="result" /> | ||||
| </target> | </target> | ||||
| @@ -162,4 +162,12 @@ | |||||
| <fixcrlf srcdir="." destdir="result" includes="input/Junk1.java"/> | <fixcrlf srcdir="." destdir="result" includes="input/Junk1.java"/> | ||||
| </target> | </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> | </project> | ||||
| @@ -121,11 +121,13 @@ public class FixCRLF extends MatchingTask { | |||||
| private File srcDir; | private File srcDir; | ||||
| private File destDir = null; | private File destDir = null; | ||||
| private File file; | |||||
| /** | /** | ||||
| * Encoding to assume for the files | * Encoding to assume for the files | ||||
| */ | */ | ||||
| private String encoding = null; | 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. | * Defaults the properties based on the system type. | ||||
| @@ -172,6 +174,14 @@ public class FixCRLF extends MatchingTask { | |||||
| this.javafiles = javafiles; | 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. | * Specify how EndOfLine characters are to be handled. | ||||
| @@ -314,6 +324,15 @@ public class FixCRLF extends MatchingTask { | |||||
| public void execute() throws BuildException { | public void execute() throws BuildException { | ||||
| // first off, make sure that we've got a srcdir and destdir | // 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) { | if (srcDir == null) { | ||||
| throw new BuildException("srcdir attribute must be set!"); | throw new BuildException("srcdir attribute must be set!"); | ||||
| } | } | ||||
| @@ -745,7 +764,7 @@ public class FixCRLF extends MatchingTask { | |||||
| } | } | ||||
| class OneLiner implements Enumeration { | |||||
| protected class OneLiner implements Enumeration { | |||||
| private int state = javafiles ? LOOKING : NOTJAVA; | private int state = javafiles ? LOOKING : NOTJAVA; | ||||
| @@ -175,6 +175,18 @@ public class FixCrLfTest extends BuildFileTest { | |||||
| new File(System.getProperty("root"), "src/etc/testcases/taskdefs/fixcrlf/result/fixlastfalse.lf")); | 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 | * Bugzilla Report 20840 | ||||
| * | * | ||||