aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/vfs/UnixGlob.java
diff options
context:
space:
mode:
authorGravatar Nathan Harmata <nharmata@google.com>2016-08-23 21:22:17 +0000
committerGravatar John Cater <jcater@google.com>2016-08-23 23:00:29 +0000
commit44e1e3a75c76a8fd3d73a79ce67975958f9cac55 (patch)
tree8da6475e2419e836c7615ba9c993f552ce5ddc54 /src/main/java/com/google/devtools/build/lib/vfs/UnixGlob.java
parentb7c04068b7294bc5c01a193cfa32957ff78b132e (diff)
Automated [] rollback of commit 846a5ab98fc26d72024890fdb79a5d3bc6a5a1ba + manual rollback of []
*** Reason for rollback *** Depot has been fixed / is in the process of being fixed. See the work tracked on [] *** Original change description *** Automated [] rollback of commit bb5d5efb4b50710241b5b374eb67084f4bf08278. -- MOS_MIGRATED_REVID=131095905
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/vfs/UnixGlob.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/vfs/UnixGlob.java17
1 files changed, 12 insertions, 5 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 6da3925e96..1ea067d20f 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,6 +55,8 @@ 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() {}
@@ -396,7 +398,7 @@ public final class UnixGlob {
}
/**
- * Executes the glob.
+ * Executes the glob and returns the result.
*
* @throws InterruptedException if the thread is interrupted.
*/
@@ -499,9 +501,10 @@ public final class UnixGlob {
}
/**
- * Performs wildcard globbing: returns the sorted list of filenames that match any of
+ * Performs wildcard globbing: returns the 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.
+ * match {@code dirPred}. The predicate is also called for the root of the traversal. The order
+ * of the returned list is unspecified.
*
* <p>Patterns may include "*" and "?", but not "[a-z]".
*
@@ -530,6 +533,10 @@ 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) {
@@ -635,7 +642,7 @@ public final class UnixGlob {
} else if (failure.get() != null) {
result.setException(failure.get());
} else {
- result.set(Ordering.<Path>natural().immutableSortedCopy(results));
+ result.set(ImmutableList.copyOf(results));
}
}
}