mirror of https://github.com/sbt/sbt.git
fix time at which task session state gets cleared
This commit is contained in:
parent
6f306e3c13
commit
ba70e9d604
|
|
@ -443,7 +443,7 @@ object BuiltinCommands
|
||||||
def loadProject = Command(LoadProject, LoadProjectBrief, LoadProjectDetailed)(_ => matched(Project.loadActionParser)) { (s,arg) => loadProjectCommands(arg) ::: s }
|
def loadProject = Command(LoadProject, LoadProjectBrief, LoadProjectDetailed)(_ => matched(Project.loadActionParser)) { (s,arg) => loadProjectCommands(arg) ::: s }
|
||||||
|
|
||||||
def loadProjectImpl = Command(LoadProjectImpl)(_ => Project.loadActionParser) { (s0, action) =>
|
def loadProjectImpl = Command(LoadProjectImpl)(_ => Project.loadActionParser) { (s0, action) =>
|
||||||
val (s, base) = Project.loadAction(s0, action)
|
val (s, base) = Project.loadAction(SessionVar.clear(s0), action)
|
||||||
IO.createDirectory(base)
|
IO.createDirectory(base)
|
||||||
val (eval, structure) = Load.defaultLoad(s, base, logger(s))
|
val (eval, structure) = Load.defaultLoad(s, base, logger(s))
|
||||||
val session = Load.initialSession(structure, eval)
|
val session = Load.initialSession(structure, eval)
|
||||||
|
|
|
||||||
|
|
@ -164,7 +164,7 @@ object Project extends Init[Scope] with ProjectExtra
|
||||||
{
|
{
|
||||||
val unloaded = runUnloadHooks(s)
|
val unloaded = runUnloadHooks(s)
|
||||||
val (onLoad, onUnload) = getHooks(structure.data)
|
val (onLoad, onUnload) = getHooks(structure.data)
|
||||||
val newAttrs = unloaded.attributes.put(stateBuildStructure, structure).put(sessionSettings, session).put(Keys.onUnload.key, onUnload).put(sessionVars, SessionVar.emptyMap)
|
val newAttrs = unloaded.attributes.put(stateBuildStructure, structure).put(sessionSettings, session).put(Keys.onUnload.key, onUnload)
|
||||||
val newState = unloaded.copy(attributes = newAttrs)
|
val newState = unloaded.copy(attributes = newAttrs)
|
||||||
onLoad(updateCurrent( newState ))
|
onLoad(updateCurrent( newState ))
|
||||||
}
|
}
|
||||||
|
|
@ -379,6 +379,8 @@ object SessionVar
|
||||||
Operations.write(s.binary(DefaultDataID), value)(f)
|
Operations.write(s.binary(DefaultDataID), value)(f)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def clear(s: State): State = s.put(sessionVars, SessionVar.emptyMap)
|
||||||
|
|
||||||
def get[T](key: ScopedKey[Task[T]], state: State): Option[T] = orEmpty(state get sessionVars) get key
|
def get[T](key: ScopedKey[Task[T]], state: State): Option[T] = orEmpty(state get sessionVars) get key
|
||||||
|
|
||||||
def set[T](key: ScopedKey[Task[T]], state: State, value: T): State = state.update(sessionVars)(om => orEmpty(om) put (key, value))
|
def set[T](key: ScopedKey[Task[T]], state: State, value: T): State = state.update(sessionVars)(om => orEmpty(om) put (key, value))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue