aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/vfs
diff options
context:
space:
mode:
authorGravatar Tobias Werth <twerth@google.com>2016-08-22 15:29:03 +0000
committerGravatar Philipp Wollermann <philwo@google.com>2016-08-23 09:28:16 +0000
commit846a5ab98fc26d72024890fdb79a5d3bc6a5a1ba (patch)
tree8abd94061a8f660e0a0ca8fa744e565f01813637 /src/main/java/com/google/devtools/build/lib/vfs
parent76a2bbcf5e20f42400a5dad47729553ce8514e66 (diff)
-- MOS_MIGRATED_REVID=130941264
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/vfs')
-rw-r--r--src/main/java/com/google/devtools/build/lib/vfs/UnixGlob.java17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/vfs/UnixGlob.java b/src/main/java/com/google/devtools/build/lib/vfs/UnixGlob.java
index 1ea067d20f..6da3925e96 100644
--- a/src/main/java/com/google/devtools/build/lib/vfs/UnixGlob.java
+++ b/src/main/java/com/google/devtools/build/lib/vfs/UnixGlob.java
@@ -23,9 +23,9 @@ import com.google.common.base.Throwables;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
-import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
+import com.google.common.collect.Ordering;
import com.google.common.collect.Sets;
import com.google.common.util.concurrent.ForwardingListenableFuture;
import com.google.common.util.concurrent.Futures;
@@ -55,8 +55,6 @@ import java.util.regex.Pattern;
*
* <p><code>**</code> gets special treatment in include patterns. If it is used as a complete path
* segment it matches the filenames in subdirectories recursively.
- *
- * <p>Importantly, note that the glob matches are in an unspecified order.
*/
public final class UnixGlob {
private UnixGlob() {}
@@ -398,7 +396,7 @@ public final class UnixGlob {
}
/**
- * Executes the glob and returns the result.
+ * Executes the glob.
*
* @throws InterruptedException if the thread is interrupted.
*/
@@ -501,10 +499,9 @@ public final class UnixGlob {
}
/**
- * Performs wildcard globbing: returns the list of filenames that match any of
+ * Performs wildcard globbing: returns the sorted list of filenames that match any of
* {@code patterns} relative to {@code base}. Directories are traversed if and only if they
- * match {@code dirPred}. The predicate is also called for the root of the traversal. The order
- * of the returned list is unspecified.
+ * match {@code dirPred}. The predicate is also called for the root of the traversal.
*
* <p>Patterns may include "*" and "?", but not "[a-z]".
*
@@ -533,10 +530,6 @@ public final class UnixGlob {
return "**".equals(pattern);
}
- /**
- * Same as {@link #glob}, except does so asynchronously and returns a {@link Future} for the
- * result.
- */
public Future<List<Path>> globAsync(Path base, Collection<String> patterns,
boolean excludeDirectories, Predicate<Path> dirPred, FilesystemCalls syscalls) {
@@ -642,7 +635,7 @@ public final class UnixGlob {
} else if (failure.get() != null) {
result.setException(failure.get());
} else {
- result.set(ImmutableList.copyOf(results));
+ result.set(Ordering.<Path>natural().immutableSortedCopy(results));
}
}
}