mirror of https://github.com/sbt/sbt.git
Fixes #2415. Hide global setting fix behind sbt.globalsettingfix
We are hiding a bug fix on global setting that was not importing auto imports because fixing this via sbt/sbt#2399 breaks the source compatibility: sbt/sbt#2415 I've split out the relevant portion of the scripted test into global-settings, and marked it pending.
This commit is contained in:
parent
e64b01142b
commit
ceccbf2d5a
|
|
@ -71,12 +71,19 @@ object Load {
|
||||||
if (files.isEmpty || base == globalBase) const(Nil) else buildGlobalSettings(globalBase, files, config)
|
if (files.isEmpty || base == globalBase) const(Nil) else buildGlobalSettings(globalBase, files, config)
|
||||||
config.copy(injectSettings = config.injectSettings.copy(projectLoaded = compiled))
|
config.copy(injectSettings = config.injectSettings.copy(projectLoaded = compiled))
|
||||||
}
|
}
|
||||||
|
// We are hiding a bug fix on global setting that was not importing auto imports.
|
||||||
|
// Because fixing this via https://github.com/sbt/sbt/pull/2399
|
||||||
|
// breaks the source compatibility: https://github.com/sbt/sbt/issues/2415
|
||||||
|
@deprecated("Remove this when we can break source compatibility.", "0.13.10")
|
||||||
|
private[sbt] def useAutoImportInGlobal = sys.props.get("sbt.globalsettingfix") map { _.toLowerCase == "true" } getOrElse false
|
||||||
def buildGlobalSettings(base: File, files: Seq[File], config: sbt.LoadBuildConfiguration): ClassLoader => Seq[Setting[_]] =
|
def buildGlobalSettings(base: File, files: Seq[File], config: sbt.LoadBuildConfiguration): ClassLoader => Seq[Setting[_]] =
|
||||||
{
|
{
|
||||||
val eval = mkEval(data(config.globalPluginClasspath), base, defaultEvalOptions)
|
val eval = mkEval(data(config.globalPluginClasspath), base, defaultEvalOptions)
|
||||||
|
|
||||||
val imports = BuildUtil.baseImports ++
|
val imports = BuildUtil.baseImports ++
|
||||||
config.detectedGlobalPlugins.imports
|
(// when we can beak the source compat, remove this if and use config.detectedGlobalPlugins.imports
|
||||||
|
if (useAutoImportInGlobal) config.detectedGlobalPlugins.imports
|
||||||
|
else BuildUtil.importAllRoot(config.globalPluginNames))
|
||||||
|
|
||||||
loader => {
|
loader => {
|
||||||
val loaded = EvaluateConfigurations(eval, files, imports)(loader)
|
val loaded = EvaluateConfigurations(eval, files, imports)(loader)
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,5 @@
|
||||||
package test
|
package test
|
||||||
|
|
||||||
import sbt._
|
|
||||||
|
|
||||||
object Global {
|
object Global {
|
||||||
val x = 3
|
val x = 3
|
||||||
}
|
}
|
||||||
|
|
||||||
object GlobalAutoPlugin extends AutoPlugin {
|
|
||||||
|
|
||||||
object autoImport {
|
|
||||||
lazy val globalAutoPluginSetting = settingKey[String]("A top level setting declared in a plugin.")
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
package test
|
||||||
|
|
||||||
|
import sbt._
|
||||||
|
|
||||||
|
object GlobalAutoPlugin extends AutoPlugin {
|
||||||
|
|
||||||
|
object autoImport {
|
||||||
|
lazy val globalAutoPluginSetting = settingKey[String]("A top level setting declared in a plugin.")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
# This test is marked pending because sbt.globalsettingfix flag is off by default
|
||||||
|
# See https://github.com/sbt/sbt/issues/2415
|
||||||
|
> name
|
||||||
Loading…
Reference in New Issue