use of org.gradle.internal.Cast in project gradle by gradle.
the class IdentityCacheStep method executeDeferred.
@Override
public <T, O> T executeDeferred(UnitOfWork work, C context, Cache<Identity, Try<O>> cache, DeferredExecutionHandler<O, T> handler) {
Identity identity = context.getIdentity();
Try<O> cachedOutput = cache.getIfPresent(identity);
if (cachedOutput != null) {
return handler.processCachedOutput(cachedOutput);
} else {
return handler.processDeferredOutput(() -> cache.get(identity, () -> execute(work, context).getExecutionResult().map(ExecutionResult::getOutput).map(Cast::<O>uncheckedNonnullCast)));
}
}
use of org.gradle.internal.Cast in project gradle by gradle.
the class IvyPublishPlugin method disableGradleMetadataGenerationIfCustomLayout.
private void disableGradleMetadataGenerationIfCustomLayout(NamedDomainObjectList<IvyArtifactRepository> repositories, GenerateModuleMetadata generateTask) {
AtomicBoolean didWarn = new AtomicBoolean();
Spec<? super Task> checkStandardLayout = task -> {
boolean standard = repositories.stream().allMatch(this::hasStandardPattern);
if (!standard && !didWarn.getAndSet(true)) {
LOGGER.warn("Publication of Gradle Module Metadata is disabled because you have configured an Ivy repository with a non-standard layout");
}
return standard;
};
Spec<TaskInternal> spec = new AndSpec<TaskInternal>(generateTask.getOnlyIf(), checkStandardLayout);
generateTask.setOnlyIf(Cast.<Spec<? super Task>>uncheckedCast(spec));
}
Aggregations