Is it possible to include / exclude the list of files using refid in ant?

We currently have an ant task that contains something similar to the following:

<filelist dir="${css.dir}" id="ordered_css"> <file name="interface/foo.css" /> <file name="pages/monkey.css" /> <file name="pages/ninja.css" /> <file name="pages/sidebar.css" /> <file name="pages/bar.css" /> <file name="pages/baz.css" /> <file name="pages/robot.css" /> </filelist> <patternset id="exclude_css"> <exclude name="interface/foo.css" /> <exclude name="pages/monkey.css" /> <exclude name="pages/ninja.css" /> <exclude name="pages/sidebar.css" /> <exclude name="pages/bar.css" /> <exclude name="pages/baz.css" /> <exclude name="pages/robot.css" /> </patternset> 

Then the task refers to the template:

  <fileset dir="${css.dir}" id="stuff_css" includes="*/stuff/*.css"> <patternset refid="exclude_css" /> </fileset> 

And further down, it refers to a set of files here:

 <concat destfile="build/all.css" append="false" force="yes"> <filelist refid="ordered_css" /> <fileset refid="stuff_css" /> </concat> 

Is there a way to combine two file lists into one type that can be referenced in both places? So far, I have not been able to find a way, because the template contains excludes. I was hoping you would just create a list of files and include or exclude the list of links.

+6
java ant
source share
1 answer

A property can be used if you use filelist files and patternset excludes .

 <property name="css_files" value="interface/foo.css pages/monkey.css pages/ninja.css pages/sidebar.css pages/bar.css pages/baz.css pages/robot.css"/> <filelist id="ordered_css" dir="${css.dir}" files="${css_files}"/> <patternset id="exclude_css" excludes="${css_files}"/> 
+5
source share

All Articles