diff --git a/main/Keys.scala b/main/Keys.scala index 6c8a5cd22..1795d5092 100644 --- a/main/Keys.scala +++ b/main/Keys.scala @@ -37,6 +37,7 @@ object Keys val sessionSettings = AttributeKey[SessionSettings]("session-settings", "Tracks current build, project, and setting modifications.") val stateBuildStructure = AttributeKey[Load.BuildStructure]("build-structure", "Data structure containing all information about the build definition.") val buildStructure = TaskKey[Load.BuildStructure]("build-structure", "Provides access to the build structure, settings, and streams manager.") + val loadedBuild = SettingKey[Load.LoadedBuild]("loaded-build", "Provides access to the loaded project structure. This is the information available before settings are evaluated.") val appConfiguration = SettingKey[xsbti.AppConfiguration]("app-configuration", "Provides access to the launched sbt configuration, including the ScalaProvider, Launcher, and GlobalLock.") val thisProject = SettingKey[ResolvedProject]("this-project", "Provides the current project for the referencing scope.") val thisProjectRef = SettingKey[ProjectRef]("this-project-ref", "Provides a fully-resolved reference to the current project for the referencing scope.") diff --git a/main/Load.scala b/main/Load.scala index c595312d7..3b0000175 100644 --- a/main/Load.scala +++ b/main/Load.scala @@ -13,7 +13,7 @@ package sbt import inc.{FileValueCache, Locate} import Project.{inScope, ScopedKey, ScopeLocal, Setting} import Keys.{appConfiguration, baseDirectory, configuration, streams, Streams, thisProject, thisProjectRef} - import Keys.{globalLogging, isDummy, parseResult, resolvedScoped, taskDefinitionKey} + import Keys.{globalLogging, isDummy, loadedBuild, parseResult, resolvedScoped, taskDefinitionKey} import tools.nsc.reporters.ConsoleReporter import Build.{analyzed, data} import Scope.{GlobalScope, ThisScope} @@ -180,7 +180,8 @@ object Load def isProjectThis(s: Setting[_]) = s.key.scope.project match { case This | Select(ThisProject) => true; case _ => false } def buildConfigurations(loaded: LoadedBuild, rootProject: URI => String, rootEval: () => Eval, injectSettings: InjectSettings): Seq[Setting[_]] = - transformProjectOnly(loaded.root, rootProject, injectSettings.global) ++ + ((loadedBuild in GlobalScope :== loaded) +: + transformProjectOnly(loaded.root, rootProject, injectSettings.global)) ++ loaded.units.toSeq.flatMap { case (uri, build) => val eval = if(uri == loaded.root) rootEval else lazyEval(build.unit) val pluginSettings = build.unit.plugins.plugins