How do I make a fileset from a comma-separated list of directories in Ant? -


I get an asset in an ant target, in which the list of directories to be included in the next action (copying, sorting e.t.c) .). It looks like this:

  directory = dir1, dir2, dir3  

I want a way to convert this list into a fileset or patternset < Strong

I know that I can use a script to create pattern string and then use it in "include" or "outside", but one way is to avoid scripts. ?

How to change comma-separated list to wildcard How to use antcontrib function Fileset?

  & lt; Property name = "directory" value = "dir1, dir2, dir3" /> & Lt; Property name = "wildcard" value = "$ {file.separator} ** $ {file.separator} *" /> & Lt; Propertyregex property = "my_pattern" input = "$ {directory}" regexp = "," replaced = "$ {wildcard}", & gt;  

At this point we are now:

  my_pattern = dir1 / ** / *, dir2 / ** / *, dir3  < / Pre> 

It can be used with older wildcards to get full fileset:

  & lt; Fileset dir = "." ID = "my_fileset" includes = "$ {my_pattern} $ {wildcard}" />  

(Fideli $ {wildcard} ) To ensure portability between Unix and Windows file systems, you can use the / ** / * You can use if you are pure UNIX.)


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -