mirror of https://github.com/sbt/sbt.git
Merge pull request #6190 from mkurz/fix_onLoad
onLoad now runs with correct FileTreeRepository and CacheStoreFactory
This commit is contained in:
commit
5d1c394bb4
|
|
@ -940,13 +940,17 @@ object BuiltinCommands {
|
||||||
|
|
||||||
val session = Load.initialSession(structure, eval, s0)
|
val session = Load.initialSession(structure, eval, s0)
|
||||||
SessionSettings.checkSession(session, s2)
|
SessionSettings.checkSession(session, s2)
|
||||||
val s3 = addCacheStoreFactoryFactory(Project.setProject(session, structure, s2))
|
val s3 = Project.setProject(
|
||||||
|
session,
|
||||||
|
structure,
|
||||||
|
s2,
|
||||||
|
st => setupGlobalFileTreeRepository(addCacheStoreFactoryFactory(st))
|
||||||
|
)
|
||||||
val s4 = s3.put(Keys.useLog4J.key, Project.extract(s3).get(Keys.useLog4J))
|
val s4 = s3.put(Keys.useLog4J.key, Project.extract(s3).get(Keys.useLog4J))
|
||||||
val s5 = setupGlobalFileTreeRepository(s4)
|
|
||||||
// This is a workaround for the console task in dotty which uses the classloader cache.
|
// This is a workaround for the console task in dotty which uses the classloader cache.
|
||||||
// We need to override the top loader in that case so that it gets the forked jline.
|
// We need to override the top loader in that case so that it gets the forked jline.
|
||||||
s5.extendedClassLoaderCache.setParent(Project.extract(s5).get(Keys.scalaInstanceTopLoader))
|
s4.extendedClassLoaderCache.setParent(Project.extract(s4).get(Keys.scalaInstanceTopLoader))
|
||||||
addSuperShellParams(CheckBuildSources.init(LintUnused.lintUnusedFunc(s5)))
|
addSuperShellParams(CheckBuildSources.init(LintUnused.lintUnusedFunc(s4)))
|
||||||
}
|
}
|
||||||
|
|
||||||
private val setupGlobalFileTreeRepository: State => State = { state =>
|
private val setupGlobalFileTreeRepository: State => State = { state =>
|
||||||
|
|
|
||||||
|
|
@ -479,7 +479,15 @@ object Project extends ProjectExtra {
|
||||||
previousOnUnload(s.runExitHooks())
|
previousOnUnload(s.runExitHooks())
|
||||||
}
|
}
|
||||||
|
|
||||||
def setProject(session: SessionSettings, structure: BuildStructure, s: State): State = {
|
def setProject(session: SessionSettings, structure: BuildStructure, s: State): State =
|
||||||
|
setProject(session, structure, s, identity)
|
||||||
|
|
||||||
|
def setProject(
|
||||||
|
session: SessionSettings,
|
||||||
|
structure: BuildStructure,
|
||||||
|
s: State,
|
||||||
|
preOnLoad: State => State
|
||||||
|
): State = {
|
||||||
val unloaded = runUnloadHooks(s)
|
val unloaded = runUnloadHooks(s)
|
||||||
val (onLoad, onUnload) = getHooks(structure.data)
|
val (onLoad, onUnload) = getHooks(structure.data)
|
||||||
val newAttrs = unloaded.attributes
|
val newAttrs = unloaded.attributes
|
||||||
|
|
@ -489,7 +497,7 @@ object Project extends ProjectExtra {
|
||||||
val newState = unloaded.copy(attributes = newAttrs)
|
val newState = unloaded.copy(attributes = newAttrs)
|
||||||
// TODO: Fix this
|
// TODO: Fix this
|
||||||
onLoad(
|
onLoad(
|
||||||
updateCurrent(newState) /*LogManager.setGlobalLogLevels(updateCurrent(newState), structure.data)*/
|
preOnLoad(updateCurrent(newState)) /*LogManager.setGlobalLogLevels(updateCurrent(newState), structure.data)*/
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue