I've made some progress, yet I still haven't found out the correct way
to configure my task after the build script is done configuring it. For
example, I want my OneJar task to depend on the task provided as an
input to my task. I can place a dependsOn inside the setter for my
input, but that doesn't cover the scenario in which my default setting
of project.tasks.jar is used.

Any help appreciated.

Cheers,
Merlyn

On Sat, 2011-02-19 at 10:24 -0800, Merlyn Albery-Speyer wrote:
> Hey all,
> 
> How should I best evolve a configuration of a task into a new task
type?
> The main problem I'm having is keeping my configuration code the same,
> and still being able to have a configure phase that comes after the
task
> inputs have been set. I tried putting the configuration inside a
doFirst
> in the constructor. Any hints?
> 
> Cheers,
> Merlyn
> 
> PS The project is on github at:
> https://github.com/curious-attempt-bunny/gradle-onejar
> 
> apply plugin: 'java'
> class OneJar extends Jar {
>         String mainClass
>         def runtime
>         def jar
>         
>         OneJar() {
>                 def oneJarClasses =
> project.sourceSets.thirdparty.classes
>                 jar = project.tasks.jar
>                 runtime = project.configurations.runtime
>                 
>                 def jar = project.tasks.jar
>                         
>                 configure {
>                         appendix = 'onejar'
>                         manifest {
>                         attributes  'Created-By':'Gradle OneJar task',
> 
> 'Main-Class':'com.simontuffs.onejar.Boot',
> 
> 'One-Jar-Main-Class': mainClass
>                         }
>                 
>                         from oneJarClasses
>                 
>                         into('lib') {
>                                 from runtime    
>                         }
>                 
>                         into('main') {
>                                 from jar.archivePath
>                                 rename { 'main.jar' }
>                         }
>                 }
>         }
> }
> 



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

    http://xircles.codehaus.org/manage_email


Reply via email to