use of org.gradle.internal.vfs.FileSystemAccess in project gradle by gradle.
the class DefaultTransformerInvocationFactory method createInvocation.
@Override
public CacheableInvocation<ImmutableList<File>> createInvocation(Transformer transformer, File inputArtifact, ArtifactTransformDependencies dependencies, TransformationSubject subject, InputFingerprinter inputFingerprinter) {
ProjectInternal producerProject = determineProducerProject(subject);
TransformationWorkspaceServices workspaceServices = determineWorkspaceServices(producerProject);
UnitOfWork execution;
if (producerProject == null) {
execution = new ImmutableTransformerExecution(transformer, inputArtifact, dependencies, buildOperationExecutor, fileCollectionFactory, inputFingerprinter, fileSystemAccess, workspaceServices);
} else {
execution = new MutableTransformerExecution(transformer, inputArtifact, dependencies, buildOperationExecutor, fileCollectionFactory, inputFingerprinter, workspaceServices);
}
return executionEngine.createRequest(execution).withIdentityCache(workspaceServices.getIdentityCache()).getOrDeferExecution(new DeferredExecutionHandler<TransformationResult, CacheableInvocation<ImmutableList<File>>>() {
@Override
public CacheableInvocation<ImmutableList<File>> processCachedOutput(Try<TransformationResult> cachedOutput) {
return CacheableInvocation.cached(mapResult(cachedOutput));
}
@Override
public CacheableInvocation<ImmutableList<File>> processDeferredOutput(Supplier<Try<TransformationResult>> deferredExecution) {
return CacheableInvocation.nonCached(() -> fireTransformListeners(transformer, subject, () -> mapResult(deferredExecution.get())));
}
@Nonnull
private Try<ImmutableList<File>> mapResult(Try<TransformationResult> cachedOutput) {
return cachedOutput.map(result -> result.resolveOutputsForInputArtifact(inputArtifact)).mapFailure(failure -> new TransformException(String.format("Execution failed for %s.", execution.getDisplayName()), failure));
}
});
}
use of org.gradle.internal.vfs.FileSystemAccess in project gradle by gradle.
the class HandleInvalidateVirtualFileSystem method execute.
@Override
public void execute(DaemonCommandExecution execution) {
if (execution.getCommand() instanceof InvalidateVirtualFileSystem) {
InvalidateVirtualFileSystem command = (InvalidateVirtualFileSystem) execution.getCommand();
gradleUserHomeScopeServiceRegistry.getCurrentServices().ifPresent(currentServices -> {
LOGGER.info("Invalidating {}", command.getChangedPaths());
FileSystemAccess fileSystemAccess = currentServices.get(FileSystemAccess.class);
fileSystemAccess.write(command.getChangedPaths(), () -> {
});
});
execution.getConnection().completed(new Success(null));
} else {
execution.proceed();
}
}
Aggregations