additional warning when ignoring project load failure

This commit is contained in:
Mark Harrah 2011-07-24 17:36:42 -04:00
parent a9315dbd49
commit 109326d34b
3 changed files with 7 additions and 0 deletions

View File

@ -354,7 +354,11 @@ object BuiltinCommands
else if(matches(Quit))
s.exit(ok = false)
else if(matches("ignore"))
{
val hadPrevious = Project.isProjectLoaded(s)
logger(s).warn("Ignoring load failure: " + (if(hadPrevious) "using previously loaded project." else "no project loaded."))
s
}
else
{
println("Invalid response.")

View File

@ -129,6 +129,7 @@ object Project extends Init[Scope] with ProjectExtra
def getOrError[T](state: State, key: AttributeKey[T], msg: String): T = state get key getOrElse error(msg)
def structure(state: State): BuildStructure = getOrError(state, stateBuildStructure, "No build loaded.")
def session(state: State): SessionSettings = getOrError(state, sessionSettings, "Session not initialized.")
def isProjectLoaded(state: State): Boolean = (state has sessionSettings) && (state has stateBuildStructure)
def extract(state: State): Extracted = extract( session(state), structure(state) )
def extract(se: SessionSettings, st: BuildStructure): Extracted = Extracted(st, se, se.current)

View File

@ -40,6 +40,7 @@ trait StateOps {
def get[T](key: AttributeKey[T]): Option[T]
def put[T](key: AttributeKey[T], value: T): State
def remove(key: AttributeKey[_]): State
def has(key: AttributeKey[_]): Boolean
def baseDir: File
def locked[T](file: File)(t: => T): T
def runExitHooks(): State
@ -72,6 +73,7 @@ object State
def exit(ok: Boolean) = setResult(Some(Exit(if(ok) 0 else 1)))
def get[T](key: AttributeKey[T]) = s.attributes get key
def put[T](key: AttributeKey[T], value: T) = s.copy(attributes = s.attributes.put(key, value))
def has(key: AttributeKey[_]) = s.attributes contains key
def remove(key: AttributeKey[_]) = s.copy(attributes = s.attributes remove key)
def fail =
{