I'm just now getting back to you on this Xavier.  Had some problems with my
e-mail client, unfortunatly.

I think your approach here is perfect.  It's very much in line with approach
that I was thinking of, but it is even a bit better.

I've added the comments to the JIRA isse and voted on it.

Any chance of seeing this in the 2.0 release?

Scott

-----Original Message-----
From: Xavier Hanin [mailto:[EMAIL PROTECTED]
Sent: Monday, July 02, 2007 11:44 PM
To: [email protected]
Subject: Re: IVY Retrieve and Type Filter Use Case


On 7/2/07, Scott Goldstein <[EMAIL PROTECTED]> wrote:
>
> In my common build file, for organization purposes, I retrieve files by
> type and place them in particular directories.  For example:
>
>   .../lib         Contains win32 dlls
>   .../jlib        Containes jar files
>   .../obl        Contains Installscript libraries
>
>   This works, but I don't want to list out all of them.  In other words, I
> want to choose a few well known types for their own directories and the
rest
> I want to place in a directory called "misc".
>
>   One way to do this, is to have a type filter with negation
> capabilities.  So, for the type attribute, you could specify, "!jar, !dll,
> !obl".  I've done this will a small change in FitlerHelper:
>
>   public static Filter getArtifactTypeFilter(String types) {
>         if (types == null || types.trim().equals("*")) {
>             return NO_FILTER;
>         }
>         String[] t = types.split(",");
>         List acceptedTypes = new ArrayList(types.length());
>         List negatedTypes = new ArrayList(types.length());
>         for (int i = 0; i < t.length; i++) {
>                String type = t[i].trim();
>                if (type.startsWith("!")) {
>                negatedTypes.add(type.substring(1));
>         } else {
>             acceptedTypes.add(type);
>        }
>   }
>   Filter acceptedTypesFilter = new ArtifactTypeFilter(acceptedTypes);
>   Filter negatedTypesFilter = new NotFilter(new
> ArtifactTypeFilter(negatedTypes));
>   return new OrFilter(acceptedTypesFilter, negatedTypesFilter);
>   }
>
>   This works for my situation, but I don't know if it's the best long term
> approach.  I would imagine a mechanism of providing filters in the same
way
> that the ant fileset tag works.  In other words, providing include and
> exclude tags.  This would be extremely flexible, allowing the developer to
> perform any type of filtering desired.
>
>   I haven't thought through all of the implications, but I thought I would
> post the idea for discussion.


Thanks for sharing this, the idea is indeed interesting. About having more
flexible filters, there is already an open issue for that:
https://issues.apache.org/jira/browse/IVY-439

I suggest to vote for it, and add a comment about your opinion on the
subject.

Your include/exclude suggestion is interesting, it could be pretty easy to
have something like:

<resolve ...>

<include attribute="type" value="jar,zip" />

<exclude attribute="module" value="foo*" matcher="glob"/>

</resolve>
This would be very flexible, and should match your use case. What do you
think?

Xavier

  Thanks.
>
>   Scott
>



--
Xavier Hanin - Independent Java Consultant
Creator of Ivy, xooki and xoocode.org
More about me: http://xhab.blogspot.com/

Reply via email to