Search in sources :

Example 1 with CachingStateFactory

use of org.gradle.internal.execution.caching.CachingStateFactory in project gradle by gradle.

the class ResolveCachingStateStep method calculateCachingState.

private CachingState calculateCachingState(UnitOfWork work, BeforeExecutionState beforeExecutionState) {
    Logger logger = buildCache.isEmitDebugLogging() ? LOGGER : NOPLogger.NOP_LOGGER;
    CachingStateFactory cachingStateFactory = new DefaultCachingStateFactory(logger);
    ImmutableList.Builder<CachingDisabledReason> cachingDisabledReasonsBuilder = ImmutableList.builder();
    if (!buildCache.isEnabled()) {
        cachingDisabledReasonsBuilder.add(BUILD_CACHE_DISABLED_REASON);
    }
    OverlappingOutputs detectedOverlappingOutputs = beforeExecutionState.getDetectedOverlappingOutputs().orElse(null);
    work.shouldDisableCaching(detectedOverlappingOutputs).ifPresent(cachingDisabledReasonsBuilder::add);
    return cachingStateFactory.createCachingState(beforeExecutionState, cachingDisabledReasonsBuilder.build());
}
Also used : CachingDisabledReason(org.gradle.internal.execution.caching.CachingDisabledReason) OverlappingOutputs(org.gradle.internal.execution.history.OverlappingOutputs) CachingStateFactory(org.gradle.internal.execution.caching.CachingStateFactory) DefaultCachingStateFactory(org.gradle.internal.execution.caching.impl.DefaultCachingStateFactory) ImmutableList(com.google.common.collect.ImmutableList) Logger(org.slf4j.Logger) NOPLogger(org.slf4j.helpers.NOPLogger) DefaultCachingStateFactory(org.gradle.internal.execution.caching.impl.DefaultCachingStateFactory)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)1 CachingDisabledReason (org.gradle.internal.execution.caching.CachingDisabledReason)1 CachingStateFactory (org.gradle.internal.execution.caching.CachingStateFactory)1 DefaultCachingStateFactory (org.gradle.internal.execution.caching.impl.DefaultCachingStateFactory)1 OverlappingOutputs (org.gradle.internal.execution.history.OverlappingOutputs)1 Logger (org.slf4j.Logger)1 NOPLogger (org.slf4j.helpers.NOPLogger)1