Search in sources :

Example 1 with QualifiedContent

use of com.android.build.api.transform.QualifiedContent in project atlas by alibaba.

the class AtlasDexArchiveBuilderCacheHander method populateCache.

void populateCache(Multimap<QualifiedContent, File> cacheableItems) throws Exception {
    for (QualifiedContent input : cacheableItems.keys()) {
        FileCache cache = getBuildCache(input.getFile(), isExternalLib(input), userLevelCache);
        if (cache != null) {
            FileCache.Inputs buildCacheInputs = AtlasDexArchiveBuilderCacheHander.getBuildCacheInputs(input.getFile(), dexOptions, dexer, minSdkVersion, isDebuggable);
            FileCache.QueryResult result = cache.createFileInCacheIfAbsent(buildCacheInputs, in -> {
                Collection<File> dexArchives = cacheableItems.get(input);
                logger.verbose("Merging %1$s into %2$s", Joiner.on(',').join(dexArchives), in.getAbsolutePath());
                mergeJars(in, cacheableItems.get(input));
            });
            if (result.getQueryEvent().equals(FileCache.QueryEvent.CORRUPTED)) {
                Verify.verifyNotNull(result.getCauseOfCorruption());
                logger.info("The build cache at '%1$s' contained an invalid cache entry.\n" + "Cause: %2$s\n" + "We have recreated the cache entry.\n" + "%3$s", cache.getCacheDirectory().getAbsolutePath(), Throwables.getStackTraceAsString(result.getCauseOfCorruption()), BuildCacheUtils.BUILD_CACHE_TROUBLESHOOTING_MESSAGE);
            }
        }
    }
}
Also used : QualifiedContent(com.android.build.api.transform.QualifiedContent) JarFile(java.util.jar.JarFile) FileCache(com.android.builder.utils.FileCache)

Aggregations

QualifiedContent (com.android.build.api.transform.QualifiedContent)1 FileCache (com.android.builder.utils.FileCache)1 JarFile (java.util.jar.JarFile)1