diff options
author | corysmith <corysmith@google.com> | 2018-02-16 15:48:49 -0800 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-02-16 15:50:13 -0800 |
commit | d18d3e2f83f9d582858a3edab7a450c60044028c (patch) | |
tree | 16ff3c0dff1e87a60ddcafaea2917623d48ef096 /src/tools/android/java/com/google/devtools/build/android/DataSource.java | |
parent | d7a56179ab35bf21ee6d77d87bb0096bef042175 (diff) |
Automated rollback of commit f672a31b8b19baab95373e4f2f6d110aa8b8f0fb.
*** Reason for rollback ***
Unclassified general breakages in tests. Rolling back for further investigation.
*** Original change description ***
Normalized the serialization proto to save space and allow greater versatility in storage.
RELNOTES: None
PiperOrigin-RevId: 186057879
Diffstat (limited to 'src/tools/android/java/com/google/devtools/build/android/DataSource.java')
-rw-r--r-- | src/tools/android/java/com/google/devtools/build/android/DataSource.java | 25 |
1 files changed, 2 insertions, 23 deletions
diff --git a/src/tools/android/java/com/google/devtools/build/android/DataSource.java b/src/tools/android/java/com/google/devtools/build/android/DataSource.java index 994935484a..16c79d7f81 100644 --- a/src/tools/android/java/com/google/devtools/build/android/DataSource.java +++ b/src/tools/android/java/com/google/devtools/build/android/DataSource.java @@ -17,20 +17,17 @@ import com.android.SdkConstants; import com.google.common.base.MoreObjects; import com.google.common.base.Objects; import com.google.common.collect.ImmutableSet; -import com.google.devtools.build.android.proto.SerializeFormat; import com.google.devtools.build.android.proto.SerializeFormat.ProtoSource; import java.io.BufferedInputStream; import java.io.IOException; import java.io.InputStream; -import java.io.OutputStream; import java.nio.file.FileSystem; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.attribute.BasicFileAttributeView; -import java.util.Set; /** Represents where the DataValue was derived from. */ -public class DataSource implements Comparable<DataSource>, Writeable { +public class DataSource implements Comparable<DataSource> { public static DataSource from(ProtoSource protoSource, FileSystem currentFileSystem) { Path path = currentFileSystem.getPath(protoSource.getFilename()); @@ -38,7 +35,7 @@ public class DataSource implements Comparable<DataSource>, Writeable { } public static DataSource of(Path sourcePath) { - return new DataSource(sourcePath, ImmutableSet.of()); + return new DataSource(sourcePath, ImmutableSet.<DataSource>of()); } private final Path path; @@ -101,9 +98,6 @@ public class DataSource implements Comparable<DataSource>, Writeable { } public DataSource overwrite(DataSource... sources) { - if (sources.length == 0) { - return this; - } ImmutableSet.Builder<DataSource> overridesBuilder = ImmutableSet.<DataSource>builder().addAll(this.overrides); for (DataSource dataSource : sources) { @@ -143,19 +137,4 @@ public class DataSource implements Comparable<DataSource>, Writeable { public String asConflictString() { return path.toString(); } - - @Override - public void writeTo(OutputStream out) throws IOException { - SerializeFormat.ProtoSource.newBuilder() - .setFilename(path.toString()) - .build() - .writeDelimitedTo(out); - } - - public boolean shouldFilter(Set<String> filteredResources) { - return filteredResources.contains(path.getParent().getFileName() + "/" + path.getFileName()) - // Since the filtered resources short path could match multiple sources, check to make sure - // the source doesn't exist. - && !Files.exists(path); - } } |