lihaoyi / Scalatex

Programmable, Typesafe Document Generation
290 stars 38 forks source link

watchSources should be files not dirs #23

Open nafg opened 9 years ago

nafg commented 9 years ago

~run does not work for me (on ubuntu). I suspect the cause is,

 > show watchSources
[info] List(/home/naftoli/dev/github.com/nafg/slides-docker/src/main/scala/Main.scala, /home/naftoli/dev/github.com/nafg/slides-docker/src/main/resources, /home/naftoli/dev/github.com/nafg/slides-docker/src/test/resources, /home/naftoli/dev/github.com/nafg/slides-docker/src/main/scalatex)

So for scala, it includes actual files, but for scalatex on the directories.

ls /home/naftoli/dev/github.com/nafg/slides-docker/src/main/scalatex
Slides.scalatex

Note the default value for watchSources comes from


    def collectFiles(dirs: ScopedTaskable[Seq[File]], filter: ScopedTaskable[FileFilter], excludes: ScopedTaskable[FileFilter]): Initialize[Task[Seq[File]]] =
        (dirs, filter, excludes) map { (d,f,excl) => d.descendantsExcept(f,excl).get }

...

        unmanagedSources <<= collectFiles(unmanagedSourceDirectories, includeFilter in unmanagedSources, excludeFilter in unmanagedSources),
    watchSources in ConfigGlobal <++= unmanagedSources

...

        unmanagedResources <<= collectFiles(unmanagedResourceDirectories, includeFilter in unmanagedResources, excludeFilter in unmanagedResources),
        watchSources in ConfigGlobal ++= unmanagedResources.value

(from http://www.scala-sbt.org/0.13/sxr/sbt/Defaults.scala.html)

While scalatex has

watchSources ++= {
      for{
        f <- (scalatexDirectory in Compile).value.get
        if f.relativeTo((target in Compile).value).isEmpty
      } yield f
    }
nafg commented 9 years ago

Update: adding this to my build.sbt fixed it:

watchSources ++= (scalatex.SbtPlugin.scalatexDirectory in Compile).value.***.get
lihaoyi commented 9 years ago

did you redefine the root project in that folder? I've had that cause problems in the past