Merge pull request #2419 from eed3si9n/wip/2415

Fixes #2415. Hide global setting fix behind sbt.globalsettingfix
This commit is contained in:
Dale Wijnand 2016-01-25 23:00:44 +00:00
commit a92e50929c
8 changed files with 23 additions and 12 deletions

View File

@ -71,12 +71,19 @@ object Load {
if (files.isEmpty || base == globalBase) const(Nil) else buildGlobalSettings(globalBase, files, config)
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.global.autoimport") map { _.toLowerCase == "true" } getOrElse false
def buildGlobalSettings(base: File, files: Seq[File], config: sbt.LoadBuildConfiguration): ClassLoader => Seq[Setting[_]] =
{
val eval = mkEval(data(config.globalPluginClasspath), base, defaultEvalOptions)
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 => {
val loaded = EvaluateConfigurations(eval, files, imports)(loader)

View File

@ -95,6 +95,7 @@
- Fixes update option's `withLatestSnapshots` so it handles modules without an artifact. This flag will be enabled by default.
[#1514][1514]/[#1616][1616]/[#2313][2313] by [@eed3si9n][@eed3si9n]
- No longer passes `-J<flag>` options to the local Java compiler. [#1968][1968]/[#2272][2272] by [@Duhemm][@Duhemm]
- Fixes auto imports for auto plugins in global configuration files. Because this is *not* source compatible with 0.13.x, the fix is enabled only when `sbt.global.autoimport` flag is `true`. [#2120][2120]/[#2399][2399] by [@timcharper][@timcharper]
### Improvements
@ -148,7 +149,6 @@
- Fixes launcher configuration to add `sbt-ivy-snapshots` repository to resolve nightly builds. [@eed3si9n][@eed3si9n]
- Fixes performance issues during tree traversal in the incremental compiler. [#2343][2343] by [@adriaanm][@adriaanm]
- Fixes the tracking of self types and F-bounded existential types in the incremental compiler. [#2343][2343] by [@adriaanm][@adriaanm]
- Fixes autoImports for AutoPlugins for global configuration files. [#2120][2120]/[#2399][2399] by [@timcharper][@timcharper]
### Configurable Scala compiler bridge

View File

@ -1,15 +1,5 @@
package test
import sbt._
object Global {
val x = 3
}
object GlobalAutoPlugin extends AutoPlugin {
object autoImport {
lazy val globalAutoPluginSetting = settingKey[String]("A top level setting declared in a plugin.")
}
}

View File

@ -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.")
}
}

View File

@ -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