Search in sources :

Example 1 with InvalidateVirtualFileSystem

use of org.gradle.launcher.daemon.protocol.InvalidateVirtualFileSystem 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();
    }
}
Also used : FileSystemAccess(org.gradle.internal.vfs.FileSystemAccess) InvalidateVirtualFileSystem(org.gradle.launcher.daemon.protocol.InvalidateVirtualFileSystem) Success(org.gradle.launcher.daemon.protocol.Success)

Example 2 with InvalidateVirtualFileSystem

use of org.gradle.launcher.daemon.protocol.InvalidateVirtualFileSystem in project gradle by gradle.

the class NotifyDaemonAboutChangedPathsClient method notifyDaemonsAboutChangedPaths.

public void notifyDaemonsAboutChangedPaths(List<String> changedPaths) {
    for (DaemonInfo daemonInfo : daemonRegistry.getAll()) {
        DaemonStateControl.State state = daemonInfo.getState();
        if (state == Idle || state == Busy || state == Canceled) {
            DaemonClientConnection connection = connector.maybeConnect(daemonInfo);
            if (connection == null) {
                continue;
            }
            dispatch(connection, new InvalidateVirtualFileSystem(changedPaths, idGenerator.generateId(), connection.getDaemon().getToken()));
        }
    }
}
Also used : DaemonStateControl(org.gradle.launcher.daemon.server.api.DaemonStateControl) DaemonInfo(org.gradle.launcher.daemon.registry.DaemonInfo) InvalidateVirtualFileSystem(org.gradle.launcher.daemon.protocol.InvalidateVirtualFileSystem)

Aggregations

InvalidateVirtualFileSystem (org.gradle.launcher.daemon.protocol.InvalidateVirtualFileSystem)2 FileSystemAccess (org.gradle.internal.vfs.FileSystemAccess)1 Success (org.gradle.launcher.daemon.protocol.Success)1 DaemonInfo (org.gradle.launcher.daemon.registry.DaemonInfo)1 DaemonStateControl (org.gradle.launcher.daemon.server.api.DaemonStateControl)1