ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yyy Xxx <>
Subject RE: applying mappers to fileset
Date Tue, 24 Sep 2002 20:25:05 GMT
I second this wish.  I'd like to see fileset have a mapper element
which mapped includes, excludes and/or refid'd filesets.

Consider a build that puts files *and their MD5 checksums* into a ZIP. 
It creates and populates a fileset which is passed to the checksum
task.  The same fileset is then passed to the zip task.  What about the
*.MD5 files?   The zip task should receive two filesets: the source
fileset; and the source fileset globbed from "*" to "*.MD5".

My solution is to populate the second set in a Jython script:

---- ----
def getRef(prop):
	return project.getReferences().get(prop)

inputfileset  = getRef(map_inputfileset)
outputfileset = getRef(map_outputfileset)
mapper        = getRef(map_mapper).getImplementation()

scanner = inputfileset.getDirectoryScanner(project)


for name in scanner.getIncludedFiles():
  mappedNames = mapper.mapFileName(name)
  if mappedNames is not None:
  	for n in mappedNames: outputfileset.createInclude().setName(n)


And to have this in my build:

  <fileset id="images.fileset" dir="${images.dir}">
     ... includes / excludes ...

  <mapper type="glob" from="*" to="*.MD5" id="md5-glob"/>
  <fileset id="checksum.fileset" dir="${images.dir}"/>

  <property name="map_inputfileset" value="images.fileset"/>
  <property name="map_outputfileset" value="checksum.fileset"/>
  <property name="map_mapper" value="md5-glob"/>
  <script language="jpython"
  <zip destfile="${image-zip.location}" compress="no">
     <fileset refid="images.fileset"/>
     <fileset refid="checksum.fileset"/>

-----Original Message-----
I guess I'd like to create a new fileset from an old one.  I'd like to
foreach on the new fileset (or the 'right' side of the map, no longer
care about
the left).  I don't think the perforce tasks support wildcards, so I
thought I
could iterate through a fileset, but I need to flatten the filenames. 


-----Original Message-----
From: Erik Hatcher []
Sent: Tuesday, September 24, 2002 3:45 PM
To: Ant Users List
Subject: Re: applying mappers to fileset

No.  That doesn't really make sense in a general sense, at least to me.

  A fileset is a set of existing files, so mapping them doesn't
that meaning.

Mappers are associated directly with several tasks, such as <copy>.

What do you have in mind specifically?


Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message