use of com.google.idea.blaze.base.filecache.FileCacheSynchronizer in project intellij by bazelbuild.
the class JarCache method refresh.
private void refresh(@Nullable BlazeContext context, boolean removeMissingFiles) {
if (!enabled || traits == null) {
return;
}
// Ensure the cache dir exists
if (!cacheDir.exists()) {
if (!cacheDir.mkdirs()) {
logger.error("Could not create jar cache directory");
return;
}
}
FileCacheSynchronizer synchronizer = new FileCacheSynchronizer(traits);
if (!synchronizer.synchronize(context, removeMissingFiles)) {
logger.warn("Jar Cache synchronization didn't complete");
}
if (context != null) {
try {
Collection<File> finalCacheFiles = traits.enumerateCacheFiles();
ImmutableMap<File, Long> cacheFileSizes = FileSizeScanner.readFilesizes(finalCacheFiles);
Long total = cacheFileSizes.values().stream().mapToLong(x -> x).sum();
context.output(PrintOutput.log(String.format("Total Jar Cache size: %d kB (%d files)", total / 1024, finalCacheFiles.size())));
} catch (Exception e) {
logger.warn("Could not determine cache size", e);
}
}
}
use of com.google.idea.blaze.base.filecache.FileCacheSynchronizer in project intellij by bazelbuild.
the class UnpackedAars method refresh.
private void refresh(@Nullable BlazeContext context, boolean removeMissingFiles) {
if (!enabled || jarTraits == null || aarTraits == null) {
return;
}
FileOperationProvider fileOpProvider = FileOperationProvider.getInstance();
// Ensure the cache dir exists
if (!fileOpProvider.exists(cacheDir)) {
if (!fileOpProvider.mkdirs(cacheDir)) {
logger.warn("Could not create unpacked AAR directory: " + cacheDir);
return;
}
}
FileCacheSynchronizer aarSynchronizer = new FileCacheSynchronizer(aarTraits);
if (!aarSynchronizer.synchronize(context, removeMissingFiles)) {
logger.warn("Unpacked AAR synchronization didn't complete");
}
FileCacheSynchronizer aarJarSynchronizer = new FileCacheSynchronizer(jarTraits);
if (!aarJarSynchronizer.synchronize(context, removeMissingFiles)) {
logger.warn("Unpacked AAR jar synchronization didn't complete");
}
}
Aggregations