git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@808421 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -934,6 +934,8 @@ Other changes: | |||||
| attribute different from the <classfileset>. | attribute different from the <classfileset>. | ||||
| Bugzilla Report 37763. | Bugzilla Report 37763. | ||||
| * <path> can now optionally cache its contents. | |||||
| Changes from Ant 1.7.0 TO Ant 1.7.1 | Changes from Ant 1.7.0 TO Ant 1.7.1 | ||||
| ============================================= | ============================================= | ||||
| @@ -551,6 +551,18 @@ you can define them with a <code><path></code> element at the | |||||
| same level as <i>target</i>s, and reference them via their | same level as <i>target</i>s, and reference them via their | ||||
| <i>id</i> attribute--see <a href="#references">References</a> for an | <i>id</i> attribute--see <a href="#references">References</a> for an | ||||
| example.</p> | example.</p> | ||||
| <p>By default a path like structure will re-evaluate all nested | |||||
| resource collections whenever it is used, which may lead to | |||||
| unnecessary re-scanning of the filesystem. Since Ant 1.8.0 path has | |||||
| an optional <i>cache</i> attribute, if it is set to true, the path | |||||
| instance will only scan its nested resource collections once and | |||||
| assume it doesn't change during the build anymore (the default | |||||
| for <i>cache</i> still is <i>false</i>). Even if you are using the | |||||
| path only in a single task it may improve overall performance to set | |||||
| <i>cache</i> to <i>true</i> if you are using complex nested | |||||
| constructs.</p> | |||||
| <p>A path-like structure can include a reference to another path-like | <p>A path-like structure can include a reference to another path-like | ||||
| structure (a path being itself a resource collection) | structure (a path being itself a resource collection) | ||||
| via nested <code><path></code> elements:</p> | via nested <code><path></code> elements:</p> | ||||
| @@ -563,7 +575,7 @@ via nested <code><path></code> elements:</p> | |||||
| <pathelement location="classes"/> | <pathelement location="classes"/> | ||||
| </path> | </path> | ||||
| <path id="tests.path"> | |||||
| <path id="tests.path" cache="true"> | |||||
| <path refid="base.path"/> | <path refid="base.path"/> | ||||
| <pathelement location="testclasses"/> | <pathelement location="testclasses"/> | ||||
| </path> | </path> | ||||
| @@ -78,6 +78,11 @@ public class Path extends DataType implements Cloneable, ResourceCollection { | |||||
| public static Path systemBootClasspath = | public static Path systemBootClasspath = | ||||
| new Path(null, System.getProperty("sun.boot.class.path")); | new Path(null, System.getProperty("sun.boot.class.path")); | ||||
| static { | |||||
| systemClasspath.setCache(true); | |||||
| systemBootClasspath.setCache(true); | |||||
| } | |||||
| private static final Iterator EMPTY_ITERATOR | private static final Iterator EMPTY_ITERATOR | ||||
| = Collections.EMPTY_SET.iterator(); | = Collections.EMPTY_SET.iterator(); | ||||
| @@ -145,6 +150,7 @@ public class Path extends DataType implements Cloneable, ResourceCollection { | |||||
| private Boolean preserveBC; | private Boolean preserveBC; | ||||
| private Union union = null; | private Union union = null; | ||||
| private boolean cache = false; | |||||
| /** | /** | ||||
| * Invoked by IntrospectionHelper for <code>setXXX(Path p)</code> | * Invoked by IntrospectionHelper for <code>setXXX(Path p)</code> | ||||
| @@ -280,7 +286,7 @@ public class Path extends DataType implements Cloneable, ResourceCollection { | |||||
| if (union == null) { | if (union == null) { | ||||
| union = new Union(); | union = new Union(); | ||||
| union.setProject(getProject()); | union.setProject(getProject()); | ||||
| union.setCache(false); | |||||
| union.setCache(cache); | |||||
| } | } | ||||
| union.add(c); | union.add(c); | ||||
| setChecked(false); | setChecked(false); | ||||
| @@ -348,6 +354,17 @@ public class Path extends DataType implements Cloneable, ResourceCollection { | |||||
| } | } | ||||
| } | } | ||||
| /** | |||||
| * Whether to cache the current path. | |||||
| */ | |||||
| public void setCache(boolean b) { | |||||
| checkAttributesAllowed(); | |||||
| cache = b; | |||||
| if (union != null) { | |||||
| union.setCache(b); | |||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * Returns all path elements defined by this and nested path objects. | * Returns all path elements defined by this and nested path objects. | ||||
| * @return list of path elements. | * @return list of path elements. | ||||