@NonNull public static Predicate<String> getNoCompressPredicate( @NonNull AaptOptions aaptOptions, @NonNull File manifest) { checkNotNull(aaptOptions); checkState(manifest.exists()); NativeLibrariesPackagingMode packagingMode = getNativeLibrariesLibrariesPackagingMode(manifest); return getNoCompressPredicateForExtensions( getAllNoCompressExtensions(aaptOptions, packagingMode)); }
protected Predicate<String> getNoCompressPredicate() { return PackagingUtils.getNoCompressPredicate(aaptOptions, manifest); }
/** * Checks a file to make sure it should be packaged as standard resources. * @param filePath OS-independent path of the file (including extension), relative to the * archive * @param allowClassFiles whether to allow java class files * @return true if the file should be packaged as standard java resources */ public static boolean checkFileForApkPackaging( @NonNull String filePath, boolean allowClassFiles) { String fileName = new File(filePath).getName(); // ignore hidden files and backup files return !isOfNonResourcesExtensions(Files.getFileExtension(fileName), allowClassFiles) && !filePath.equals("META-INF/MANIFEST.MF") && !isUsedForSigning(filePath) && !isMavenMetadata(filePath); }
@Input public String getNativeLibrariesPackagingModeName() { return PackagingUtils.getNativeLibrariesLibrariesPackagingMode(manifest).toString(); }
PackagingUtils.getNativeLibrariesLibrariesPackagingMode(manifest), PackagingUtils.getNoCompressPredicate(aaptOptions, manifest));
/** * Provides an {@link Action} for the archive entry. * @param archivePath the archive entry path in the archive. * @param extractCode whether to extract class files * @return the action to implement. */ @NonNull public static Action getAction(@NonNull String archivePath, boolean extractCode) { // Manifest files are never merged. if (JarFile.MANIFEST_NAME.equals(archivePath)) { return Action.IGNORE; } // split the path into segments. String[] segments = archivePath.split("/"); // empty path? skip to next entry. if (segments.length == 0) { return Action.IGNORE; } return PackagingUtils.checkFileForApkPackaging(archivePath, extractCode) ? Action.COPY : Action.IGNORE; }
@NonNull public static Predicate<String> getDefaultNoCompressPredicate() { return getNoCompressPredicateForExtensions(DEFAULT_DONT_COMPRESS_EXTENSIONS); }
token = PackagingUtils.computeApplicationHash(getProject().getBuildDir()); instantRunBuildContext.setSecretToken(token);
PackagingUtils.getNativeLibrariesLibrariesPackagingMode(manifest);
private boolean skipEntry( @NonNull ZipEntry entry, @NonNull String path) { if (entry.isDirectory() || JarFile.MANIFEST_NAME.equals(path) || !validator.validateJarPath(path)) { return true; } // split the path into segments. String[] segments = path.split("/"); // empty path? skip to next entry. if (segments.length == 0) { return true; } return !PackagingUtils.checkFileForApkPackaging(path, false /*allowClassFiles*/); }
PackagingUtils.getNativeLibrariesLibrariesPackagingMode(manifest), getNoCompressPredicate());