diff --git a/main/src/main/scala/sbt/UpperStateOps.scala b/main/src/main/scala/sbt/UpperStateOps.scala index 897083e38..02c9ef0c3 100644 --- a/main/src/main/scala/sbt/UpperStateOps.scala +++ b/main/src/main/scala/sbt/UpperStateOps.scala @@ -33,6 +33,20 @@ trait UpperStateOps extends Any { private[sbt] def currentUnit: LoadedBuildUnit + /** + * Gets the value assigned to `key` in the computed settings map. + * If the project axis is not explicitly specified, it is resolved to be the current project according to the extracted `session`. + * Other axes are resolved to be `Zero` if they are not specified. + */ + def getSetting[A](key: SettingKey[A]): Option[A] + + /** + * Gets the value assigned to `key` in the computed settings map. + * If the project axis is not explicitly specified, it is resolved to be the current project according to the extracted `session`. + * Other axes are resolved to be `Zero` if they are not specified. + */ + def getTaskValue[A](key: TaskKey[A]): Option[Task[A]] + /** * Gets the value assigned to `key` in the computed settings map. * If the project axis is not explicitly specified, it is resolved to be the current project according to the extracted `session`. @@ -111,6 +125,10 @@ object UpperStateOps { private[sbt] def session: SessionSettings = Project.session(s) + def getSetting[A](key: SettingKey[A]): Option[A] = extract.getOpt(key) + + def getTaskValue[A](key: TaskKey[A]): Option[Task[A]] = extract.getOpt(key) + def setting[A](key: SettingKey[A]): A = extract.get(key) def taskValue[A](key: TaskKey[A]): Task[A] = extract.get(key)