mirror of https://github.com/sbt/sbt.git
Move watch default settings
I had previously set some of the watch settings at the global level and
some at the project level. While writing documentation for the new watch
subsystem, I realized that the defaults should be set globally so that
they can be overridden at the ThisBuild level.
I also moved watchTriggers to sbt.nio.Keys. It was an oversight that it
wasn't moved there in a5cefd45be.
This commit is contained in:
parent
4193cc323d
commit
67cbd6c50e
|
|
@ -154,15 +154,11 @@ object Defaults extends BuildCommon {
|
|||
inputFileStamper :== sbt.nio.FileStamper.Hash,
|
||||
outputFileStamper :== sbt.nio.FileStamper.LastModified,
|
||||
onChangedBuildSource :== sbt.nio.Keys.WarnOnSourceChanges,
|
||||
watchTriggeredMessage :== sbt.nio.Watch.defaultOnTriggerMessage,
|
||||
watchForceTriggerOnAnyChange :== false,
|
||||
watchPersistFileStamps :== true,
|
||||
watchTriggers :== Nil,
|
||||
clean := { () },
|
||||
unmanagedFileStampCache :=
|
||||
state.value.get(persistentFileStampCache).getOrElse(new sbt.nio.FileStamp.Cache),
|
||||
managedFileStampCache := new sbt.nio.FileStamp.Cache,
|
||||
) ++ globalIvyCore ++ globalJvmCore
|
||||
) ++ globalIvyCore ++ globalJvmCore ++ Watch.defaults
|
||||
) ++ globalSbtCore
|
||||
|
||||
private[sbt] lazy val globalJvmCore: Seq[Setting[_]] =
|
||||
|
|
@ -344,17 +340,6 @@ object Defaults extends BuildCommon {
|
|||
sys.env.contains("CI") || System.getProperty("sbt.ci", "false") == "true",
|
||||
// watch related settings
|
||||
pollInterval :== Watch.defaultPollInterval,
|
||||
watchAntiEntropy :== Watch.defaultAntiEntropy,
|
||||
watchAntiEntropyRetentionPeriod :== Watch.defaultAntiEntropyRetentionPeriod,
|
||||
watchLogLevel :== Level.Info,
|
||||
watchOnEnter :== Watch.defaultOnEnter,
|
||||
watchOnFileInputEvent :== Watch.trigger,
|
||||
watchDeletionQuarantinePeriod :== Watch.defaultDeletionQuarantinePeriod,
|
||||
watchService :== Watched.newWatchService,
|
||||
watchStartMessage :== Watch.defaultStartWatch,
|
||||
watchTasks := Continuous.continuousTask.evaluated,
|
||||
aggregate in watchTasks :== false,
|
||||
watchTriggeredMessage :== Watch.defaultOnTriggerMessage,
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -125,7 +125,6 @@ object Keys {
|
|||
val managedSources = taskKey[Seq[File]]("Sources generated by the build.").withRank(BTask)
|
||||
val sources = taskKey[Seq[File]]("All sources, both managed and unmanaged.").withRank(BTask)
|
||||
val sourcesInBase = settingKey[Boolean]("If true, sources from the project's base directory are included as main sources.")
|
||||
val watchTriggers = settingKey[Seq[Glob]]("Describes files that should trigger a new continuous build.")
|
||||
|
||||
// Filters
|
||||
val includeFilter = settingKey[FileFilter]("Filter for including sources and resources files from default directories.").withRank(CSetting)
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import java.lang.reflect.Method
|
|||
|
||||
import sbt.Def._
|
||||
import sbt.Keys._
|
||||
import sbt.nio.Keys._
|
||||
import sbt.Project._
|
||||
import sbt.internal.inc.ModuleUtilities
|
||||
import sbt.internal.inc.classpath.ClasspathUtilities
|
||||
|
|
|
|||
|
|
@ -108,6 +108,8 @@ object Keys {
|
|||
"watch",
|
||||
"Watch a task (or multiple tasks) and rebuild when its file inputs change or user input is received. The semantics are more or less the same as the `~` command except that it cannot transform the state on exit. This means that it cannot be used to reload the build."
|
||||
).withRank(DSetting)
|
||||
val watchTriggers =
|
||||
settingKey[Seq[Glob]]("Describes files that should trigger a new continuous build.")
|
||||
val watchTriggeredMessage = settingKey[(Int, Path, Seq[String]) => Option[String]](
|
||||
"The message to show before triggered execution executes an action after sources change. The parameters are the path that triggered the build and the current watch iteration count."
|
||||
).withRank(DSetting)
|
||||
|
|
|
|||
|
|
@ -15,10 +15,12 @@ import java.util.concurrent.TimeUnit
|
|||
|
||||
import sbt.BasicCommandStrings.ContinuousExecutePrefix
|
||||
import sbt._
|
||||
import sbt.internal.Continuous
|
||||
import sbt.internal.LabeledFunctions._
|
||||
import sbt.internal.nio.FileEvent
|
||||
import sbt.internal.util.complete.Parser
|
||||
import sbt.internal.util.complete.Parser._
|
||||
import sbt.nio.Keys._
|
||||
import sbt.nio.file.FileAttributes
|
||||
import sbt.util.{ Level, Logger }
|
||||
|
||||
|
|
@ -476,4 +478,20 @@ object Watch {
|
|||
*/
|
||||
final val clearOnTrigger: Int => Option[String] =
|
||||
((_: Int) => Some(Watched.clearScreen)).label("Watched.clearOnTrigger")
|
||||
private[sbt] def defaults: Seq[Def.Setting[_]] = Seq(
|
||||
sbt.Keys.watchAntiEntropy :== Watch.defaultAntiEntropy,
|
||||
watchAntiEntropyRetentionPeriod :== Watch.defaultAntiEntropyRetentionPeriod,
|
||||
watchLogLevel :== Level.Info,
|
||||
watchOnEnter :== Watch.defaultOnEnter,
|
||||
watchOnFileInputEvent :== Watch.trigger,
|
||||
watchDeletionQuarantinePeriod :== Watch.defaultDeletionQuarantinePeriod,
|
||||
sbt.Keys.watchService :== Watched.newWatchService,
|
||||
watchStartMessage :== Watch.defaultStartWatch,
|
||||
watchTasks := Continuous.continuousTask.evaluated,
|
||||
sbt.Keys.aggregate in watchTasks :== false,
|
||||
watchTriggeredMessage :== Watch.defaultOnTriggerMessage,
|
||||
watchForceTriggerOnAnyChange :== false,
|
||||
watchPersistFileStamps :== true,
|
||||
watchTriggers :== Nil,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue