Skip to content

Instantly share code, notes, and snippets.

@softprops
Created July 21, 2011 02:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save softprops/1096374 to your computer and use it in GitHub Desktop.
Save softprops/1096374 to your computer and use it in GitHub Desktop.
identity fn reference of inputKey seems not to reference the expected parser combinator
sbtPlugin := true
name := "input-task-test"
organization := "meh"
version <<= sbtVersion(v => "0.1.0-%s-SNAPSHOT".format(v))
package meh
import sbt._
import Keys._
// depend on this in another project
// libraryDependencies <+= scalaVersion(v => "meh" %% "input-task-test" % "0.1.0-SNAPSHOT")
// try in:input-key foo bar
// then try input-key foo bar
object InputTaskTest extends Plugin {
val InputConfig = config("in") extend(Runtime)
val inputKey = InputKey[Unit]("input-key")
def inputSettings: Seq[Setting[_]] = inConfig(InputConfig)(Seq(
// binding implementation behavior in `Input` config (the "in" namespace)
inputKey <<= inputTask { argtask: TaskKey[Seq[String]] =>
(argtask, streams) map { (args, out) => out.log.info("got %s" format args.mkString) }
}
)) ++ Seq(
// injecting input task key into global scope
// as an alias to the input task in config
inputKey <<= (inputKey in InputConfig).identity
)
}
// include plugin settings
seq(InputTaskTask.inputSettings: _*)
// resolve plugin
libraryDependencies <+= sbtVersion(v => "meh" %% "test-input-task" % "0.1.0-%s-SNAPSHOT".format(v))
> in:input-key foo barz
[info] got foobarz
[success] Total time: 0 s, completed Jul 20, 2011 10:06:44 PM
> input-key foo barz
[error] Parsed result dummy task not found in {file:/Users/dtangren/Desktop/intasktestexample/}default/*:input-key
[error] Use 'last' for the full log.
> last
[info] Set current project to default (in build file:/Users/dtangren/Desktop/intasktestexample/)
[success] Total time: 0 s, completed Jul 20, 2011 10:05:49 PM
[success] Total time: 0 s, completed Jul 20, 2011 10:05:52 PM
java.lang.RuntimeException: Parsed result dummy task not found in {file:/Users/dtangren/Desktop/intasktestexample/}default/*:input-key
at scala.Predef$.error(Predef.scala:58)
at sbt.Aggregation$$anonfun$dummyParsedTask$1.apply(Aggregation.scala:153)
at sbt.Aggregation$$anonfun$dummyParsedTask$1.apply(Aggregation.scala:153)
at scala.Option.getOrElse(Option.scala:104)
at sbt.Aggregation$.dummyParsedTask(Aggregation.scala:153)
at sbt.Aggregation$.sbt$Aggregation$$dummyMap(Aggregation.scala:137)
at sbt.Aggregation$$anonfun$applyDynamicTasks$1.apply(Aggregation.scala:145)
at sbt.Aggregation$$anonfun$applyDynamicTasks$1.apply(Aggregation.scala:143)
at sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.scala:63)
at sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.scala:63)
at sbt.Command$.process(Command.scala:91)
at sbt.MainLoop$$anonfun$next$1$$anonfun$apply$1.apply(Main.scala:72)
at sbt.MainLoop$$anonfun$next$1$$anonfun$apply$1.apply(Main.scala:72)
at sbt.State$$anon$1.process(State.scala:54)
at sbt.MainLoop$$anonfun$next$1.apply(Main.scala:72)
at sbt.MainLoop$$anonfun$next$1.apply(Main.scala:72)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:13)
at sbt.MainLoop$.next(Main.scala:72)
at sbt.MainLoop$.run(Main.scala:63)
at sbt.xMain.run(Main.scala:33)
at xsbt.boot.Launch$.run(Launch.scala:54)
at xsbt.boot.Launch$$anonfun$explicit$1.apply(Launch.scala:43)
at xsbt.boot.Launch$.launch(Launch.scala:68)
at xsbt.boot.Launch$.apply(Launch.scala:14)
at xsbt.boot.Boot$.runImpl(Boot.scala:24)
at xsbt.boot.Boot$.main(Boot.scala:15)
at xsbt.boot.Boot.main(Boot.scala)
> inspect input-key
[info] Input task
[info] Description:
[info]
[info] Provided by:
[info] {file:/Users/dtangren/Desktop/intasktestexample/}default/*:input-key
[info] Dependencies:
[info] {file:/Users/dtangren/Desktop/intasktestexample/}default/in:input-key
[info] Delegates:
[info] {file:/Users/dtangren/Desktop/intasktestexample/}default/*:input-key
[info] {file:/Users/dtangren/Desktop/intasktestexample/}/*:input-key
[info] */*:input-key
[info] Related:
[info] {file:/Users/dtangren/Desktop/intasktestexample/}default/in:input-key
> inspect in:input-key
[info] Input task
[info] Description:
[info]
[info] Provided by:
[info] {file:/Users/dtangren/Desktop/intasktestexample/}default/in:input-key
[info] Dependencies:
[info] {file:/Users/dtangren/Desktop/intasktestexample/}default/in:$parse-result(for input-key)
[info] {file:/Users/dtangren/Desktop/intasktestexample/}default/in:streams(for input-key)
[info] Reverse dependencies:
[info] {file:/Users/dtangren/Desktop/intasktestexample/}default/*:input-key
[info] Delegates:
[info] {file:/Users/dtangren/Desktop/intasktestexample/}default/in:input-key
[info] {file:/Users/dtangren/Desktop/intasktestexample/}default/*:input-key
[info] {file:/Users/dtangren/Desktop/intasktestexample/}/in:input-key
[info] {file:/Users/dtangren/Desktop/intasktestexample/}/*:input-key
[info] */in:input-key
[info] */*:input-key
[info] Related:
[info] {file:/Users/dtangren/Desktop/intasktestexample/}default/*:input-key
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment