Search in sources :

Example 1 with FileWatcherUpdater

use of org.gradle.internal.watch.registry.FileWatcherUpdater in project gradle by gradle.

the class AbstractFileWatcherRegistryFactory method createFileWatcherRegistry.

@Override
public FileWatcherRegistry createFileWatcherRegistry(FileWatcherRegistry.ChangeHandler handler) {
    BlockingQueue<FileWatchEvent> fileEvents = new ArrayBlockingQueue<>(FILE_EVENT_QUEUE_SIZE);
    try {
        // TODO How can we avoid hard-coding ".gradle" here?
        FileWatcherProbeRegistry probeRegistry = new DefaultFileWatcherProbeRegistry(buildDir -> new File(new File(buildDir, ".gradle"), "file-system.probe"));
        W watcher = createFileWatcher(fileEvents);
        WatchableHierarchies watchableHierarchies = new WatchableHierarchies(probeRegistry, watchFilter);
        FileWatcherUpdater fileWatcherUpdater = createFileWatcherUpdater(watcher, probeRegistry, watchableHierarchies);
        return new DefaultFileWatcherRegistry(fileEventFunctions, watcher, handler, fileWatcherUpdater, fileEvents);
    } catch (InterruptedException e) {
        Thread.currentThread().interrupt();
        throw new RuntimeException(e);
    }
}
Also used : FileWatcherUpdater(org.gradle.internal.watch.registry.FileWatcherUpdater) ArrayBlockingQueue(java.util.concurrent.ArrayBlockingQueue) FileWatchEvent(net.rubygrapefruit.platform.file.FileWatchEvent) FileWatcherProbeRegistry(org.gradle.internal.watch.registry.FileWatcherProbeRegistry) File(java.io.File)

Aggregations

File (java.io.File)1 ArrayBlockingQueue (java.util.concurrent.ArrayBlockingQueue)1 FileWatchEvent (net.rubygrapefruit.platform.file.FileWatchEvent)1 FileWatcherProbeRegistry (org.gradle.internal.watch.registry.FileWatcherProbeRegistry)1 FileWatcherUpdater (org.gradle.internal.watch.registry.FileWatcherUpdater)1