diff --git a/main/src/main/scala/sbt/Defaults.scala b/main/src/main/scala/sbt/Defaults.scala index 684fd8008..55fc10be5 100755 --- a/main/src/main/scala/sbt/Defaults.scala +++ b/main/src/main/scala/sbt/Defaults.scala @@ -383,14 +383,19 @@ object Defaults extends BuildCommon { val include = (includeFilter in unmanagedSources).value val exclude = (excludeFilter in unmanagedSources).value match { case e => - (managedSources in ThisScope).value match { - case l if l.nonEmpty => - e || new FileFilter { - private val files = l.toSet - override def accept(pathname: File): Boolean = files.contains(pathname) - override def toString = s"ManagedSourcesFilter($files)" - } - case _ => e + val s = state.value + try { + Project.extract(s).runTask(managedSources in Compile in ThisScope, s) match { + case (_, l) if l.nonEmpty => + e || new FileFilter { + private val files = l.toSet + override def accept(pathname: File): Boolean = files.contains(pathname) + override def toString = s"ManagedSourcesFilter($files)" + } + case _ => e + } + } catch { + case NonFatal(_) => e } } val baseSources = diff --git a/sbt/src/sbt-test/watch/watch-sources/build.sbt b/sbt/src/sbt-test/watch/watch-sources/build.sbt new file mode 100644 index 000000000..16a193e6f --- /dev/null +++ b/sbt/src/sbt-test/watch/watch-sources/build.sbt @@ -0,0 +1,3 @@ +lazy val root = (project in file(".")).aggregate(parent, child) +lazy val parent = project +lazy val child = project.enablePlugins(JmhPlugin).dependsOn(parent) diff --git a/sbt/src/sbt-test/watch/watch-sources/changes/Foo.scala b/sbt/src/sbt-test/watch/watch-sources/changes/Foo.scala new file mode 100644 index 000000000..c389887ee --- /dev/null +++ b/sbt/src/sbt-test/watch/watch-sources/changes/Foo.scala @@ -0,0 +1 @@ +class Foo diff --git a/sbt/src/sbt-test/watch/watch-sources/child/src/main/scala/Bar.scala b/sbt/src/sbt-test/watch/watch-sources/child/src/main/scala/Bar.scala new file mode 100644 index 000000000..f6673f853 --- /dev/null +++ b/sbt/src/sbt-test/watch/watch-sources/child/src/main/scala/Bar.scala @@ -0,0 +1 @@ +class Bar diff --git a/sbt/src/sbt-test/watch/watch-sources/parent/src/main/scala/Foo.scala b/sbt/src/sbt-test/watch/watch-sources/parent/src/main/scala/Foo.scala new file mode 100644 index 000000000..970bfef8a --- /dev/null +++ b/sbt/src/sbt-test/watch/watch-sources/parent/src/main/scala/Foo.scala @@ -0,0 +1 @@ +class Foo { diff --git a/sbt/src/sbt-test/watch/watch-sources/project/plugin.sbt b/sbt/src/sbt-test/watch/watch-sources/project/plugin.sbt new file mode 100644 index 000000000..a12e17f90 --- /dev/null +++ b/sbt/src/sbt-test/watch/watch-sources/project/plugin.sbt @@ -0,0 +1 @@ +addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.3.4") diff --git a/sbt/src/sbt-test/watch/watch-sources/test b/sbt/src/sbt-test/watch/watch-sources/test new file mode 100644 index 000000000..50a9e2b19 --- /dev/null +++ b/sbt/src/sbt-test/watch/watch-sources/test @@ -0,0 +1,9 @@ +> watchTransitiveSources + +-> compile + +$ copy-file changes/Foo.scala parent/src/main/scala/Foo.scala + +> watchTransitiveSources + +> compile