Created
March 12, 2012 22:04
-
-
Save fedesilva/2025004 to your computer and use it in GitHub Desktop.
sbt 0.11.2 task dependencies [PARTIALLY SOLVED]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sbt._ | |
import Keys._ | |
/** | |
* How in the world do I make bye depend on hello? | |
* And how do I depend on a task like test? | |
* I have not been able to make this work | |
goodbyeTask <<= goodbyeTask.dependsOn(helloTask) as in https://github.com/harrah/xsbt/wiki/Tasks | |
no matter where I stick it! | |
Halp! | |
*/ | |
object Build extends Build { | |
lazy val project = Project ( | |
"virtualusers", | |
file (".") | |
) | |
override lazy val settings = super.settings ++ Seq( | |
helloTask, | |
goodbyeTask | |
) | |
val hello = TaskKey[Unit]("hello", "Prints 'Hello World'") | |
val helloTask = hello := { println( "Hello World") } | |
val goodbye = TaskKey[Unit]("bye", "Prints 'Good Bye, cruel world'") | |
val goodbyeTask = goodbye := { println("Good Bye, cruel world") } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sbt._ | |
import Keys._ | |
/** | |
* So I tried this https://groups.google.com/forum/?fromgroups#!topic/simple-build-tool/v7y64K15PRU | |
* and I get what you see in the next file | |
*/ | |
object Build extends Build { | |
lazy val project = Project ( | |
"virtualusers", | |
file (".") | |
) | |
override lazy val settings = super.settings ++ Seq( | |
helloTask, | |
goodbyeTask <<= goodbyeTask dependsOn (helloTask) | |
) | |
val hello = TaskKey[Unit]("hello", "Prints 'Hello World'") | |
val helloTask = hello := { println( "Hello World") } | |
val goodbye = TaskKey[Unit]("bye", "Prints 'Good Bye, cruel world'") | |
val goodbyeTask = goodbye := { println("Good Bye, cruel world") } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sbt._ | |
import Keys._ | |
/** | |
* I have made progress ... now I need to hook into the "standard" tasks like compile. | |
*/ | |
object Build extends Build { | |
lazy val project = Project ( | |
"sbt-task-dependencies", | |
file (".") | |
) | |
override lazy val settings = super.settings ++ Seq( | |
helloTask, | |
goodbyeTask | |
) | |
val hello = TaskKey[Unit]("hello", "Prints 'Hello World'") | |
val helloTask = hello := { println( "Hello World") } | |
val goodbye = TaskKey[Unit]("bye", "Prints 'Good Bye, cruel world'") | |
val goodbyeTask = goodbye <<= (hello) map { h => println("goodbye") } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I admit I am clueless. I've also looked at the wiki (obviously as my example is clearly ripped of there) but I can not find a full blown build.scala example. | |
What I want to achieve is just move some files around and then compress them with the `assembly`ed jar for distribution (bundle). That part is fine, I have a task that does that but I can't say: | |
when I type bundle I want to the tests to be run and then an assembly created. | |
Halp! :'( | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[info] Compiling 1 Scala source to /Users/fede/Workshop/code/exploratory/sbt/taskDependencies/project/target/scala-2.9.1/sbt-0.11.2/classes... | |
[error] /Users/fede/Workshop/code/exploratory/sbt/taskDependencies/project/Build.scala:18: reassignment to val | |
[error] goodbyeTask <<= goodbyeTask dependsOn (helloTask) | |
[error] ^ | |
[error] one error found |
retronym
commented
Mar 13, 2012
@retronym, thanks.
It was metastasis (cut'n'paste) error both in the version of the code and it's output; It was late and I just did not recheck.
The gist is updated and the output is the correct too.
for some reason, the gist files are not in the order I create them. Anyway, this is mostly history now :D
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment