Make bare setting loading order alphabetical

Fixes https://github.com/sbt/sbt/issues/2697
Ref https://twitter.com/not_xuwei_k/status/1230140477959286848

Note that this is could potentially break an existing build that was relying on previous behavior, which seem to return `build.sbt` at the end if you have `a.sbt`, `b.sbt`, `c.sbt`, and `build.sbt`.
This commit is contained in:
Eugene Yokota 2020-02-21 23:39:29 -05:00
parent 523795e204
commit 4b847b148f
6 changed files with 20 additions and 1 deletions

View File

@ -8,6 +8,7 @@
package sbt package sbt
import java.io.File import java.io.File
import java.util.Locale
import KeyRanks.DSetting import KeyRanks.DSetting
import sbt.io.{ GlobFilter, Path } import sbt.io.{ GlobFilter, Path }
@ -114,7 +115,9 @@ object BuildPaths {
private[this] def defaultDependencyBase(globalBase: File) = globalBase / "dependency" private[this] def defaultDependencyBase(globalBase: File) = globalBase / "dependency"
private[this] def defaultGlobalZinc(globalBase: File) = globalBase / "zinc" private[this] def defaultGlobalZinc(globalBase: File) = globalBase / "zinc"
def configurationSources(base: File): Seq[File] = (base * (GlobFilter("*.sbt") - ".sbt")).get def configurationSources(base: File): Seq[File] =
(base * (GlobFilter("*.sbt") - ".sbt")).get
.sortBy(_.getName.toLowerCase(Locale.ENGLISH))
def pluginDirectory(definitionBase: File) = definitionBase / PluginsDirectoryName def pluginDirectory(definitionBase: File) = definitionBase / PluginsDirectoryName
def evalOutputDirectory(base: File) = outputDirectory(base) / "config-classes" def evalOutputDirectory(base: File) = outputDirectory(base) / "config-classes"

View File

@ -0,0 +1 @@
Compile / scalacOptions += "a"

View File

@ -0,0 +1 @@
Compile / scalacOptions += "b"

View File

@ -0,0 +1,12 @@
val check = taskKey[Unit]("")
lazy val root = (project in file("."))
.settings(
Compile / scalacOptions += "multi-project",
check := {
val xs = (Compile / scalacOptions).value
assert(xs.toList == List("multi-project", "a", "b", "bare", "c"), s"$xs")
}
)
Compile / scalacOptions += "bare"

View File

@ -0,0 +1 @@
Compile / scalacOptions += "c"

View File

@ -0,0 +1 @@
> check