mirror of https://github.com/sbt/sbt.git
Improve reload warnings
I decided creations/deletions/updates were a bit too technical rather than descriptive. It also wasn't really correct to say Meta build sources because the meta build is the build for the build. Instead, I dropped Meta from the sentence. I also made the instructions when changed sources are detected more active. I left them capitalized since they are instructions rather than warnings. Apply these changes by running `reload`. Automatically reload the build when source changes are detected by setting `Global / onChangedBuildSource := ReloadOnSourceChanges`. Disable this warning by setting `Global / onChangedBuildSource := IgnoreSourceChanges`. Also indentation was wrong for the printed files when multiple files had changed because the mkString middle argument was " \n" rather than "\n ".
This commit is contained in:
parent
47cd001eea
commit
cd0461e301
|
|
@ -25,22 +25,24 @@ private[sbt] object CheckBuildSources {
|
|||
logger.debug("Checking for meta build source updates")
|
||||
(changedInputFiles in checkBuildSources).value match {
|
||||
case Some(cf: ChangedFiles) if !firstTime =>
|
||||
val rawPrefix = s"Meta build source files have changed:\n" +
|
||||
(if (cf.created.nonEmpty) s"creations: ${cf.created.mkString("\n ", " \n", "\n")}"
|
||||
val rawPrefix = s"build source files have changed\n" +
|
||||
(if (cf.created.nonEmpty) s"new files: ${cf.created.mkString("\n ", "\n ", "\n")}"
|
||||
else "") +
|
||||
(if (cf.deleted.nonEmpty) s"deletions: ${cf.deleted.mkString("\n ", " \n", "\n")}"
|
||||
(if (cf.deleted.nonEmpty)
|
||||
s"deleted files: ${cf.deleted.mkString("\n ", "\n ", "\n")}"
|
||||
else "") +
|
||||
(if (cf.updated.nonEmpty) s"updates: ${cf.updated.mkString("\n ", " \n", "\n")}"
|
||||
(if (cf.updated.nonEmpty)
|
||||
s"updated files: ${cf.updated.mkString("\n ", "\n ", "\n")}"
|
||||
else "")
|
||||
val prefix = rawPrefix.linesIterator.filterNot(_.trim.isEmpty).mkString("\n")
|
||||
if (o == ReloadOnSourceChanges) {
|
||||
logger.info(s"$prefix\nReloading sbt...")
|
||||
throw Reload
|
||||
} else {
|
||||
val tail = "Reload sbt with the 'reload' command to apply these changes. " +
|
||||
"To automatically reload upon meta build source changed detection, set " +
|
||||
"`Global / onChangedBuildSource := ReloadOnSourceChanges`. To disable this " +
|
||||
"warning, set `Global / onChangedBuildSource := IgnoreSourceChanges`"
|
||||
val tail = "Apply these changes by running `reload`.\nAutomatically reload the " +
|
||||
"build when source changes are detected by setting " +
|
||||
"`Global / onChangedBuildSource := ReloadOnSourceChanges`.\nDisable this " +
|
||||
"warning by setting `Global / onChangedBuildSource := IgnoreSourceChanges`."
|
||||
logger.warn(s"$prefix\n$tail")
|
||||
}
|
||||
case _ => ()
|
||||
|
|
|
|||
Loading…
Reference in New Issue