|
| 1 | +package sbtbuildinfo |
| 2 | + |
| 3 | +import sbt._, Keys._ |
| 4 | +import BuildInfoPlugin.autoImport._ |
| 5 | + |
| 6 | +object BuildInfoKeySpec { |
| 7 | + buildInfoKeys := Seq(name, version) // test `:=` works with setting keys |
| 8 | + buildInfoKeys := Seq(products, fullClasspath) // test `:=` works with task keys |
| 9 | + buildInfoKeys := Seq(name, fullClasspath) // test `:=` works with setting and task keys |
| 10 | + buildInfoKeys := Seq( // test `:=` works with misc things |
| 11 | + name, |
| 12 | + fullClasspath, |
| 13 | + "year" -> 2012, |
| 14 | + BuildInfoKey.action("buildTime") { 1234L }, |
| 15 | + BuildInfoKey.map(version) { case (_, v) => "projectVersion" -> v.toDouble } |
| 16 | + ) |
| 17 | + |
| 18 | + buildInfoKeys += name // test `+=` works with a setting key |
| 19 | + buildInfoKeys += fullClasspath // test `+=` works with a task key |
| 20 | + buildInfoKeys += "year" -> 2012 // test `+=` works with constants |
| 21 | + buildInfoKeys += BuildInfoKey.action("buildTime") { 1234L } // test `+=` works with BuildInfoKey's |
| 22 | + buildInfoKeys += BuildInfoKey.map(version) { case (_, v) => "projectVersion" -> v.toDouble } |
| 23 | + |
| 24 | + buildInfoKeys ++= Seq(name, version) // test `++=` works with setting keys |
| 25 | + buildInfoKeys ++= Seq(fullClasspath) // test `++=` works with 1 task key |
| 26 | + buildInfoKeys ++= Seq[BuildInfoKey](products, fullClasspath) // test `++=` works with n task keys |
| 27 | + buildInfoKeys ++= Seq[BuildInfoKey](name, fullClasspath) // test `++=` works with setting and task keys |
| 28 | + buildInfoKeys ++= Seq[BuildInfoKey]( // test `++=` works with misc things |
| 29 | + name, |
| 30 | + fullClasspath, |
| 31 | + "year" -> 2012, |
| 32 | + BuildInfoKey.action("buildTime") { 1234L }, |
| 33 | + BuildInfoKey.map(version) { case (_, v) => "projectVersion" -> v.toDouble } |
| 34 | + ) |
| 35 | + |
| 36 | + |
| 37 | + buildInfoKeys := BuildInfoKey.ofN(name, version) // test `:=` works with setting keys |
| 38 | + buildInfoKeys := BuildInfoKey.ofN(products, fullClasspath) // test `:=` works with task keys |
| 39 | + buildInfoKeys := BuildInfoKey.ofN(name, fullClasspath) // test `:=` works with setting and task keys |
| 40 | + buildInfoKeys := BuildInfoKey.ofN( // test `:=` works with misc things |
| 41 | + name, |
| 42 | + fullClasspath, |
| 43 | + "year" -> 2012, |
| 44 | + BuildInfoKey.action("buildTime") { 1234L }, |
| 45 | + BuildInfoKey.map(version) { case (_, v) => "projectVersion" -> v.toDouble } |
| 46 | + ) |
| 47 | + |
| 48 | + buildInfoKeys += BuildInfoKey.of(name) // test `+=` works with a setting key |
| 49 | + buildInfoKeys += BuildInfoKey.of(fullClasspath) // test `+=` works with a task key |
| 50 | + |
| 51 | + buildInfoKeys ++= BuildInfoKey.ofN(name, version) // test `++=` works with setting keys |
| 52 | + buildInfoKeys ++= BuildInfoKey.ofN(fullClasspath) // test `++=` works with 1 task key |
| 53 | + buildInfoKeys ++= BuildInfoKey.ofN(products, fullClasspath) // test `++=` works with n task keys |
| 54 | + buildInfoKeys ++= BuildInfoKey.ofN(name, fullClasspath) // test `++=` works with setting and task keys |
| 55 | + buildInfoKeys ++= BuildInfoKey.ofN( // test `++=` works with misc things |
| 56 | + name, |
| 57 | + fullClasspath, |
| 58 | + "year" -> 2012, |
| 59 | + BuildInfoKey.action("buildTime") { 1234L }, |
| 60 | + BuildInfoKey.map(version) { case (_, v) => "projectVersion" -> v.toDouble } |
| 61 | + ) |
| 62 | +} |
0 commit comments