mirror of https://github.com/sbt/sbt.git
[2.0.x] Support given in build.sbt (#9432)
Co-authored-by: xuwei-k <6b656e6a69@gmail.com>
This commit is contained in:
parent
35e99d27c1
commit
1125129bce
|
|
@ -350,8 +350,8 @@ object BuildUtilLite:
|
|||
/** Prepend `_root_` and import just the names. */
|
||||
def importNamesRoot(names: Seq[String]): Seq[String] = importNames(names map rootedName)
|
||||
|
||||
/** Wildcard import `._` for all values. */
|
||||
def importAll(values: Seq[String]): Seq[String] = importNames(values map { _ + "._" })
|
||||
/** Wildcard import `.{*, given}` for all values. */
|
||||
def importAll(values: Seq[String]): Seq[String] = importNames(values map { _ + ".{*, given}" })
|
||||
def importAllRoot(values: Seq[String]): Seq[String] = importAll(values map rootedName)
|
||||
def rootedName(s: String): String = if (s contains '.') "_root_." + s else s
|
||||
end BuildUtilLite
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
given Foo[Int] = Foo(2)
|
||||
|
||||
given s: Foo[String] = Foo("a")
|
||||
|
||||
InputKey[Unit]("check") := {
|
||||
assert(summon[Foo[Int]].value == 2)
|
||||
assert(summon[Foo[String]].value == "a")
|
||||
assert(s.value == "a")
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
case class Foo[A](value: A)
|
||||
|
|
@ -0,0 +1 @@
|
|||
> check
|
||||
Loading…
Reference in New Issue