mirror of
https://github.com/sbt/sbt.git
synced 2026-08-22 06:07:24 +02:00
Check for the case the project doesn't exist after reload.
This commit is contained in:
Regular → Executable
+11
-5
@@ -534,17 +534,23 @@ object Load
|
|||||||
}
|
}
|
||||||
|
|
||||||
def initialSession(structure: BuildStructure, rootEval: () => Eval, s: State): SessionSettings = {
|
def initialSession(structure: BuildStructure, rootEval: () => Eval, s: State): SessionSettings = {
|
||||||
val current = s get Keys.sessionSettings map (_.currentProject)
|
val current = s get Keys.sessionSettings map (_.currentProject) getOrElse Map.empty
|
||||||
new SessionSettings(structure.root, projectMap(structure.units, current), structure.settings, Map.empty, Nil, rootEval)
|
new SessionSettings(structure.root, projectMap(structure, current), structure.settings, Map.empty, Nil, rootEval)
|
||||||
}
|
}
|
||||||
|
|
||||||
def initialSession(structure: BuildStructure, rootEval: () => Eval): SessionSettings =
|
def initialSession(structure: BuildStructure, rootEval: () => Eval): SessionSettings =
|
||||||
new SessionSettings(structure.root, projectMap(structure.units, None), structure.settings, Map.empty, Nil, rootEval)
|
new SessionSettings(structure.root, projectMap(structure, Map.empty), structure.settings, Map.empty, Nil, rootEval)
|
||||||
|
|
||||||
def projectMap(units: Map[URI, LoadedBuildUnit], current: Option[Map[URI, String]]): Map[URI, String] =
|
def projectMap(structure: BuildStructure, current: Map[URI, String]): Map[URI, String] =
|
||||||
{
|
{
|
||||||
|
val units = structure.units
|
||||||
val getRoot = getRootProject(units)
|
val getRoot = getRootProject(units)
|
||||||
units.keys.map(uri => (uri, current.flatMap(_ get uri) getOrElse getRoot(uri))).toMap
|
def project(uri: URI) = {
|
||||||
|
current get uri map {
|
||||||
|
p => if (structure allProjects uri map (_.id) contains p) p else getRoot(uri)
|
||||||
|
} getOrElse getRoot(uri)
|
||||||
|
}
|
||||||
|
units.keys.map(uri => (uri, project(uri))).toMap
|
||||||
}
|
}
|
||||||
|
|
||||||
def defaultEvalOptions: Seq[String] = Nil
|
def defaultEvalOptions: Seq[String] = Nil
|
||||||
|
|||||||
Reference in New Issue
Block a user