diff options
author | Chris Warrington <cmw@google.com> | 2017-04-19 14:49:08 +0100 |
---|---|---|
committer | Chris Warrington <cmw@google.com> | 2017-05-02 19:52:31 +0100 |
commit | 4a3db1dabcf1c7ad66b186059a8493cc69e7ca67 (patch) | |
tree | cb0acbca842f2f7215d2216127b632395ec7e581 /src | |
parent | 1bc7cd6364156fad1b7296cbdf2709dc3fd12687 (diff) | |
download | apkzlib-4a3db1dabcf1c7ad66b186059a8493cc69e7ca67.tar.gz |
Allow javac to output resources.
As some annotation processors output resources.
This also updates various instant run components to properly detect if
there were changes rather than assuming that if transforms ran that the
changed inputs were interesting.
Test: AutoServiceTest.
Issue: https://issuetracker.google.com/37140464
Change-Id: I614f48cd52e65d35a5d1c188fce9357c37e1208e
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/com/android/apkzlib/zfile/ApkCreator.java | 3 | ||||
-rw-r--r-- | src/main/java/com/android/apkzlib/zfile/ApkZFileCreator.java | 5 | ||||
-rw-r--r-- | src/main/java/com/android/apkzlib/zip/ZFile.java | 13 |
3 files changed, 20 insertions, 1 deletions
diff --git a/src/main/java/com/android/apkzlib/zfile/ApkCreator.java b/src/main/java/com/android/apkzlib/zfile/ApkCreator.java index d602202..3cac7dc 100644 --- a/src/main/java/com/android/apkzlib/zfile/ApkCreator.java +++ b/src/main/java/com/android/apkzlib/zfile/ApkCreator.java @@ -65,4 +65,7 @@ public interface ApkCreator extends Closeable { * @throws IOException failed to remove the entry */ void deleteFile(@Nonnull String apkPath) throws IOException; + + /** Returns true if the APK will be rewritten on close. */ + boolean hasPendingChangesWithWait() throws IOException; } diff --git a/src/main/java/com/android/apkzlib/zfile/ApkZFileCreator.java b/src/main/java/com/android/apkzlib/zfile/ApkZFileCreator.java index b96901c..e56f99b 100644 --- a/src/main/java/com/android/apkzlib/zfile/ApkZFileCreator.java +++ b/src/main/java/com/android/apkzlib/zfile/ApkZFileCreator.java @@ -159,6 +159,11 @@ class ApkZFileCreator implements ApkCreator { } @Override + public boolean hasPendingChangesWithWait() throws IOException { + return zip.hasPendingChangesWithWait(); + } + + @Override public void close() throws IOException { if (closed) { return; diff --git a/src/main/java/com/android/apkzlib/zip/ZFile.java b/src/main/java/com/android/apkzlib/zip/ZFile.java index 5972b96..2ec8df7 100644 --- a/src/main/java/com/android/apkzlib/zip/ZFile.java +++ b/src/main/java/com/android/apkzlib/zip/ZFile.java @@ -301,6 +301,9 @@ public class ZFile implements Closeable { /** * Are the in-memory changes that have not been written to the zip file? + * + * <p>This might be false, but will become true after {@link #processAllReadyEntriesWithWait()} + * is called if there are {@link #uncompressedEntries} compressing in the background. */ private boolean dirty; @@ -2504,8 +2507,16 @@ public class ZFile implements Closeable { } /** - * Hint to where files should be positioned. + * Are there in-memory changes that have not been written to the zip file? + * + * <p>Waits for all pending processing which may make changes. */ + public boolean hasPendingChangesWithWait() throws IOException { + processAllReadyEntriesWithWait(); + return dirty; + } + + /** Hint to where files should be positioned. */ enum PositionHint { /** * File may be positioned anywhere, caller doesn't care. |