Quantcast

Passing a FileSet/DirSet directly to the AntBuilder

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Passing a FileSet/DirSet directly to the AntBuilder

John W. Lewis


I have an AntBuilder question:

Given a set:

        def set = ant.fileset(dir:'mydir', id:'myfileset')

This works:

        ant.'mytask'(attr:'attr') {
                fileset(refid:'myfileset')
        }

But, I can't get this to work:

        ant.'mytask'(attr:'attr') {
                set
        }

Is there a way?   I'm wanting to do this:

        myclosure = { set ->
                ant.'mytask'(attr:'attr') {
                        set
                }
        }

        myclosure(ant.fileset(dir:'mydir'))


Thanks for any help,

John



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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Passing a FileSet/DirSet directly to the AntBuilder

pledbrook
> This works:
>
>        ant.'mytask'(attr:'attr') {
>                fileset(refid:'myfileset')
>        }
>
> But, I can't get this to work:
>
>        ant.'mytask'(attr:'attr') {
>                set
>        }

In the Grails scripts we set up closures for the filesets:

  def filesets = {
      fileset(dir: "mydir")
  }

  myclosure = { set ->
      ant.'mytask'(attr:'attr', set)
  }

  myclosure(filesets)

I don't think there's any other way. AntBuilder is useful for some
things, but Ant itself is not designed for this kind of work so
externally driving it can be tricky at best. It doesn't have a proper
public API for doing things like passing in filesets and other such
stuff. Happy to be proved wrong though :)

Cheers,

Peter

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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: Passing a FileSet/DirSet directly to the AntBuilder

John W. Lewis

That works.   Thanks.  I ended up doing this (thanks to Jurgen Hermann on the groovy mailing list):

         myclosure = { set ->
                 ant.'mytask'(attr:'attr', set)
         }
 
         myclosure { ant.fileset(dir:'mydir') }

That is pretty much what you suggested.

Thanks again!

John

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Peter Ledbrook
Sent: Thursday, November 20, 2008 1:54 AM
To: [hidden email]
Subject: Re: [gant-user] Passing a FileSet/DirSet directly to the AntBuilder

> This works:
>
>        ant.'mytask'(attr:'attr') {
>                fileset(refid:'myfileset')
>        }
>
> But, I can't get this to work:
>
>        ant.'mytask'(attr:'attr') {
>                set
>        }

In the Grails scripts we set up closures for the filesets:

  def filesets = {
      fileset(dir: "mydir")
  }

  myclosure = { set ->
      ant.'mytask'(attr:'attr', set)
  }

  myclosure(filesets)

I don't think there's any other way. AntBuilder is useful for some
things, but Ant itself is not designed for this kind of work so
externally driving it can be tricky at best. It doesn't have a proper
public API for doing things like passing in filesets and other such
stuff. Happy to be proved wrong though :)

Cheers,

Peter

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

    http://xircles.codehaus.org/manage_email




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

    http://xircles.codehaus.org/manage_email


Loading...