Skip to content

Commit

Permalink
Merge pull request #74 from eed3si9n/wip/companion
Browse files Browse the repository at this point in the history
Provide companion apply for sbt.internal.io.Source
  • Loading branch information
eed3si9n authored Aug 28, 2017
2 parents 50fa152 + a542f53 commit e5c627b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion io/src/main/scala/sbt/internal/io/SourceModificationWatch.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package sbt.internal.io
import java.nio.file.{ Files, Path, WatchEvent, WatchKey }
import java.nio.file.StandardWatchEventKinds._

import sbt.io.{ DirectoryFilter, FileFilter, WatchService }
import sbt.io.{ DirectoryFilter, FileFilter, WatchService, AllPassFilter, NothingFilter }
import sbt.io.syntax._

import scala.annotation.tailrec
Expand Down Expand Up @@ -156,6 +156,14 @@ final class Source(base: File, includeFilter: FileFilter, excludeFilter: FileFil

}

object Source {
def apply(base: File): Source =
new Source(base, AllPassFilter, NothingFilter)

def apply(base: File, includeFilter: FileFilter, excludeFilter: FileFilter): Source =
new Source(base, includeFilter, excludeFilter)
}

private[sbt] object WatchState {

/** What events should be monitored */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ abstract class SourceModificationWatchSpec(
}

private def emptyState(service: WatchService, base: File): WatchState = {
val sources = Seq(new Source(base, "*.scala", new SimpleFilter(_.startsWith("."))))
val sources = Seq(Source(base, "*.scala", new SimpleFilter(_.startsWith("."))))
WatchState.empty(service, sources).withCount(1)
}

Expand Down

0 comments on commit e5c627b

Please sign in to comment.