use of org.gradle.caching.internal.CacheableEntity in project gradle by gradle.
the class DefaultBuildCacheController method loadRemoteAndStoreResultLocally.
private Optional<BuildCacheLoadResult> loadRemoteAndStoreResultLocally(BuildCacheKey key, CacheableEntity entity) {
if (!remote.canLoad()) {
return Optional.empty();
}
AtomicReference<Optional<BuildCacheLoadResult>> result = new AtomicReference<>(Optional.empty());
tmp.withTempFile(key, file -> {
Optional<BuildCacheLoadResult> remoteResult;
try {
remoteResult = remote.maybeLoad(key, file, f -> packExecutor.unpack(key, entity, f));
} catch (Exception e) {
throw new GradleException("Could not load from remote cache: " + e.getMessage(), e);
}
if (remoteResult.isPresent()) {
local.maybeStore(key, file);
result.set(remoteResult);
}
});
return result.get();
}
Aggregations