ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Garrett Smith" <dhtmlkitc...@gmail.com>
Subject filterchain - apply to a subset of a filelist?
Date Sun, 02 Mar 2008 09:07:25 GMT
I already solved the problem, I'd like a code review, please.

Goal:
build a set of files into one, removing a token from all but the first.

Problem:
Each file has namespace('APE.anim') or  namespace(APE.anim")
(double or single quotes)

I need only one APE.namespace in the built file.

Solution:
create a temp file,
add to the temp file all except the first file, deleting the offending
token from each file,
concat the first file with the temp file (as a result file),
delete the temp file.

This works, but it isn't very straightforward:

<!-- concat all dom-f.js files, EXCEPT the first (style-f.js).
 Remove the APE.namespace(APE.dom) from each file (except the first)
-->
<concat destfile="${src}/dom/_dom.js">
	<filelist dir="${src}/dom"
		 files="viewport-f.js, position-f.js, classname-f.js,
traversal-f.js, Event.js"/>
	<filterchain>
		<tokenfilter>
			<replacestring from='APE.namespace("APE.dom");' to=""/>
			<replacestring from="APE.namespace('APE.dom');" to=""/>
		</tokenfilter>
	</filterchain>
</concat>

<!-- Add back in style-f.js -->
<concat destfile="${src}/dom/dom.js">
	<filelist dir="${src}/dom" files="style-f.js, _dom.js"/>
</concat>
<delete file="${src}/dom/_dom.js"/>

If there's a cleaner or more straightforward way to go about doing it,
I'd like to hear any advice.

Thanks,

Garrett

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message