From 26e60e9b6aafa0bd4a5fd0c3890ab615d0279b78 Mon Sep 17 00:00:00 2001 From: Ethan Atkins Date: Mon, 16 Sep 2019 11:57:50 -0700 Subject: [PATCH] Monitor project build sources In sbt 1.3.0, we only monitor build sources in the root project directory and the root project meta build directory. This commit adds these inputs for each project. Fixes https://github.com/sbt/sbt/issues/5061. --- main/src/main/scala/sbt/Defaults.scala | 7 +++++-- sbt/src/sbt-test/nio/reload/build.sbt | 2 ++ sbt/src/sbt-test/nio/reload/changes/broken.sbt | 2 ++ sbt/src/sbt-test/nio/reload/changes/sub.sbt | 1 + sbt/src/sbt-test/nio/reload/changes/working.sbt | 2 ++ sbt/src/sbt-test/nio/reload/sub/build.sbt | 0 sbt/src/sbt-test/nio/reload/sub/src/main/scala/Test.scala | 3 +++ sbt/src/sbt-test/nio/reload/test | 6 ++++++ 8 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 sbt/src/sbt-test/nio/reload/changes/sub.sbt create mode 100644 sbt/src/sbt-test/nio/reload/sub/build.sbt create mode 100644 sbt/src/sbt-test/nio/reload/sub/src/main/scala/Test.scala diff --git a/main/src/main/scala/sbt/Defaults.scala b/main/src/main/scala/sbt/Defaults.scala index 03212aa94..072a7595d 100755 --- a/main/src/main/scala/sbt/Defaults.scala +++ b/main/src/main/scala/sbt/Defaults.scala @@ -371,13 +371,16 @@ object Defaults extends BuildCommon { }).value ) - def paths = Seq( + // Appended to JvmPlugin.projectSettings + def paths: Seq[Setting[_]] = Seq( baseDirectory := thisProject.value.base, target := baseDirectory.value / "target", historyPath := (historyPath or target(t => Option(t / ".history"))).value, sourceDirectory := baseDirectory.value / "src", sourceManaged := crossTarget.value / "src_managed", - resourceManaged := crossTarget.value / "resource_managed" + resourceManaged := crossTarget.value / "resource_managed", + // Adds subproject build.sbt files to the global list of build files to monitor + Scope.Global / checkBuildSources / fileInputs += baseDirectory.value.toGlob / "*.sbt" ) lazy val configPaths = sourceConfigPaths ++ resourceConfigPaths ++ outputConfigPaths diff --git a/sbt/src/sbt-test/nio/reload/build.sbt b/sbt/src/sbt-test/nio/reload/build.sbt index c143ba056..c5e320e75 100644 --- a/sbt/src/sbt-test/nio/reload/build.sbt +++ b/sbt/src/sbt-test/nio/reload/build.sbt @@ -11,3 +11,5 @@ exists := { } Global / onChangedBuildSource := ReloadOnSourceChanges + +val sub = project diff --git a/sbt/src/sbt-test/nio/reload/changes/broken.sbt b/sbt/src/sbt-test/nio/reload/changes/broken.sbt index 57e15cd57..5210c3db2 100644 --- a/sbt/src/sbt-test/nio/reload/changes/broken.sbt +++ b/sbt/src/sbt-test/nio/reload/changes/broken.sbt @@ -8,3 +8,5 @@ exists := { } Global / onChangedBuildSource := ReloadOnSourceChanges + +val sub = project diff --git a/sbt/src/sbt-test/nio/reload/changes/sub.sbt b/sbt/src/sbt-test/nio/reload/changes/sub.sbt new file mode 100644 index 000000000..f0ce2b852 --- /dev/null +++ b/sbt/src/sbt-test/nio/reload/changes/sub.sbt @@ -0,0 +1 @@ +libraryDependencies += "org.scala-sbt" % "sbt" % "1.3.0" \ No newline at end of file diff --git a/sbt/src/sbt-test/nio/reload/changes/working.sbt b/sbt/src/sbt-test/nio/reload/changes/working.sbt index c143ba056..c5e320e75 100644 --- a/sbt/src/sbt-test/nio/reload/changes/working.sbt +++ b/sbt/src/sbt-test/nio/reload/changes/working.sbt @@ -11,3 +11,5 @@ exists := { } Global / onChangedBuildSource := ReloadOnSourceChanges + +val sub = project diff --git a/sbt/src/sbt-test/nio/reload/sub/build.sbt b/sbt/src/sbt-test/nio/reload/sub/build.sbt new file mode 100644 index 000000000..e69de29bb diff --git a/sbt/src/sbt-test/nio/reload/sub/src/main/scala/Test.scala b/sbt/src/sbt-test/nio/reload/sub/src/main/scala/Test.scala new file mode 100644 index 000000000..405e020be --- /dev/null +++ b/sbt/src/sbt-test/nio/reload/sub/src/main/scala/Test.scala @@ -0,0 +1,3 @@ +object Test { + val x = sbt.Keys +} \ No newline at end of file diff --git a/sbt/src/sbt-test/nio/reload/test b/sbt/src/sbt-test/nio/reload/test index abfe64f5e..81c024396 100644 --- a/sbt/src/sbt-test/nio/reload/test +++ b/sbt/src/sbt-test/nio/reload/test @@ -17,3 +17,9 @@ $ copy-file changes/working.sbt build.sbt > foo foo; reload > exists foo + +-> compile + +$ copy-file changes/sub.sbt sub/build.sbt + +> compile