
sbt.ScopedKeyData.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of main_2.11 Show documentation
Show all versions of main_2.11 Show documentation
sbt is an interactive build tool
The newest version!
package sbt
import Def.ScopedKey
final case class ScopedKeyData[A](scoped: ScopedKey[A], value: Any) {
import sbt.internal.util.Types.const
val key = scoped.key
val scope = scoped.scope
def typeName: String = fold(fmtMf("Task[%s]"), fmtMf("InputTask[%s]"), key.manifest.toString)
def settingValue: Option[Any] = fold(const(None), const(None), Some(value))
def description: String = fold(fmtMf("Task: %s"), fmtMf("Input task: %s"),
"Setting: %s = %s" format (key.manifest.toString, value.toString))
def fold[A](targ: OptManifest[_] => A, itarg: OptManifest[_] => A, s: => A): A =
if (key.manifest.runtimeClass == classOf[Task[_]]) targ(key.manifest.typeArguments.head)
else if (key.manifest.runtimeClass == classOf[InputTask[_]]) itarg(key.manifest.typeArguments.head)
else s
def fmtMf(s: String): OptManifest[_] => String = s format _
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy