This seems like something that should be obvious, but I don't think it is. Given:
- a space-delimited list of files (or comma-delimited, etc.)
- a
<patternset>
of whitelisted patterns
How do I come up with a <fileset>
that contains all of the files in the list that match the whitelisted pattern?
Getting a list of files from the list is easy enough:
<patternset id="the-patternset" includes="${list.of.files}" /> <fileset id="the-fileset" dir="${basedir}"> <patternset refid="the-patternset" /> </fileset> <pathconvert pathsep="${line.separator}" property="the-filelist" refid="the-fileset"/> <echo>fileset: ${the-filelist}</echo>
…will happily produce a fileset with all of the files in ${list.of.files}
. But adding a filter of sorts:
<patternset id="the-filter"> <include name="includeme/**/*.java" /> <exclude name="excludeme/**/*.java" /> </patternset> <patternset id="the-patternset" includes="${list.of.files}" /> <fileset id="the-fileset" dir="${basedir}"> <patternset refid="the-patternset" /> <patternset refid="the-filter" /> </fileset> <pathconvert pathsep="${line.separator}" property="the-filelist" refid="the-fileset"/> <echo>fileset: ${the-filelist}</echo>
…will list a union of the patternsets—i.e., all files that match either the-filter
or the-patternset
.
How do I produce a fileset containing files that are in ${list.of.files}
and match the-patternset
?