mirror of https://github.com/sbt/sbt.git
enable sbt-plugin auto-configuration when using 'reload plugins'
This commit is contained in:
parent
f0eb3ac3a8
commit
2c5a2f0f96
|
|
@ -27,13 +27,14 @@ object Load
|
|||
import Locate.DefinesClass
|
||||
|
||||
// note that there is State passed in but not pulled out
|
||||
def defaultLoad(state: State, baseDirectory: File, log: Logger): (() => Eval, BuildStructure) =
|
||||
def defaultLoad(state: State, baseDirectory: File, log: Logger, isPlugin: Boolean = false): (() => Eval, BuildStructure) =
|
||||
{
|
||||
val globalBase = getGlobalBase(state)
|
||||
val base = baseDirectory.getCanonicalFile
|
||||
val definesClass = FileValueCache(Locate.definesClass _)
|
||||
val rawConfig = defaultPreGlobal(state, base, definesClass.get, globalBase, log)
|
||||
val config = defaultWithGlobal(state, base, rawConfig, globalBase, log)
|
||||
val config0 = defaultWithGlobal(state, base, rawConfig, globalBase, log)
|
||||
val config = if(isPlugin) enableSbtPlugin(config0) else config0
|
||||
val result = apply(base, state, config)
|
||||
definesClass.clear()
|
||||
result
|
||||
|
|
|
|||
|
|
@ -335,7 +335,7 @@ object BuiltinCommands
|
|||
def loadProjectImpl = Command(LoadProjectImpl)(_ => Project.loadActionParser) { (s0, action) =>
|
||||
val (s, base) = Project.loadAction(SessionVar.clear(s0), action)
|
||||
IO.createDirectory(base)
|
||||
val (eval, structure) = Load.defaultLoad(s, base, s.log)
|
||||
val (eval, structure) = Load.defaultLoad(s, base, s.log, Project.inPluginProject(s))
|
||||
val session = Load.initialSession(structure, eval, s0)
|
||||
SessionSettings.checkSession(session, s)
|
||||
Project.setProject(session, structure, s)
|
||||
|
|
|
|||
|
|
@ -370,7 +370,8 @@ object Project extends Init[Scope] with ProjectExtra
|
|||
val loadActionParser = token(Space ~> ("plugins" ^^^ Plugins | "return" ^^^ Return)) ?? Current
|
||||
|
||||
val ProjectReturn = AttributeKey[List[File]]("project-return", "Maintains a stack of builds visited using reload.")
|
||||
def projectReturn(s: State): List[File] = s.attributes get ProjectReturn getOrElse Nil
|
||||
def projectReturn(s: State): List[File] = s get ProjectReturn getOrElse Nil
|
||||
def inPluginProject(s: State): Boolean = projectReturn(s).toList.length > 1
|
||||
def setProjectReturn(s: State, pr: List[File]): State = s.copy(attributes = s.attributes.put( ProjectReturn, pr) )
|
||||
def loadAction(s: State, action: LoadAction.Value) = action match {
|
||||
case Return =>
|
||||
|
|
|
|||
Loading…
Reference in New Issue