aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala-sbt-1.0/Compat.scala
blob: f1a9d470ca7c4d68f3cbac5f4770b1261a6c3f34 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*
 * sbt-boilerplate is distributed under the 2-Clause BSD license. See the LICENSE file in the root
 * of the repository.
 *
 * Copyright (c) 2012-2016 Johannes Rudolph
 */
package spray.boilerplate

import sbt._
import Keys._
import sbt.internal.io.Source

object Compat {
  private val boilerplateSource = settingKey[File]("Default directory containing boilerplate template sources.")
  private val inputFilter = """.*\.template""".r

  def allPaths(f: File) = f.allPaths

  def watchSourceSettings = Def.settings {
    Seq(
      watchSources in Defaults.ConfigGlobal +=
        new Source(
          boilerplateSource.value,
          new NameFilter {
            override def accept(name: String): Boolean = inputFilter.pattern.matcher(name).matches()
          },
          NothingFilter)
    )
  }
}