On 22/06/10 6:44 AM, Meikel Brandmeyer wrote:
Hi,

Am 21.06.2010 um 21:24 schrieb Jason Porter:

You want a compile task that depends on something else as well?

task myCompileTask(type: Compile, dependsOn: myOtherTask) { ... }

That should work on 0.8, but I would recommend 0.9
In case my tests are correct, this does not really work, because it creates a dependency 
cycle. compile depends on uploadInternal depends on compile. That is because the 
dependsOn thing acts on the same project. But compileJava depends on the uploadInternal 
in different subprojects. I haven't found a way to declare that in a custom task. 
compileJava does this "magically." So depending my compile task on compileJava 
works, but I don't want to hardwire the compilation order. If my task goes first, the 
required artifacts from the subprojects are missing.


The compileJava declares that it depends on the compile configuration, and Gradle takes care of wiring up the task dependencies.

For a custom task in your build script, you can do something like:

task mytask {
    dependsOn configurations.compile
    doFirst { .. do something with configurations.compile .. }
}

If you're implementing a custom task type, you can also use the @InputFiles annotation (this is what the Compile/GroovyCompile/ScalaCompile tasks do):

class MyTask extends DefaultTask {
    @InputFiles
    Iterable<File> getClassPath() {
    }

    ...
}

This is the suggested way to use dependency configurations.

Did this change in 0.9?

No. The above should work in both 0.8 and 0.9

  I'm currently trying to port clojuresque to 0.9. And things have changed 
(again :( ) quite significantly.

Some things have changed, but not how you use a configuration. If you need to depend on uploadInternal, you're possibly hooking in at too low a level. The uploadInternal task is, well, an internal part of the implementation, and you shouldn't need to do anything with it directly. And in 0.9, this task no longer exists.

  Is there some overview for plugin writers what to consider when writing a 
plugin and how to hook into the system in the Right Way(tm)?

Unfortunately, not really. There is a chapter in the user guide for how to write tasks, and another for how to write plugins. But they still need a lot of work.

After the Gradle 0.9 release, we're hoping to do some work to make it easier to write and share plugins. Some better documentation would be part of this. Any suggestions are welcome.


--
Adam Murdoch
Gradle Developer
http://www.gradle.org
CTO, Gradle Inc. - Gradle Training, Support, Consulting
http://www.gradle.biz


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to