private void updateRoots() { roots = combinedFileSystemSubset.getRoots(); unfiltered = new FileSystemSubset(ImmutableList.copyOf(roots), ImmutableList.<ImmutableDirectoryTree>of()); }
public boolean contains(File file) { return combinedFileSystemSubset.contains(file); } }
private Delta init() { roots = fileSystemSubset.getRoots(); combinedRoots = fileSystemSubset.unfiltered(); Iterable<? extends File> startingWatchPointCandidates = calculateStartingWatchPoints(roots, combinedRoots); if (!currentWatchPoints.isEmpty()) { if (createNewStartingPointsUnderExistingRoots) { startingWatchPoints = filterCurrentWatchPoints(startingWatchPointCandidates); currentWatchPoints = ImmutableSet.<File>builder().addAll(currentWatchPoints).addAll(startingWatchPoints).build(); } else { Iterable<? extends File> combinedRoots = FileUtils.calculateRoots(Iterables.concat(currentWatchPoints, startingWatchPointCandidates)); startingWatchPoints = filterCurrentWatchPoints(combinedRoots); currentWatchPoints = ImmutableSet.copyOf(combinedRoots); } rootSubset.append(fileSystemSubset); } else { startingWatchPoints = startingWatchPointCandidates; rootSubset.append(fileSystemSubset); currentWatchPoints = ImmutableSet.copyOf(startingWatchPoints); } allRequestedRoots = ImmutableSet.<File>builder().addAll(allRequestedRoots).addAll(roots).build(); return this; }
public CombinedRootSubset() { combinedFileSystemSubset = FileSystemSubset.builder().build(); updateRoots(); }
public FileSystemSubset build() { lock.lock(); try { return new FileSystemSubset(files.build(), trees.build()); } finally { lock.unlock(); } } }
@Override public void watch(FileSystemSubset fileSystemSubset) { try { if (!fileSystemSubset.isEmpty()) { watching = true; watcher.watch(fileSystemSubset); } } catch (IOException e) { onError.execute(e); } }
@Override public void onExecute(TaskInternal taskInternal, FileCollectionInternal fileSystemInputs) { if (waiter!=null) { FileSystemSubset.Builder fileSystemSubsetBuilder = FileSystemSubset.builder(); fileSystemInputs.registerWatchPoints(fileSystemSubsetBuilder); waiter.watch(fileSystemSubsetBuilder.build()); } }
public FileSystemSubset unfiltered() { return new FileSystemSubset(ImmutableList.copyOf(getRoots()), ImmutableList.<ImmutableDirectoryTree>of()); }
public void append(FileSystemSubset fileSystemSubset) { combinedFileSystemSubset = FileSystemSubset.builder().add(combinedFileSystemSubset).add(fileSystemSubset).build(); updateRoots(); }
static private boolean inCombinedRootsOrAncestorOfAnyRoot(File file, Iterable<? extends File> roots, FileSystemSubset combinedRootsSubset) { return combinedRootsSubset.contains(file) || isAncestorOfAnyRoot(file, roots, true); }