use of org.gradle.internal.file.FileHierarchySet in project gradle by gradle.
the class AbstractFileWatcherUpdater method update.
private void update(SnapshotHierarchy root) {
FileHierarchySet oldWatchedFiles = watchedFiles;
watchedFiles = resolveWatchedFiles(watchableHierarchies, root);
if (!watchedFiles.equals(oldWatchedFiles)) {
updateWatchesOnChangedWatchedFiles(watchedFiles);
}
// Probe every hierarchy that is watched, even ones nested inside others
ImmutableSet<File> oldProbedHierarchies = probedHierarchies;
probedHierarchies = watchableHierarchies.stream().filter(watchedFiles::contains).collect(ImmutableSet.toImmutableSet());
if (oldProbedHierarchies.equals(probedHierarchies)) {
return;
}
oldProbedHierarchies.stream().filter(oldProbedHierarchy -> !probedHierarchies.contains(oldProbedHierarchy)).forEach(probedHierarchy -> {
File probeDirectory = probeRegistry.getProbeDirectory(probedHierarchy);
probeRegistry.disarmWatchProbe(probedHierarchy);
stopWatchingProbeDirectory(probeDirectory);
});
probedHierarchies.stream().filter(newProbedHierarchy -> !oldProbedHierarchies.contains(newProbedHierarchy)).forEach(probedHierarchy -> {
File probeDirectory = probeRegistry.getProbeDirectory(probedHierarchy);
// Make sure the directory exists, this can be necessary when
// included builds are evaluated with configuration cache
// noinspection ResultOfMethodCallIgnored
probeDirectory.mkdirs();
startWatchingProbeDirectory(probeDirectory);
probeRegistry.armWatchProbe(probedHierarchy);
});
}
use of org.gradle.internal.file.FileHierarchySet 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;
}
Aggregations