Scalatex icon indicating copy to clipboard operation
Scalatex copied to clipboard

watchSources should be files not dirs

Open nafg opened this issue 10 years ago • 2 comments

~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 avatar Nov 01 '15 07:11 nafg

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

watchSources ++= (scalatex.SbtPlugin.scalatexDirectory in Compile).value.***.get

nafg avatar Nov 01 '15 07:11 nafg

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

lihaoyi avatar Nov 01 '15 07:11 lihaoyi