mirror of https://github.com/sbt/sbt.git
[2.x] fix: trim whitespace from sbt.version in build.properties (#8524)
When sbt.version in build.properties has trailing whitespace, sbt incorrectly reports a version mismatch even after reboot. This fix trims the property value in all places where sbt.version is read from build.properties: - Main.scala (version mismatch warning) - MainLoop.scala (clean command version detection) - ScriptedTests.scala (test compatibility check) Fixes #8103
This commit is contained in:
parent
eb81ff9000
commit
43e0428bed
|
|
@ -933,7 +933,7 @@ object BuiltinCommands {
|
|||
val sbtVersionBuildOpt = if (buildProps.exists) {
|
||||
val buildProperties = new Properties()
|
||||
IO.load(buildProperties, buildProps)
|
||||
Option(buildProperties.getProperty(sbtVersionProperty))
|
||||
Option(buildProperties.getProperty(sbtVersionProperty)).map(_.trim)
|
||||
} else None
|
||||
|
||||
val sbtVersionOpt = sbtVersionSystemOpt.orElse(sbtVersionBuildOpt)
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ private[sbt] object MainLoop:
|
|||
val sbtVersionOpt = if (buildProps.exists) {
|
||||
val buildProperties = new Properties()
|
||||
IO.load(buildProperties, buildProps)
|
||||
Option(buildProperties.getProperty("sbt.version"))
|
||||
Option(buildProperties.getProperty("sbt.version")).map(_.trim)
|
||||
} else None
|
||||
val sbtVersion = sbtVersionOpt.getOrElse(appId.version)
|
||||
val currentArtDirs = defaultBoot * "*" / appId.groupID / appId.name / sbtVersion
|
||||
|
|
|
|||
|
|
@ -676,7 +676,7 @@ class ScriptedRunner {
|
|||
|
||||
IO.load(buildProperties, buildPropertiesFile)
|
||||
|
||||
Option(buildProperties.getProperty("sbt.version")) match {
|
||||
Option(buildProperties.getProperty("sbt.version")).map(_.trim) match {
|
||||
case Some(version) => binarySbtVersion(version) == binarySbtVersion(sbtVersion)
|
||||
case None => true
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue