tags:

views:

267

answers:

1

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>

The task then references the patternset here:

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

And further down, it references the fileset here:

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

Is there a way to consolidate the two lists of files into one type that can be referenced in both places? So far I haven't been able to figure out a way, since the patternset contains excludes. I was hoping for a way to simply create a list of files and include or exclude the referenced list.

+1  A: 

A property can by used by both if you use the filelist files and patternset excludes attributes.

<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}"/>
dave