git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@955896 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -87,6 +87,14 @@ Other changes: | |||||
| earlier -propertfiles or defined via the -D option). | earlier -propertfiles or defined via the -D option). | ||||
| Bugzilla Report 18732. | Bugzilla Report 18732. | ||||
| * <pathelement>s can now contain wildcards in order to use wildcard | |||||
| CLASSPATH entries introduced with Java6. | |||||
| The wildcards are not expanded or even evaluated by Ant and will be | |||||
| used literally. The resulting path may be unusable as a CLASSPATH | |||||
| for Java versions prior to Java6 and likely doesn't mean anything | |||||
| when used in any other way than a CLASSPATH for a forked Java VM. | |||||
| Bugzilla Report 46842. | |||||
| Changes from Ant 1.8.0 TO Ant 1.8.1 | Changes from Ant 1.8.0 TO Ant 1.8.1 | ||||
| =================================== | =================================== | ||||
| @@ -262,6 +262,12 @@ or semicolon-separated lists of locations. The <code>path</code> | |||||
| attribute is intended to be used with predefined paths - in any other | attribute is intended to be used with predefined paths - in any other | ||||
| case, multiple elements with <code>location</code> attributes should be | case, multiple elements with <code>location</code> attributes should be | ||||
| preferred.</p> | preferred.</p> | ||||
| <p><em>Since Ant 1.8.2</em> the location attribute can also contain a | |||||
| wildcard in its last path component (i.e. it can end in a | |||||
| "*") in order to support wildcard CLASSPATHs introduced | |||||
| with Java6. Ant will not expand or evaluate the wildcards and the | |||||
| resulting path may not work as anything else but a CLASSPATH - or | |||||
| even as a CLASSPATH for a Java VM prior to Java6.</p> | |||||
| <p>As a shortcut, the <code><classpath></code> tag | <p>As a shortcut, the <code><classpath></code> tag | ||||
| supports <code>path</code> and | supports <code>path</code> and | ||||
| <code>location</code> attributes of its own, so:</p> | <code>location</code> attributes of its own, so:</p> | ||||
| @@ -342,6 +342,12 @@ public class Path extends DataType implements Cloneable, ResourceCollection { | |||||
| } | } | ||||
| if (f.exists()) { | if (f.exists()) { | ||||
| setLocation(f); | setLocation(f); | ||||
| } else if (f.getParentFile() != null && f.getParentFile().exists() | |||||
| && containsWildcards(f.getName())) { | |||||
| setLocation(f); | |||||
| log("adding " + f + " which contains wildcards and may not" | |||||
| + " do what you intend it to do depending on your OS or" | |||||
| + " version of Java", Project.MSG_VERBOSE); | |||||
| } else { | } else { | ||||
| log("dropping " + f + " from path as it doesn't exist", | log("dropping " + f + " from path as it doesn't exist", | ||||
| Project.MSG_VERBOSE); | Project.MSG_VERBOSE); | ||||
| @@ -759,4 +765,14 @@ public class Path extends DataType implements Cloneable, ResourceCollection { | |||||
| } | } | ||||
| return preserveBC.booleanValue(); | return preserveBC.booleanValue(); | ||||
| } | } | ||||
| /** | |||||
| * Does the given file name contain wildcards? | |||||
| * @since Ant 1.8.2 | |||||
| */ | |||||
| private static boolean containsWildcards(String path) { | |||||
| return path != null | |||||
| && (path.indexOf("*") > -1 || path.indexOf("?") > -1); | |||||
| } | |||||
| } | } | ||||
| @@ -39,4 +39,13 @@ | |||||
| </path> | </path> | ||||
| </target> | </target> | ||||
| <target name="test-wildcard" | |||||
| description="https://issues.apache.org/bugzilla/show_bug.cgi?id=46842"> | |||||
| <path id="with-wildcard"> | |||||
| <pathelement location="*"/> | |||||
| </path> | |||||
| <au:assertEquals expected="${basedir}${file.separator}*" | |||||
| actual="${toString:with-wildcard}"/> | |||||
| </target> | |||||
| </project> | </project> | ||||