Fix default FileTreeViewConfig

It was possible that on startup, when this function was first invoked,
that the default boot commands are present. This was a problem because
the global file repository is instantiated using the value of this task.
When we start a continuous build, this task gets run again to evaluate
again.

When sbt is started without an implicit task list, then the task is
implicitly shell as indicated by the command "iflast shell". We can use
this to determine whether or not to use the global file system cache or
not.
This commit is contained in:
Ethan Atkins 2018-10-10 16:45:22 -07:00
parent 2f01970007
commit d9e8ae18b2
1 changed files with 4 additions and 2 deletions

View File

@ -23,9 +23,11 @@ private[sbt] object FileManagement {
// 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 interactive = remaining.contains("shell") || remaining.lastOption.contains("iflast shell")
val scripted = remaining.contains("setUpScripted")
val continuous = remaining.exists(_.startsWith(ContinuousExecutePrefix))
if (interactive || continuous) {
if (!scripted && (interactive || continuous)) {
FileTreeViewConfig
.default(watchAntiEntropy.value, pollInterval.value, pollingDirectories.value)
} else FileTreeViewConfig.sbt1_2_compat(pollInterval.value, watchAntiEntropy.value)