Package com.android.builder.files
Class IncrementalRelativeFileSets
java.lang.Object
com.android.builder.files.IncrementalRelativeFileSets
Utilities for incremental relative file sets, immutable maps of relative files to status.
-
Method Summary
Modifier and TypeMethodDescriptionstatic com.google.common.collect.ImmutableMap<RelativeFile,com.android.ide.common.resources.FileStatus> fromDirectory(File directory) Deprecated.Prefer the new Gradle InputChanges API.static com.google.common.collect.ImmutableMap<RelativeFile,com.android.ide.common.resources.FileStatus> fromZip(com.android.builder.files.ZipCentralDirectory zip) Reads a zip file and adds all files in the file in a new incremental relative set.static Map<RelativeFile,com.android.ide.common.resources.FileStatus> fromZip(com.android.builder.files.ZipCentralDirectory zipCentralDirectory, KeyedFileCache cache, Set<Runnable> cacheUpdates) Computes the incremental file set that results from comparing a zip file with a possibly existing cached file.static com.google.common.collect.ImmutableMap<RelativeFile,com.android.ide.common.resources.FileStatus> fromZip(com.android.builder.files.ZipCentralDirectory zip, com.android.ide.common.resources.FileStatus status) Reads a zip file and adds all files in the file in a new incremental relative set.static com.google.common.collect.ImmutableMap<RelativeFile,com.android.ide.common.resources.FileStatus> Reads a zip file and adds all files in the file in a new incremental relative set.static com.google.common.collect.ImmutableMap<RelativeFile,com.android.ide.common.resources.FileStatus> Reads a zip file and adds all files in the file in a new incremental relative set.
-
Method Details
-
fromDirectory
@Deprecated @NonNull public static com.google.common.collect.ImmutableMap<RelativeFile,com.android.ide.common.resources.FileStatus> fromDirectory(@NonNull File directory) Deprecated.Prefer the new Gradle InputChanges API.Reads a directory and adds all files in the directory in a new incremental relative set. The status of each file is set toFileStatus.NEW. This method is used to construct an initial set of files and is, therefore, an incremental update from zero.- Parameters:
directory- the directory, must be an existing directory- Returns:
- the file set
-
fromZip
@NonNull public static com.google.common.collect.ImmutableMap<RelativeFile,com.android.ide.common.resources.FileStatus> fromZip(@NonNull File zip) throws IOException Reads a zip file and adds all files in the file in a new incremental relative set. The status of each file is set toFileStatus.NEW. This method is used to construct an initial set of files and is, therefore, an incremental update from zero.- Parameters:
zip- the zip file to read, must be a valid, existing zip file- Returns:
- the file set
- Throws:
IOException- failed to read the zip file
-
fromZip
@NonNull public static com.google.common.collect.ImmutableMap<RelativeFile,com.android.ide.common.resources.FileStatus> fromZip(@NonNull File zip, com.android.ide.common.resources.FileStatus status) throws IOException Reads a zip file and adds all files in the file in a new incremental relative set. The status of each file is set tostatus.- Parameters:
zip- the zip file to read, must be a valid, existing zip filestatus- the status to set the files to- Returns:
- the file set
- Throws:
IOException- failed to read the zip file
-
fromZip
@NonNull public static com.google.common.collect.ImmutableMap<RelativeFile,com.android.ide.common.resources.FileStatus> fromZip(@NonNull com.android.builder.files.ZipCentralDirectory zip) throws IOException Reads a zip file and adds all files in the file in a new incremental relative set. The status of each file is set toFileStatus.NEW. This method is used to construct an initial set of files and is, therefore, an incremental update from zero.- Parameters:
zip- the zip file to read, must be a valid, existing zip file- Returns:
- the file set
- Throws:
IOException- failed to read the zip file
-
fromZip
@NonNull public static com.google.common.collect.ImmutableMap<RelativeFile,com.android.ide.common.resources.FileStatus> fromZip(@NonNull com.android.builder.files.ZipCentralDirectory zip, com.android.ide.common.resources.FileStatus status) throws IOException Reads a zip file and adds all files in the file in a new incremental relative set. The status of each file is set tostatus.- Parameters:
zip- the zip file to read, must be a valid, existing zip filestatus- the status to set the files to- Returns:
- the file set
- Throws:
IOException- failed to read the zip file
-
fromZip
@NonNull public static Map<RelativeFile,com.android.ide.common.resources.FileStatus> fromZip(@NonNull com.android.builder.files.ZipCentralDirectory zipCentralDirectory, @NonNull KeyedFileCache cache, @NonNull Set<Runnable> cacheUpdates) throws IOException Computes the incremental file set that results from comparing a zip file with a possibly existing cached file. If the cached file does not exist, then the whole zip is reported asFileStatus.NEW. Ifzipdoes not exist and a cached file exists, then the whole zip is reported asFileStatus.REMOVED. Otherwise, both zips are compared and the difference returned.- Parameters:
zipCentralDirectory- the zip file to read, must be a valid, existing zip filecache- the cache where to find the old version of the zipcacheUpdates- receives all runnables that will update the cache; running all runnables placed in this set will ensure that a second invocation of this method reports no changes- Returns:
- the file set
- Throws:
IOException- failed to read the zip file
-