You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Stefan Bodewig <bo...@apache.org> on 2008/09/19 09:49:30 UTC

Sort Order of DirectoryScanner Results (was Re: DirectoryScanner performance)

On Thu, 18 Sep 2008, Steve Loughran <st...@apache.org> wrote:

> Kevin Jackson wrote:
> 
> > That's a huge difference - what are we doing now in 1.7.1 that is
> > different from before?
> 
> I think it tries to sort stuff less.
>
> This broke hadoop builds as their class structure was wrong
> https://issues.apache.org/jira/browse/HADOOP-3907

Once upon a time DirectoryScanner used to return files in a
predictable order - something like DFS where the files from
directories appear as directories are visited in DFS order.

The order of files coming from the same directory as well as
directories at the same height in the tree dependend on File.list and
likely was in lexicographic order.

This still is true if there is a basedir and DirectoryScanner decides
that it needs to scan the full tree, but starting with rev 274819
(i.e. <https://issues.apache.org/bugzilla/show_bug.cgi?id=20103>,
which means Ant 1.6) this is not true if there are only include
patterns that don't start with wildcards.

In the later case only the directories that could be included will be
scanned and order of directories is undefined (they get added as keys
to a map and then scanned in iterator order of the map).

Given that this happened such a long time ago, we can savely assume
that in general order of files/directories returned by
DirectoryScanner is not defined.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: Sort Order of DirectoryScanner Results

Posted by Stefan Bodewig <bo...@apache.org>.
forget what I've written, getIncludedFiles and getIncludedDirectories
both have an Arrays.sort() in them, so sort order should be
predicatble and stable.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org