Only set scriptedBatchExcution true for >= 1.4

In #6091, we updated the ScriptedPlugin to set scriptedBatchExecution :=
true for all 1.x versions but not 0.13. This commit further restricts
the setting so that it is only set for sbt >= 1.4, which seems necessary
based on the comments in #6094.
This commit is contained in:
Ethan Atkins 2020-11-21 08:30:48 -08:00
parent a84d3329aa
commit d686bead0b
1 changed files with 10 additions and 1 deletions

View File

@ -23,6 +23,7 @@ import sbt.io.syntax._
import sbt.librarymanagement._
import sbt.librarymanagement.syntax._
import sbt.nio.file.{ Glob, RecursiveGlob }
import scala.util.Try
object ScriptedPlugin extends AutoPlugin {
@ -79,7 +80,15 @@ object ScriptedPlugin extends AutoPlugin {
scriptedClasspath := getJars(ScriptedConf).value,
scriptedTests := scriptedTestsTask.value,
scriptedParallelInstances := 1,
scriptedBatchExecution := CrossVersionUtil.binarySbtVersion(scriptedSbt.value) != "0.13",
scriptedBatchExecution := {
val binVersion = CrossVersionUtil.binarySbtVersion(scriptedSbt.value)
val versionParts =
binVersion.split("\\.").flatMap(p => Try(p.takeWhile(_.isDigit).toInt).toOption).take(2)
versionParts match {
case Array(major, minor) => major > 1 || (major == 1 && minor >= 4)
case _ => false
}
},
scriptedRun := scriptedRunTask.value,
scriptedDependencies := {
def use[A](@deprecated("unused", "") x: A*): Unit = () // avoid unused warnings