use of org.gradle.internal.snapshot.SnapshotHierarchy in project gradle by gradle.
the class WatchableHierarchies method updateUnwatchableFilesOnBuildStart.
@CheckReturnValue
private SnapshotHierarchy updateUnwatchableFilesOnBuildStart(SnapshotHierarchy root, Invalidator invalidator, List<File> unsupportedFileSystems) {
SnapshotHierarchy newRoot = root;
FileHierarchySet oldUnwatchableFiles = unwatchableFiles;
unwatchableFiles = unsupportedFileSystems.stream().reduce(FileHierarchySet.empty(), FileHierarchySet::plus, nonCombining());
if (!oldUnwatchableFiles.equals(unwatchableFiles)) {
// Remove previously unwatchable files, since they may become watchable.
// If we register a watchable hierarchy, then there mustn't be anything in the VFS at that location.
newRoot = invalidateUnwatchableHierarchies(newRoot, invalidator, oldUnwatchableFiles);
// Remove current unwatchable files, since they still may be watched.
newRoot = invalidateUnwatchableHierarchies(newRoot, invalidator, unwatchableFiles);
hierarchies.removeIf(unwatchableFiles::contains);
watchableFiles = buildWatchableFilesFromHierarchies(hierarchies);
// Replay the watchable hierarchies since the end of last build, since they have become watchable.
for (File watchableHierarchy : watchableHierarchiesSinceLastBuildFinish) {
if (!unwatchableFiles.contains(watchableHierarchy)) {
doRegisterWatchableHierarchy(watchableHierarchy, newRoot);
}
}
}
return newRoot;
}
use of org.gradle.internal.snapshot.SnapshotHierarchy in project gradle by gradle.
the class VfsRootReference method update.
public void update(UnaryOperator<SnapshotHierarchy> updateFunction) {
updateLock.lock();
try {
SnapshotHierarchy currentRoot = root;
root = updateFunction.apply(currentRoot);
} finally {
updateLock.unlock();
}
}
use of org.gradle.internal.snapshot.SnapshotHierarchy in project gradle by gradle.
the class AbstractVirtualFileSystem method invalidate.
@Override
public void invalidate(Iterable<String> locations) {
LOGGER.debug("Invalidating VFS paths: {}", locations);
rootReference.update(root -> {
SnapshotHierarchy result = root;
for (String location : locations) {
SnapshotHierarchy currentRoot = result;
result = updateNotifyingListeners(diffListener -> currentRoot.invalidate(location, diffListener));
}
return result;
});
}
use of org.gradle.internal.snapshot.SnapshotHierarchy in project gradle by gradle.
the class AbstractFileWatcherUpdater method invalidateMovedDirectoriesOnBuildStarted.
@CheckReturnValue
private SnapshotHierarchy invalidateMovedDirectoriesOnBuildStarted(SnapshotHierarchy root) {
SnapshotHierarchy newRoot = root;
WatchableHierarchies.Invalidator invalidator = createInvalidator();
for (File movedDirectory : movedDirectoryHandler.stopWatchingMovedDirectories(root)) {
LOGGER.info("Dropping VFS state for moved directory {}", movedDirectory.getAbsolutePath());
newRoot = invalidator.invalidate(movedDirectory.getAbsolutePath(), newRoot);
}
return newRoot;
}
use of org.gradle.internal.snapshot.SnapshotHierarchy in project gradle by gradle.
the class HierarchicalFileWatcherUpdater method updateVfsOnBuildFinished.
@Override
public SnapshotHierarchy updateVfsOnBuildFinished(SnapshotHierarchy root, WatchMode watchMode, int maximumNumberOfWatchedHierarchies, List<File> unsupportedFileSystems) {
SnapshotHierarchy newRoot = super.updateVfsOnBuildFinished(root, watchMode, maximumNumberOfWatchedHierarchies, unsupportedFileSystems);
LOGGER.info("Watched directory hierarchies: {}", watchedHierarchies);
return newRoot;
}
Aggregations