mirror of https://github.com/sbt/sbt.git
Merge pull request #6099 from xirc/system-property-for-on-changed-build-source
Support a system property for onChangedBuildSource
This commit is contained in:
commit
c52e9916e2
|
|
@ -167,7 +167,7 @@ object Defaults extends BuildCommon {
|
||||||
fileOutputExcludeFilter :== NothingFilter.toNio,
|
fileOutputExcludeFilter :== NothingFilter.toNio,
|
||||||
inputFileStamper :== sbt.nio.FileStamper.Hash,
|
inputFileStamper :== sbt.nio.FileStamper.Hash,
|
||||||
outputFileStamper :== sbt.nio.FileStamper.LastModified,
|
outputFileStamper :== sbt.nio.FileStamper.LastModified,
|
||||||
onChangedBuildSource :== sbt.nio.Keys.WarnOnSourceChanges,
|
onChangedBuildSource :== SysProp.onChangedBuildSource,
|
||||||
clean := { () },
|
clean := { () },
|
||||||
unmanagedFileStampCache :=
|
unmanagedFileStampCache :=
|
||||||
state.value.get(persistentFileStampCache).getOrElse(new sbt.nio.FileStamp.Cache),
|
state.value.get(persistentFileStampCache).getOrElse(new sbt.nio.FileStamp.Cache),
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ import scala.util.control.NonFatal
|
||||||
import scala.concurrent.duration._
|
import scala.concurrent.duration._
|
||||||
import sbt.internal.util.{ Terminal => ITerminal }
|
import sbt.internal.util.{ Terminal => ITerminal }
|
||||||
import sbt.internal.util.complete.SizeParser
|
import sbt.internal.util.complete.SizeParser
|
||||||
|
import sbt.nio.Keys._
|
||||||
|
|
||||||
// See also BuildPaths.scala
|
// See also BuildPaths.scala
|
||||||
// See also LineReader.scala
|
// See also LineReader.scala
|
||||||
|
|
@ -162,4 +163,17 @@ object SysProp {
|
||||||
case None => true
|
case None => true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def onChangedBuildSource: WatchBuildSourceOption = {
|
||||||
|
val sysPropKey = "sbt.build.onchange"
|
||||||
|
sys.props.getOrElse(sysPropKey, "warn") match {
|
||||||
|
case "reload" => ReloadOnSourceChanges
|
||||||
|
case "warn" => WarnOnSourceChanges
|
||||||
|
case "ignore" => IgnoreSourceChanges
|
||||||
|
case unknown =>
|
||||||
|
System.err.println(s"Unknown $sysPropKey: $unknown.\nUsing warn.")
|
||||||
|
sbt.nio.Keys.WarnOnSourceChanges
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue