mirror of https://github.com/sbt/sbt.git
Use FileTreeRepository when interactive or continuous
Ideally we use the FileTreeRepository for interactive sessions by default. A continuous build is effectively interactive, so I'd like that case to also use the file tree repository. To avoid breaking scripted tests, many of which implicitly expect file tree changes to be instantaneously available, we set interactive to true only if we are not in a scripted run, which can be verified by checking that the commands contains "setUpScripted".
This commit is contained in:
parent
dc4f705500
commit
0a9ae7b4b4
|
|
@ -15,10 +15,17 @@ import sbt.io.FileTreeDataView.Entry
|
|||
import sbt.io.syntax.File
|
||||
import sbt.io.{ FileFilter, FileTreeDataView, FileTreeRepository }
|
||||
import sbt._
|
||||
import BasicCommandStrings.ContinuousExecutePrefix
|
||||
|
||||
private[sbt] object FileManagement {
|
||||
private[sbt] def defaultFileTreeView: Def.Initialize[Task[FileTreeViewConfig]] = Def.task {
|
||||
if (state.value.remainingCommands.exists(_.commandLine == "shell")) {
|
||||
val remaining = state.value.remainingCommands.map(_.commandLine.trim)
|
||||
// If the session is interactive or if the commands include a continuous build, then use
|
||||
// the default configuration. Otherwise, use the sbt1_2_compat config, which does not cache
|
||||
// anything, which makes it less likely to cause issues with CI.
|
||||
val interactive = remaining.contains("shell") && !remaining.contains("setUpScripted")
|
||||
val continuous = remaining.exists(_.startsWith(ContinuousExecutePrefix))
|
||||
if (interactive || continuous) {
|
||||
FileTreeViewConfig
|
||||
.default(watchAntiEntropy.value, pollInterval.value, pollingDirectories.value)
|
||||
} else FileTreeViewConfig.sbt1_2_compat(pollInterval.value, watchAntiEntropy.value)
|
||||
|
|
|
|||
Loading…
Reference in New Issue