diff options
author | 2016-03-17 22:34:52 +0000 | |
---|---|---|
committer | 2016-03-18 12:48:29 +0000 | |
commit | 80665ec28f4fde484c35e2935e8d06aabe902841 (patch) | |
tree | bb05d02f898becb9a92e3bfe4af97a4649499884 /src/tools/android/java/com/google/devtools/build/android/UnvalidatedAndroidData.java | |
parent | 652bb6953d2f020322c08c806a1409aae7696c09 (diff) |
Part 3 of 5: Merging semantics.
Introduces the AndroidDataMerger, MergeConflict, and UnwrittenMergedAndroidData which is the entry point in the AndroidResourceProcessing *AndroidData lifecycle.
Also, refactors the AndroidDataSet parsing of resources, making it functionally immutable.
--
MOS_MIGRATED_REVID=117492690
Diffstat (limited to 'src/tools/android/java/com/google/devtools/build/android/UnvalidatedAndroidData.java')
-rw-r--r-- | src/tools/android/java/com/google/devtools/build/android/UnvalidatedAndroidData.java | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/tools/android/java/com/google/devtools/build/android/UnvalidatedAndroidData.java b/src/tools/android/java/com/google/devtools/build/android/UnvalidatedAndroidData.java index ae6df22140..71f1712a43 100644 --- a/src/tools/android/java/com/google/devtools/build/android/UnvalidatedAndroidData.java +++ b/src/tools/android/java/com/google/devtools/build/android/UnvalidatedAndroidData.java @@ -15,12 +15,16 @@ package com.google.devtools.build.android; import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableSet; import com.android.ide.common.res2.AssetSet; import com.android.ide.common.res2.ResourceSet; +import java.io.IOException; import java.nio.file.FileSystem; import java.nio.file.FileSystems; +import java.nio.file.FileVisitOption; +import java.nio.file.FileVisitor; import java.nio.file.Files; import java.nio.file.Path; import java.util.List; @@ -76,8 +80,8 @@ class UnvalidatedAndroidData { private final ImmutableList<Path> assetDirs; private final ImmutableList<Path> resourceDirs; - public UnvalidatedAndroidData(ImmutableList<Path> resourceDirs, ImmutableList<Path> assetDirs, - Path manifest) { + public UnvalidatedAndroidData( + ImmutableList<Path> resourceDirs, ImmutableList<Path> assetDirs, Path manifest) { this.resourceDirs = resourceDirs; this.assetDirs = assetDirs; this.manifest = manifest; @@ -160,4 +164,11 @@ class UnvalidatedAndroidData { assetSets.add(set); } } + + public void walkResources(final FileVisitor<Path> fileVisitor) throws IOException { + for (Path path : resourceDirs) { + Files.walkFileTree( + path, ImmutableSet.of(FileVisitOption.FOLLOW_LINKS), Integer.MAX_VALUE, fileVisitor); + } + } } |