I've got a build.scala in ~/project with:val sampleTask = TaskKey[Unit]("sample")
and in build.sbtsampleTask := {println("SAMPLE")}
compile <<= compile.dependsOn(sampleTask)and I get the following error when sbt tries to compile the build.sbt file:sbt.Init$Uninitialized: Reference to uninitialized setting {file:/Users/keith/Desktop/my-project/}my-project/*:compile from {file:/Users/keith/Desktop/my-project/}my-project/*:compile
I can (as per the docs) make my own custom tasks depend on each other just fine.Am I missing something?Keith
--
You received this message because you are subscribed to the Google Groups "simple-build-tool" group.
To view this discussion on the web visit https://groups.google.com/d/msg/simple-build-tool/-/QnNHdW1fVzc2UklK.
To post to this group, send email to simple-b...@googlegroups.com.
To unsubscribe from this group, send email to simple-build-t...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/simple-build-tool?hl=en.
On 6/4/11, Keith Irwin <keith...@gmail.com> wrote:
> I've got a build.scala in ~/project with:
>
> val sampleTask = TaskKey[Unit]("sample")
>
> and in build.sbt
>
> sampleTask := {
> println("SAMPLE")
> }
>
> compile <<= compile.dependsOn(sampleTask)
>
> and I get the following error when sbt tries to compile the build.sbt file:
>
> sbt.Init$Uninitialized: Reference to uninitialized setting
> {file:/Users/keith/Desktop/my-project/}my-project/*:compile from
> {file:/Users/keith/Desktop/my-project/}my-project/*:compile
The immediate cause of this error is that there is no *:compile test,
only test:compile and compile:compile. It is similar to saying
override def globalCompile =
super.globalCompile.dependsOn(sampleTask)
but where globalCompile isn't defined yet. You want something like:
compile in Compile <<=
(compile in Compile).dependsOn(sampleTask)
However, 'dependsOn' should be rarely used because there are better
ways to hook in. For example, there is are new source generation
hooks. In general, tasks produce a value that gives the useful
information that should be propagated to dependent tasks. This means
you usually want to 'map' a task.
It looks like you gave some more details on what you are doing in your
follow-up email, so I will try to give some more specific help when I
get the time and I'll document the source generation hooks. This is
important enough that you can open a bug to ensure it gets documented
and doesn't get lost.
Thanks,
Mark
> I can (as per the docs) make my own custom tasks depend on each other just
> fine.
>
> Am I missing something?
>
> Keith
>
> ps. I was able to use clean: clean <<= clean.dependsOn(coffeeClean) and so
If you prefer, you can add files to clean to the `cleanFiles` setting. You can explore settings using 'inspect' and looking at the dependencies section.
https://github.com/harrah/xsbt/wiki/Inspecting-Settings
-Mark
-Mark
[1] https://github.com/harrah/xsbt/wiki/Common-Tasks