diff options
author | Benoit Lamarche <benoitlamarche@google.com> | 2015-05-29 12:56:14 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2015-05-29 12:56:15 +0000 |
commit | ba3810e3267e8a899ac305b6c803e43ef513340f (patch) | |
tree | 32299b2ec2a5763790133e0c8dc45dcc673c872e | |
parent | 9f6136767cfe3f9bc169cfe4be41c0e91fc69845 (diff) | |
parent | e4ad6f2404104556a4c7c4c356fd922117418c3c (diff) | |
download | toolchain_jack-ba3810e3267e8a899ac305b6c803e43ef513340f.zip toolchain_jack-ba3810e3267e8a899ac305b6c803e43ef513340f.tar.gz toolchain_jack-ba3810e3267e8a899ac305b6c803e43ef513340f.tar.bz2 |
Merge "Add getLastModified() to VFile" into ub-jack-brest
20 files changed, 96 insertions, 8 deletions
diff --git a/jack/src/com/android/jack/incremental/IncrementalInputFilter.java b/jack/src/com/android/jack/incremental/IncrementalInputFilter.java index f925926..887abcb 100644 --- a/jack/src/com/android/jack/incremental/IncrementalInputFilter.java +++ b/jack/src/com/android/jack/incremental/IncrementalInputFilter.java @@ -382,13 +382,19 @@ public class IncrementalInputFilter extends CommonFilter implements InputFilter @Nonnull private void fillModifiedFileNames(@Nonnull Set<String> modifiedFileNames) { assert fileDependencies != null; + assert incrementalInputLibrary != null; for (String javaFileName : fileDependencies.getCompiledJavaFiles()) { if (fileNamesOnCmdLine.contains(javaFileName)) { File javaFile = new File(javaFileName); for (String typeName : fileDependencies.getTypeNames(javaFileName)) { - File dexFile = getDexFile(typeName); - if (!dexFile.exists() || ((javaFile.lastModified() > dexFile.lastModified()))) { + InputVFile dexFile; + try { + dexFile = incrementalInputLibrary.getFile(FileType.DEX, new VPath(typeName, '/')); + } catch (FileTypeDoesNotExistException e) { + dexFile = null; + } + if (dexFile == null || ((javaFile.lastModified() > dexFile.getLastModified()))) { modifiedFileNames.add(javaFileName); } } @@ -413,12 +419,6 @@ public class IncrementalInputFilter extends CommonFilter implements InputFilter } @Nonnull - private File getDexFile(@Nonnull String typeName) { - return new File(incrementalFolder, FileType.DEX.buildFileVPath( - new VPath(typeName, '/')).getPathAsString(File.separatorChar)); - } - - @Nonnull private void fillDependencies(@Nonnull InputJackLibrary library, @Nonnull VPath dependencyVPath, @Nonnull Dependency dependency) throws CannotReadException, FileTypeDoesNotExistException { diff --git a/jack/src/com/android/jack/shrob/obfuscation/resource/RefinedVFile.java b/jack/src/com/android/jack/shrob/obfuscation/resource/RefinedVFile.java index b8d81b5..dd2e2d5 100644 --- a/jack/src/com/android/jack/shrob/obfuscation/resource/RefinedVFile.java +++ b/jack/src/com/android/jack/shrob/obfuscation/resource/RefinedVFile.java @@ -284,4 +284,9 @@ public class RefinedVFile extends AbstractVElement implements InputVFile { public VPath getPathFromRoot() { return file.getPathFromRoot(); } + + @Override + public long getLastModified() { + return file.getLastModified(); + } } diff --git a/sched/src/com/android/sched/util/file/InputZipFile.java b/sched/src/com/android/sched/util/file/InputZipFile.java index e8f1cc5..3fdd68b 100644 --- a/sched/src/com/android/sched/util/file/InputZipFile.java +++ b/sched/src/com/android/sched/util/file/InputZipFile.java @@ -99,4 +99,9 @@ public class InputZipFile extends StreamFile { assert file != null; return file.getName(); } + + public long getLastModified() { + assert file != null; + return file.lastModified(); + } }
\ No newline at end of file diff --git a/sched/src/com/android/sched/vfs/BaseVFS.java b/sched/src/com/android/sched/vfs/BaseVFS.java index 354cc98..935a0e5 100644 --- a/sched/src/com/android/sched/vfs/BaseVFS.java +++ b/sched/src/com/android/sched/vfs/BaseVFS.java @@ -85,6 +85,8 @@ abstract class BaseVFS<DIR extends BaseVDir, FILE extends BaseVFile> implements @Nonnull abstract VPath getPathFromRoot(@Nonnull FILE file); + abstract long getLastModified(@Nonnull FILE file); + // // Location related // diff --git a/sched/src/com/android/sched/vfs/BaseVFile.java b/sched/src/com/android/sched/vfs/BaseVFile.java index c231341..896a556 100644 --- a/sched/src/com/android/sched/vfs/BaseVFile.java +++ b/sched/src/com/android/sched/vfs/BaseVFile.java @@ -72,6 +72,11 @@ abstract class BaseVFile extends BaseVElement implements VFile { } @Override + public long getLastModified() { + return vfs.getLastModified(this); + } + + @Override public void delete() throws CannotDeleteFileException { vfs.delete(this); } diff --git a/sched/src/com/android/sched/vfs/CachedDirectFS.java b/sched/src/com/android/sched/vfs/CachedDirectFS.java index ce1f605..19affc3 100644 --- a/sched/src/com/android/sched/vfs/CachedDirectFS.java +++ b/sched/src/com/android/sched/vfs/CachedDirectFS.java @@ -366,6 +366,11 @@ public class CachedDirectFS extends BaseVFS<CachedParentVDir, CachedParentVFile> } @Override + public long getLastModified(@Nonnull CachedParentVFile file) { + return getNativeFile(file.getPath()).lastModified(); + } + + @Override @Nonnull FileLocation getVFileLocation(@Nonnull CachedParentVFile file) { return new FileLocation(getNativeFile(file.getPath())); diff --git a/sched/src/com/android/sched/vfs/CaseInsensitiveFS.java b/sched/src/com/android/sched/vfs/CaseInsensitiveFS.java index 78ce7b2..46b18ea 100644 --- a/sched/src/com/android/sched/vfs/CaseInsensitiveFS.java +++ b/sched/src/com/android/sched/vfs/CaseInsensitiveFS.java @@ -478,6 +478,11 @@ public class CaseInsensitiveFS extends BaseVFS<CaseInsensitiveVDir, CaseInsensit return list(dir).isEmpty(); } + @Override + public long getLastModified(@Nonnull CaseInsensitiveVFile file) { + return vfs.getLastModified(file.getEncodedFile()); + } + // // Location // diff --git a/sched/src/com/android/sched/vfs/DeflateFS.java b/sched/src/com/android/sched/vfs/DeflateFS.java index f805c2e..70fc31d 100644 --- a/sched/src/com/android/sched/vfs/DeflateFS.java +++ b/sched/src/com/android/sched/vfs/DeflateFS.java @@ -119,6 +119,11 @@ public class DeflateFS extends BaseVFS<BaseVDir, BaseVFile> implements VFS{ } @Override + long getLastModified(@Nonnull BaseVFile file) { + return vfs.getLastModified(file); + } + + @Override @Nonnull BaseVFile createVFile(@Nonnull BaseVDir parent, @Nonnull String name) throws CannotCreateFileException { diff --git a/sched/src/com/android/sched/vfs/DirectFS.java b/sched/src/com/android/sched/vfs/DirectFS.java index 4495439..1464cb3 100644 --- a/sched/src/com/android/sched/vfs/DirectFS.java +++ b/sched/src/com/android/sched/vfs/DirectFS.java @@ -255,6 +255,11 @@ public class DirectFS extends BaseVFS<ParentVDir, ParentVFile> implements VFS { } @Override + public long getLastModified(@Nonnull ParentVFile file) { + return getNativeFile(file.getPath()).lastModified(); + } + + @Override @Nonnull FileLocation getVFileLocation(@Nonnull ParentVFile file) { return new FileLocation(getNativeFile(file.getPath())); diff --git a/sched/src/com/android/sched/vfs/GenericInputOutputVFile.java b/sched/src/com/android/sched/vfs/GenericInputOutputVFile.java index b17adbc..d5fab6f 100644 --- a/sched/src/com/android/sched/vfs/GenericInputOutputVFile.java +++ b/sched/src/com/android/sched/vfs/GenericInputOutputVFile.java @@ -88,4 +88,9 @@ public class GenericInputOutputVFile implements InputOutputVFile { public VPath getPathFromRoot() { return file.getPathFromRoot(); } + + @Override + public long getLastModified() { + return file.getLastModified(); + } }
\ No newline at end of file diff --git a/sched/src/com/android/sched/vfs/GenericInputVFile.java b/sched/src/com/android/sched/vfs/GenericInputVFile.java index 74ea3aa..1406996 100644 --- a/sched/src/com/android/sched/vfs/GenericInputVFile.java +++ b/sched/src/com/android/sched/vfs/GenericInputVFile.java @@ -79,4 +79,9 @@ public class GenericInputVFile implements InputVFile { VFile getVFile() { return file; } + + @Override + public long getLastModified() { + return file.getLastModified(); + } }
\ No newline at end of file diff --git a/sched/src/com/android/sched/vfs/InputVFile.java b/sched/src/com/android/sched/vfs/InputVFile.java index cc494ed..7f61ea3 100644 --- a/sched/src/com/android/sched/vfs/InputVFile.java +++ b/sched/src/com/android/sched/vfs/InputVFile.java @@ -26,6 +26,9 @@ import javax.annotation.Nonnull; public interface InputVFile extends InputVElement, InputStreamProvider { void delete() throws CannotDeleteFileException; + @Nonnull VPath getPathFromRoot(); + + long getLastModified(); } diff --git a/sched/src/com/android/sched/vfs/MessageDigestFS.java b/sched/src/com/android/sched/vfs/MessageDigestFS.java index 25f1b84..7a181a1 100644 --- a/sched/src/com/android/sched/vfs/MessageDigestFS.java +++ b/sched/src/com/android/sched/vfs/MessageDigestFS.java @@ -291,6 +291,11 @@ public class MessageDigestFS extends BaseVFS<MessageDigestVDir, MessageDigestVFi } @Override + long getLastModified(@Nonnull MessageDigestVFile file) { + return vfs.getLastModified(file.getWrappedFile()); + } + + @Override public synchronized void close() throws CannotCreateFileException, WrongPermissionException, IOException { if (!closed) { diff --git a/sched/src/com/android/sched/vfs/MessageDigestInputVFS.java b/sched/src/com/android/sched/vfs/MessageDigestInputVFS.java index bc06970..adea71f 100644 --- a/sched/src/com/android/sched/vfs/MessageDigestInputVFS.java +++ b/sched/src/com/android/sched/vfs/MessageDigestInputVFS.java @@ -97,6 +97,12 @@ public class MessageDigestInputVFS extends MessageDigestVFS implements InputVFS } @Override + public long getLastModified() { + // This implementation is obsolete anyway + throw new UnsupportedOperationException(); + } + + @Override public void delete() { // This implementation is obsolete anyway throw new UnsupportedOperationException(); diff --git a/sched/src/com/android/sched/vfs/PrefixedFS.java b/sched/src/com/android/sched/vfs/PrefixedFS.java index cc63ea4..7b8bc3f 100644 --- a/sched/src/com/android/sched/vfs/PrefixedFS.java +++ b/sched/src/com/android/sched/vfs/PrefixedFS.java @@ -158,6 +158,11 @@ public class PrefixedFS extends BaseVFS<BaseVDir, BaseVFile> implements VFS { } @Override + long getLastModified(@Nonnull BaseVFile file) { + return vfs.getLastModified(file); + } + + @Override @Nonnull Location getVFileLocation(@Nonnull BaseVFile file) { return vfs.getVFileLocation(file); diff --git a/sched/src/com/android/sched/vfs/ReadWriteZipFS.java b/sched/src/com/android/sched/vfs/ReadWriteZipFS.java index 0ada64d..2ee080b 100644 --- a/sched/src/com/android/sched/vfs/ReadWriteZipFS.java +++ b/sched/src/com/android/sched/vfs/ReadWriteZipFS.java @@ -168,6 +168,11 @@ public class ReadWriteZipFS extends BaseVFS<BaseVDir, BaseVFile> implements VFS } @Override + long getLastModified(@Nonnull BaseVFile file) { + throw new UnsupportedOperationException(); + } + + @Override @Nonnull Location getVFileLocation(@Nonnull BaseVFile file) { return vfs.getVFileLocation(file); diff --git a/sched/src/com/android/sched/vfs/ReadZipFS.java b/sched/src/com/android/sched/vfs/ReadZipFS.java index 60badad..eeb3a6e 100644 --- a/sched/src/com/android/sched/vfs/ReadZipFS.java +++ b/sched/src/com/android/sched/vfs/ReadZipFS.java @@ -293,6 +293,11 @@ public class ReadZipFS extends BaseVFS<ZipVDir, ZipVFile> implements VFS { return list(dir).isEmpty(); } + @Override + long getLastModified(@Nonnull ZipVFile file) { + return inputZipFile.getLastModified(); + } + // // Location // diff --git a/sched/src/com/android/sched/vfs/VFSToVFSWrapper.java b/sched/src/com/android/sched/vfs/VFSToVFSWrapper.java index 0a79757..df733f4 100644 --- a/sched/src/com/android/sched/vfs/VFSToVFSWrapper.java +++ b/sched/src/com/android/sched/vfs/VFSToVFSWrapper.java @@ -219,6 +219,11 @@ public class VFSToVFSWrapper extends BaseVFS<BaseVDir, BaseVFile> implements VFS } @Override + long getLastModified(@Nonnull BaseVFile file) { + throw new UnsupportedOperationException(); + } + + @Override @Nonnull Location getVFileLocation(@Nonnull BaseVFile file) { return workVFS.getVFileLocation(file); diff --git a/sched/src/com/android/sched/vfs/VFile.java b/sched/src/com/android/sched/vfs/VFile.java index 75553e5..5e172d3 100644 --- a/sched/src/com/android/sched/vfs/VFile.java +++ b/sched/src/com/android/sched/vfs/VFile.java @@ -31,6 +31,8 @@ public interface VFile extends VElement, InputStreamProvider, OutputStreamProvid @CheckForNull String getDigest(); + long getLastModified(); + void delete() throws CannotDeleteFileException; @Nonnull VPath getPathFromRoot(); diff --git a/sched/src/com/android/sched/vfs/WriteZipFS.java b/sched/src/com/android/sched/vfs/WriteZipFS.java index 8135220..2370117 100644 --- a/sched/src/com/android/sched/vfs/WriteZipFS.java +++ b/sched/src/com/android/sched/vfs/WriteZipFS.java @@ -220,6 +220,11 @@ public class WriteZipFS extends BaseVFS<ZipVDir, ZipVFile> implements VFS { throw new UnsupportedOperationException(); } + @Override + long getLastModified(@Nonnull ZipVFile file) { + throw new UnsupportedOperationException(); + } + // // Location // |