diff --git a/WHATSNEW b/WHATSNEW index 1a5d5d940..e36978588 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -85,7 +85,7 @@ Other changes: * There is now a FileProvider interface for resources that act as a source of filenames. This should be used by tasks that require resources to provide filenames, rather than require that all resources - are instances or subclasses of FileResource + are instances or subclasses of FileResource. Bugzilla report 43348 * Fixcrlf now gives better error messages on bad directory attributes. @@ -98,6 +98,9 @@ Other changes: list of the targets that have been specified on the command line (the IDE, an task ...) when invoking the current project. + * The resource selector has had an "any" type added for better + configurability. + Changes from Ant 1.7.0 TO Ant 1.7.1 ============================================= diff --git a/src/main/org/apache/tools/ant/types/resources/selectors/Type.java b/src/main/org/apache/tools/ant/types/resources/selectors/Type.java index 2fb6130a7..2a9c66eb4 100755 --- a/src/main/org/apache/tools/ant/types/resources/selectors/Type.java +++ b/src/main/org/apache/tools/ant/types/resources/selectors/Type.java @@ -29,6 +29,7 @@ public class Type implements ResourceSelector { private static final String FILE_ATTR = "file"; private static final String DIR_ATTR = "dir"; + private static final String ANY_ATTR = "any"; /** Static file type selector. */ public static final Type FILE = new Type(new FileDir(FILE_ATTR)); @@ -36,11 +37,14 @@ public class Type implements ResourceSelector { /** Static dir type selector. */ public static final Type DIR = new Type(new FileDir(DIR_ATTR)); + /** Static any type selector. Since Ant 1.8. */ + public static final Type ANY = new Type(new FileDir(ANY_ATTR)); + /** * Implements the type attribute. */ public static class FileDir extends EnumeratedAttribute { - private static final String[] VALUES = new String[] {FILE_ATTR, DIR_ATTR}; + private static final String[] VALUES = new String[] { FILE_ATTR, DIR_ATTR, ANY_ATTR }; /** * Default constructor. @@ -99,7 +103,7 @@ public class Type implements ResourceSelector { throw new BuildException("The type attribute is required."); } int i = type.getIndex(); - return r.isDirectory() ? i == 1 : i == 0; + return i == 2 || (r.isDirectory() ? i == 1 : i == 0); } } diff --git a/src/tests/antunit/types/resources/selectors/test.xml b/src/tests/antunit/types/resources/selectors/test.xml index 1584ecde9..24b804a36 100755 --- a/src/tests/antunit/types/resources/selectors/test.xml +++ b/src/tests/antunit/types/resources/selectors/test.xml @@ -15,10 +15,12 @@ See the License for the specific language governing permissions and limitations under the License. --> - + + @@ -145,19 +147,36 @@ + + + + + + - - - - - - + + + + + + + + + + + + + + + + +