You can set up the base CopySpec individually and then apply it in each task 
with the specializations you want for each:

You can see an examle of that in the section entitled "release bundles" in the 
following script: 
http://anonsvn.jboss.org/repos/hibernate/core/branches/gradle2/hibernate-
release/hibernate-release.gradle

The "releaseCopySpec" holds the base copy spec definition, and you can see how 
I use and tweak it in the actual tasks like "buildReleaseZip" and 
"buildReleaseTgz"


On Tuesday, November 09, 2010, at 05:18 am, chris wrote:
> Hi,
> 
> Anybody know if its possible to copy a task's config to be used in another
> task?
> For example, I have a project with 2 war tasks, and I don't want to repeat
> myself with the same block of config for each. I configured the first one
> (as the default war task) as something like:
> 
> 
> war
> {
>     baseName = "first-$baseName"
>     into ('WEB-INF/classes') {
>         from rootProject.file('build-gradle')
>     }
>     into ('WEB-INF/classes') {
>         from fileTree(sourceSets.main.classesDir)
>         include('com/foo/web/**/*')
>     }
>     webInf {
>         from fileTree("$webAppDir/WEB-INF-1")
>     }
> }
> war.dependsOn(rootProject.propertiesMerge)
> 
> 
> Then I want another war task with pretty much the same setup but with a
> different webInf & baseName:
> 
> 
> task warSecond(type: War, dependsOn: rootProject.propertiesMerge) {
>     baseName = "second-$baseName"
>     webInf {
>         from fileTree("$webAppDir/WEB-INF-2")
>     }
> 
>     // do I have to reproduce the config for the default war task...?
> }
> warSecond.dependsOn(rootProject.propertiesMerge)
> 
> 
> Any way I can get some re-use here?
> 
> Thanks!
> Chris.

---
Steve Ebersole <[email protected]>
http://hibernate.org

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

    http://xircles.codehaus.org/manage_email


Reply via email to