ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Reilly" <peter.kitt.rei...@gmail.com>
Subject Re: classloader for 1.7
Date Fri, 13 Oct 2006 22:52:39 GMT
On 10/13/06, Matt Benson <gudnabrsam@yahoo.com> wrote:
> As promised, I reworked Peter's task to use
> ResourceCollection stuff better, made a stupid error
> when writing my tests, and forgot to come back to it
> until now.  The thing works great.  Pasting inline...
> are we still thinking it's possible to put this in 1.7
> ?  Or this thing is self-contained enough that we
> could make it an antlib.  I hate the thought of
> fifteen single-task antlibs, but we could create an
> uber-antlib called... giant!  ;)  Thoughts?
>
> -Matt
>
....
Pretty cool!

the uber-antlib could be called ant-contrib!,
I think that this task could belong to ant-contrib,
along with some of Rainer's other classloader code.

The task looks nice. It think that the resource and reference
handling code could be extracted into helper classes, since
a lot of tasks could use these - in particular toURL and
resolveRefs

The signature of toURL(Object o) should be toURL(Resource r)
to show fact that it is used in the context of looping over
resources.

Peter
   private URL toURL(Resource r) {
       if (r instanceof URLResource) {
           return ((URLResource) r).getURL();
       }

       if (r instanceof FileResource) {
           try {
               return
FILE_UTILS.getFileURL(((FileResource) r).getFile());
           } catch (MalformedURLException e) {
               throw new BuildException(
               "Cannot extract URL from " + r, t);
           }
       }
       throw new BuildException(
               "Cannot extract URL from " + r);
   }

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message