diff options
author | Googler <noreply@google.com> | 2017-03-10 09:42:49 +0000 |
---|---|---|
committer | Vladimir Moskva <vladmos@google.com> | 2017-03-10 10:28:44 +0000 |
commit | 25df9e962012eb6ac8bf01a031ddf2c257f5cce5 (patch) | |
tree | 8c891084749586be590225bf0bdf323d290a15bf /src/tools/android/java/com/google | |
parent | b6ea0d33d3ab72922c8fb3ec1ff0e437af09584d (diff) |
Change how desugar finds desugared classes to have it working on Windows
RELNOTES: Change how desugar finds desugared classes to have it working on Windows
--
PiperOrigin-RevId: 149738279
MOS_MIGRATED_REVID=149738279
Diffstat (limited to 'src/tools/android/java/com/google')
-rw-r--r-- | src/tools/android/java/com/google/devtools/build/android/desugar/LambdaClassMaker.java | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/tools/android/java/com/google/devtools/build/android/desugar/LambdaClassMaker.java b/src/tools/android/java/com/google/devtools/build/android/desugar/LambdaClassMaker.java index ef8740770b..d8f2e281fb 100644 --- a/src/tools/android/java/com/google/devtools/build/android/desugar/LambdaClassMaker.java +++ b/src/tools/android/java/com/google/devtools/build/android/desugar/LambdaClassMaker.java @@ -24,7 +24,6 @@ import java.nio.file.Path; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.Map; -import java.util.function.Function; import java.util.function.Predicate; import java.util.stream.Stream; @@ -64,23 +63,22 @@ class LambdaClassMaker { return result; } - private Path findOnlyUnprocessed(final String pathPrefix) throws IOException { + private Path findOnlyUnprocessed(String pathPrefix) throws IOException { + // pathPrefix is an internal class name prefix containing '/', but paths obtained on Windows + // will not contain '/' and searches will fail. So, construct an absolute path from the given + // string and use its string representation to find the file we need regardless of host + // system's file system + final String rootPathPrefixStr = rootDirectory.resolve(pathPrefix).toString(); + // TODO(kmb): Investigate making this faster in the case of many lambdas // TODO(bazel-team): This could be much nicer with lambdas try (Stream<Path> results = Files.walk(rootDirectory) - .map( - new Function<Path, Path>() { - @Override - public Path apply(Path path) { - return rootDirectory.relativize(path); - } - }) .filter( new Predicate<Path>() { @Override public boolean test(Path path) { - return path.toString().startsWith(pathPrefix) + return path.toString().startsWith(rootPathPrefixStr) && !generatedClasses.containsKey(path); } })) { |