mirror of https://github.com/sbt/sbt.git
[2.x] fix: Fixes pollInterval (#9020)
**Problem/Solution** checkBuildSources / pollInterval should just fallback to some value.
This commit is contained in:
parent
5469e046fa
commit
c89f14caa1
|
|
@ -420,6 +420,7 @@ object Defaults extends BuildCommon {
|
|||
terminal := Def.uncached(state.value.get(terminalKey).getOrElse(Terminal(ITerminal.get))),
|
||||
InstallSbtn.installSbtn := InstallSbtn.installSbtnImpl.evaluated,
|
||||
InstallSbtn.installSbtn / aggregate := false,
|
||||
checkBuildSources / pollInterval :== CheckBuildSources.defaultPollInterval,
|
||||
) ++ LintUnused.lintSettings
|
||||
++ DefaultBackgroundJobService.backgroundJobServiceSettings
|
||||
++ RemoteCache.globalSettings
|
||||
|
|
@ -555,8 +556,6 @@ object Defaults extends BuildCommon {
|
|||
sourceManaged := target.value / "src_managed",
|
||||
resourceManaged := target.value / "resource_managed",
|
||||
// Adds subproject build.sbt files to the global list of build files to monitor
|
||||
Scope.Global / checkBuildSources / pollInterval :==
|
||||
new FiniteDuration(Int.MinValue, TimeUnit.MILLISECONDS),
|
||||
Scope.Global / checkBuildSources / fileInputs ++= {
|
||||
if ((Scope.Global / onChangedBuildSource).value != IgnoreSourceChanges)
|
||||
Seq(baseDirectory.value.toGlob / "*.sbt")
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ package sbt
|
|||
package internal.nio
|
||||
|
||||
import java.nio.file.Path
|
||||
import java.util.concurrent.TimeUnit
|
||||
import java.util.concurrent.atomic.{ AtomicBoolean, AtomicReference }
|
||||
import sbt.BasicCommandStrings.{ RebootCommand, Shutdown, TerminateAction }
|
||||
import sbt.Keys.{ baseDirectory, pollInterval, state }
|
||||
|
|
@ -65,7 +66,9 @@ private[sbt] class CheckBuildSources extends AutoCloseable {
|
|||
}
|
||||
private def reset(state: State): Unit = {
|
||||
val extracted = Project.extract(state)
|
||||
val interval = extracted.get(checkBuildSources / pollInterval)
|
||||
val interval = extracted
|
||||
.getOpt(checkBuildSources / pollInterval)
|
||||
.getOrElse(CheckBuildSources.defaultPollInterval)
|
||||
val newSources = extracted.get(Global / checkBuildSources / fileInputs).distinct
|
||||
if (interval >= 0.seconds || "polling" == SysProp.watchMode) {
|
||||
Option(repository.getAndSet(null)).foreach(_.close())
|
||||
|
|
@ -174,7 +177,9 @@ private[sbt] class CheckBuildSources extends AutoCloseable {
|
|||
override def close(): Unit = {}
|
||||
}
|
||||
|
||||
private[sbt] object CheckBuildSources {
|
||||
private[sbt] object CheckBuildSources:
|
||||
val defaultPollInterval: FiniteDuration = FiniteDuration(Int.MinValue, TimeUnit.MILLISECONDS)
|
||||
|
||||
private[sbt] val CheckBuildSourcesKey =
|
||||
AttributeKey[CheckBuildSources]("check-build-source", "", KeyRanks.Invisible)
|
||||
/*
|
||||
|
|
@ -219,4 +224,4 @@ private[sbt] object CheckBuildSources {
|
|||
projectGlobs(projectDir, baseDir.toGlob / "*.sbt" :: Nil)
|
||||
} else Nil
|
||||
}
|
||||
}
|
||||
end CheckBuildSources
|
||||
|
|
|
|||
Loading…
Reference in New Issue