Search in sources :

Example 6 with PreviousExecutionState

use of org.gradle.internal.execution.history.PreviousExecutionState in project gradle by gradle.

the class LoadPreviousExecutionStateStep method execute.

@Override
public R execute(UnitOfWork work, C context) {
    Identity identity = context.getIdentity();
    Optional<PreviousExecutionState> previousExecutionState = context.getHistory().flatMap(history -> history.load(identity.getUniqueId()));
    return delegate.execute(work, new PreviousExecutionContext() {

        @Override
        public Optional<PreviousExecutionState> getPreviousExecutionState() {
            return previousExecutionState;
        }

        @Override
        public Optional<String> getNonIncrementalReason() {
            return context.getNonIncrementalReason();
        }

        @Override
        public WorkValidationContext getValidationContext() {
            return context.getValidationContext();
        }

        @Override
        public ImmutableSortedMap<String, ValueSnapshot> getInputProperties() {
            return context.getInputProperties();
        }

        @Override
        public ImmutableSortedMap<String, CurrentFileCollectionFingerprint> getInputFileProperties() {
            return context.getInputFileProperties();
        }

        @Override
        public Identity getIdentity() {
            return context.getIdentity();
        }

        @Override
        public File getWorkspace() {
            return context.getWorkspace();
        }

        @Override
        public Optional<ExecutionHistoryStore> getHistory() {
            return context.getHistory();
        }
    });
}
Also used : Optional(java.util.Optional) ImmutableSortedMap(com.google.common.collect.ImmutableSortedMap) PreviousExecutionState(org.gradle.internal.execution.history.PreviousExecutionState) Identity(org.gradle.internal.execution.UnitOfWork.Identity) File(java.io.File) WorkValidationContext(org.gradle.internal.execution.WorkValidationContext)

Aggregations

PreviousExecutionState (org.gradle.internal.execution.history.PreviousExecutionState)6 ImmutableSortedMap (com.google.common.collect.ImmutableSortedMap)4 File (java.io.File)3 Optional (java.util.Optional)3 UnitOfWork (org.gradle.internal.execution.UnitOfWork)3 WorkValidationContext (org.gradle.internal.execution.WorkValidationContext)3 ValueSnapshot (org.gradle.internal.snapshot.ValueSnapshot)3 ImmutableList (com.google.common.collect.ImmutableList)2 Duration (java.time.Duration)2 List (java.util.List)2 OriginMetadata (org.gradle.caching.internal.origin.OriginMetadata)2 ExecutionOutcome (org.gradle.internal.execution.ExecutionOutcome)2 ExecutionResult (org.gradle.internal.execution.ExecutionResult)2 AfterExecutionState (org.gradle.internal.execution.history.AfterExecutionState)2 BeforeExecutionState (org.gradle.internal.execution.history.BeforeExecutionState)2 ExecutionHistoryStore (org.gradle.internal.execution.history.ExecutionHistoryStore)2 CurrentFileCollectionFingerprint (org.gradle.internal.fingerprint.CurrentFileCollectionFingerprint)2 Logger (org.slf4j.Logger)2 LoggerFactory (org.slf4j.LoggerFactory)2 ImmutableCollection (com.google.common.collect.ImmutableCollection)1