@@ -0,0 +1,636 @@
1+<?xml version="1.0"?>
2+<project name="Boilerplate Build" default="build" basedir="../"> <!-- one back since we're in build/ -->
3+
4+
5+ <!-- Load in Ant-Contrib to give us access to some very useful tasks! -->
6+ <!-- the .jar file is located in the tools directory -->
7+ <taskdef resource="net/sf/antcontrib/antcontrib.properties">
8+ <classpath>
9+ <pathelement location="${basedir}/build/tools/ant-contrib-1.0b3.jar"/>
10+ </classpath>
11+ </taskdef>
12+
13+
14+ <!-- load property files -->
15+ <property file="build/config/project.properties"/>
16+ <property file="build/config/default.properties"/>
17+
18+ <!-- merge the stylesheet properties -->
19+ <var name="stylesheet-files" value="${file.stylesheets}, ${file.default.stylesheets}"/>
20+
21+ <!-- merge the pages properties -->
22+ <var name="page-files" value="${file.pages}, ${file.pages.default.include}"/>
23+
24+
25+
26+ <!--
27+ *************************************************
28+ * BASE TARGETS *
29+ *************************************************
30+ -->
31+ <target name="basics">
32+ <if>
33+ <equals arg1="${env}" arg2="dev"/>
34+ <then>
35+ <!-- Build a dev environment -->
36+ <echo message="Building a Development Environment..."/>
37+ <antcall target="-rev"/>
38+ <antcall target="-clean"/>
39+ <antcall target="-copy"/>
40+ </then>
41+
42+ <elseif>
43+ <equals arg1="${env}" arg2="test"/>
44+ <then>
45+ <!-- Build a test environment -->
46+ <echo message="Building a Test Environment..."/>
47+ <antcall target="-rev"/>
48+ <antcall target="-clean"/>
49+ <antcall target="-copy"/>
50+ <antcall target="-usemin"/>
51+ <antcall target="-js.all.minify"/>
52+ <antcall target="-js.main.concat"/>
53+ <antcall target="-js.mylibs.concat"/>
54+ <antcall target="-js.scripts.concat"/>
55+ <antcall target="-js.delete"/>
56+ <antcall target="-css"/>
57+ <antcall target="-html"/>
58+ </then>
59+ </elseif>
60+
61+ <else>
62+ <!-- Build a production environment -->
63+ <echo message="Building a Production Environment..."/>
64+ <antcall target="-rev"/>
65+ <antcall target="-clean"/>
66+ <antcall target="-copy"/>
67+ <antcall target="-usemin"/>
68+ <antcall target="-js.all.minify"/>
69+ <antcall target="-js.main.concat"/>
70+ <antcall target="-js.mylibs.concat"/>
71+ <antcall target="-js.scripts.concat"/>
72+ <antcall target="-js.delete"/>
73+ <antcall target="-strip-console.log"/>
74+ <antcall target="-css"/>
75+ <antcall target="-html"/>
76+ </else>
77+ </if>
78+ </target>
79+
80+
81+ <target name="text">
82+ <if>
83+ <equals arg1="${env}" arg2="dev"/>
84+ <then>
85+ <!-- Build a dev environment -->
86+ <echo message="Building a Development Environment..."/>
87+ <antcall target="-rev"/>
88+ <antcall target="-clean"/>
89+ <antcall target="-copy"/>
90+ </then>
91+
92+ <elseif>
93+ <equals arg1="${env}" arg2="test"/>
94+ <then>
95+ <!-- Build a test environment -->
96+ <echo message="Building a Test Environment..."/>
97+ <antcall target="-rev"/>
98+ <antcall target="-clean"/>
99+ <antcall target="-copy"/>
100+ <antcall target="-usemin"/>
101+ <antcall target="-js.all.minify"/>
102+ <antcall target="-js.main.concat"/>
103+ <antcall target="-js.mylibs.concat"/>
104+ <antcall target="-js.scripts.concat"/>
105+ <antcall target="-js.delete"/>
106+ <antcall target="-css"/>
107+ <antcall target="-html"/>
108+ <antcall target="-htmlclean"/>
109+ </then>
110+ </elseif>
111+
112+ <else>
113+ <!-- Build a production environment -->
114+ <echo message="Building a Production Environment..."/>
115+ <antcall target="-rev"/>
116+ <antcall target="-clean"/>
117+ <antcall target="-copy"/>
118+ <antcall target="-usemin"/>
119+ <antcall target="-js.all.minify"/>
120+ <antcall target="-js.main.concat"/>
121+ <antcall target="-js.mylibs.concat"/>
122+ <antcall target="-js.scripts.concat"/>
123+ <antcall target="-js.delete"/>
124+ <antcall target="-strip-console.log"/>
125+ <antcall target="-css"/>
126+ <antcall target="-html"/>
127+ <antcall target="-htmlclean"/>
128+ </else>
129+ </if>
130+ </target>
131+
132+
133+ <target name="buildkit">
134+ <if>
135+ <equals arg1="${env}" arg2="dev"/>
136+ <then>
137+ <!-- Build a dev environment -->
138+ <echo message="Building a Development Environment..."/>
139+ <antcall target="-rev"/>
140+ <antcall target="-clean"/>
141+ <antcall target="-copy"/>
142+ <antcall target="-imagespng"/>
143+ <antcall target="-imagesjpg"/>
144+ </then>
145+
146+ <elseif>
147+ <equals arg1="${env}" arg2="test"/>
148+ <then>
149+ <!-- Build a test environment -->
150+ <echo message="Building a Test Environment..."/>
151+ <antcall target="-rev"/>
152+ <antcall target="-clean"/>
153+ <antcall target="-copy"/>
154+ <antcall target="-usemin"/>
155+ <antcall target="-js.all.minify"/>
156+ <antcall target="-js.main.concat"/>
157+ <antcall target="-js.mylibs.concat"/>
158+ <antcall target="-js.scripts.concat"/>x
159+ <antcall target="-js.delete"/>
160+ <antcall target="-css"/>
161+ <antcall target="-html"/>
162+ <antcall target="-htmlbuildkit"/>
163+ <antcall target="-imagespng"/>
164+ <antcall target="-imagesjpg"/>
165+ </then>
166+ </elseif>
167+
168+ <else>
169+ <!-- Build a production environment -->
170+ <echo message="Building a Production Environment..."/>
171+ <antcall target="-rev"/>
172+ <antcall target="-clean"/>
173+ <antcall target="-copy"/>
174+ <antcall target="-usemin"/>
175+ <antcall target="-js.all.minify"/>
176+ <antcall target="-js.main.concat"/>
177+ <antcall target="-js.mylibs.concat"/>
178+ <antcall target="-js.scripts.concat"/>x
179+ <antcall target="-js.delete"/>
180+ <antcall target="-strip-console.log"/>
181+ <antcall target="-css"/>
182+ <antcall target="-html"/>
183+ <antcall target="-htmlbuildkit"/>
184+ <antcall target="-imagespng"/>
185+ <antcall target="-imagesjpg"/>
186+ </else>
187+ </if>
188+ </target>
189+
190+
191+ <target name="build">
192+ <if>
193+ <equals arg1="${env}" arg2="dev"/>
194+ <then>
195+ <!-- Build a dev environment -->
196+ <echo message="Building a Development Environment..."/>
197+ <antcall target="-rev"/>
198+ <antcall target="-clean"/>
199+ <antcall target="-copy"/>
200+ <antcall target="-imagespng"/>
201+ <antcall target="-imagesjpg"/>
202+ </then>
203+
204+ <elseif>
205+ <equals arg1="${env}" arg2="test"/>
206+ <then>
207+ <!-- Build a test environment -->
208+ <echo message="Building a Test Environment..."/>
209+ <antcall target="-rev"/>
210+ <antcall target="-clean"/>
211+ <antcall target="-copy"/>
212+ <antcall target="-usemin"/>
213+ <antcall target="-js.all.minify"/>
214+ <antcall target="-js.main.concat"/>
215+ <antcall target="-js.mylibs.concat"/>
216+ <antcall target="-js.scripts.concat"/>
217+ <antcall target="-js.delete"/>
218+ <antcall target="-css"/>
219+ <antcall target="-html"/>
220+ <antcall target="-htmlclean"/>
221+ <antcall target="-imagespng"/>
222+ <antcall target="-imagesjpg"/>
223+ </then>
224+ </elseif>
225+
226+ <else>
227+ <!-- Build a production environment -->
228+ <echo message="Building a Production Environment..."/>
229+ <antcall target="-rev"/>
230+ <antcall target="-clean"/>
231+ <antcall target="-copy"/>
232+ <antcall target="-usemin"/>
233+ <antcall target="-js.all.minify"/>
234+ <antcall target="-js.main.concat"/>
235+ <antcall target="-js.mylibs.concat"/>
236+ <antcall target="-js.scripts.concat"/>
237+ <antcall target="-js.delete"/>
238+ <antcall target="-strip-console.log"/>
239+ <antcall target="-css"/>
240+ <antcall target="-html"/>
241+ <antcall target="-htmlclean"/>
242+ <antcall target="-imagespng"/>
243+ <antcall target="-imagesjpg"/>
244+ </else>
245+ </if>
246+ </target>
247+
248+
249+ <target name="minify">
250+ <if>
251+ <equals arg1="${env}" arg2="dev"/>
252+ <then>
253+ <!-- Build a dev environment -->
254+ <echo message="Building a Development Environment..."/>
255+ <antcall target="-rev"/>
256+ <antcall target="-clean"/>
257+ <antcall target="-copy"/>
258+ <antcall target="-imagespng"/>
259+ <antcall target="-imagesjpg"/>
260+ </then>
261+
262+ <elseif>
263+ <equals arg1="${env}" arg2="test"/>
264+ <then>
265+ <!-- Build a test environment -->
266+ <echo message="Building a Test Environment..."/>
267+ <antcall target="-rev"/>
268+ <antcall target="-clean"/>
269+ <antcall target="-copy"/>
270+ <antcall target="-usemin"/>
271+ <antcall target="-js.all.minify"/>
272+ <antcall target="-js.main.concat"/>
273+ <antcall target="-js.mylibs.concat"/>
274+ <antcall target="-js.scripts.concat"/>
275+ <antcall target="-js.delete"/>
276+ <antcall target="-css"/>
277+ <antcall target="-html"/>
278+ <antcall target="-htmlcompress"/>
279+ <antcall target="-imagespng"/>
280+ <antcall target="-imagesjpg"/>
281+ </then>
282+ </elseif>
283+
284+ <else>
285+ <!-- Build a production environment -->
286+ <echo message="Building a Production Environment..."/>
287+ <antcall target="-rev"/>
288+ <antcall target="-clean"/>
289+ <antcall target="-copy"/>
290+ <antcall target="-usemin"/>
291+ <antcall target="-js.all.minify"/>
292+ <antcall target="-js.main.concat"/>
293+ <antcall target="-js.mylibs.concat"/>
294+ <antcall target="-js.scripts.concat"/>
295+ <antcall target="-js.delete"/>
296+ <antcall target="-strip-console.log"/>
297+ <antcall target="-css"/>
298+ <antcall target="-html"/>
299+ <antcall target="-htmlcompress"/>
300+ <antcall target="-imagespng"/>
301+ <antcall target="-imagesjpg"/>
302+ </else>
303+ </if>
304+ </target>
305+
306+
307+ <!--
308+ *************************************************
309+ * FUNCTION TARGETS *
310+ *************************************************
311+ -->
312+ <target name="-load-build-info" description="(PRIVATE) Loads the build versioning information">
313+ <property file="./${dir.build}/config/${build.version.info}"/>
314+ </target>
315+
316+ <target name="-clean" description="(PRIVATE) Wipe the previous build (Deletes the dir.publish directory">
317+ <!-- This is a private target -->
318+
319+ <echo message="Cleaning up previous build directory..."/>
320+ <delete dir="./${dir.publish}/"/>
321+ </target>
322+
323+
324+ <target name="-rev" description="(PRIVATE) Increase the current build number by one and set build date">
325+ <!-- This is a private target -->
326+
327+ <echo message="Increasing the build number..."/>
328+ <propertyfile file="./${dir.build}/config/${build.version.info}" comment="Build Information File - DO NOT CHANGE">
329+ <entry key="build.number" type="int" default="0000" operation="+" pattern="0000"/>
330+ <entry key="build.date" type="date" value="now" pattern="dd.MM.yyyy HH:mm"/>
331+ </propertyfile>
332+ <property file="./${dir.build}/config/${build.version.info}"/>
333+ <echo>Creating build ${build.number}</echo>
334+ </target>
335+
336+
337+ <target name="current-number" depends="-load-build-info" description="(PUBLIC) Returns the current build number">
338+ <echo>Current build number: ${build.number}</echo>
339+ </target>
340+
341+
342+ <target name="-copy" depends="-load-build-info">
343+ <!-- This is a private target -->
344+
345+ <echo message="Copying over new files..."/>
346+ <!-- combine the 2 exclude properties -->
347+ <var name="excluded-files" value="${file.default.exclude}, ${file.exclude}"/>
348+
349+ <copy todir="./${dir.publish}">
350+ <fileset dir="./" excludes="${excluded-files}"/>
351+ </copy>
352+ </target>
353+
354+
355+ <!-- JAVASCRIPT -->
356+ <target name="-js.main.concat" depends="-load-build-info" description="(PRIVATE) Concatenates the JS files in dir.js">
357+ <echo message="Concatenating Main JS scripts..."/>
358+ <concat destfile="./${dir.publish}/${dir.js}/scripts-${build.number}.js">
359+ <fileset dir="./${dir.publish}/">
360+ <include name="**/${dir.js.main}/*.min.js"/>
361+ <exclude name="**/${dir.js.mylibs}/*.js"/>
362+ <exclude name="**/${dir.js.libs}/*.js"/>
363+ </fileset>
364+ </concat>
365+ </target>
366+
367+
368+ <target name="-js.mylibs.concat" depends="-load-build-info" description="(PRIVATE) Concatenates the JS files in dir.js.mylibs">
369+ <echo message="Concatenating JS libraries"/>
370+ <concat destfile="./${dir.publish}/${dir.js}/libs-${build.number}.js">
371+ <fileset dir="./${dir.publish}/${dir.js.mylibs}/">
372+ <include name="**/*.min.js"/>
373+ </fileset>
374+ </concat>
375+ </target>
376+
377+
378+ <target name="-js.scripts.concat" depends="-load-build-info" if="build.concat.scripts">
379+ <echo message="Concatenating library file with main script file"/>
380+ <concat destfile="./${dir.publish}/${dir.js}/scripts-${build.number}.min.js">
381+ <fileset dir="./${dir.publish}/${dir.js}/">
382+ <include name="libs-${build.number}.js"/>
383+ <include name="scripts-${build.number}.js"/>
384+ </fileset>
385+ </concat>
386+
387+ <echo message="Concatenating library file with main debug script file"/>
388+ <concat destfile="./${dir.publish}/${dir.js}/scripts-${build.number}-debug.min.js">
389+ <fileset dir="./${dir.publish}/${dir.js}/">
390+ <include name="libs-${build.number}.js"/>
391+ <include name="scripts-${build.number}-debug.js"/>
392+ </fileset>
393+ </concat>
394+ </target>
395+
396+
397+ <target name="-js.all.minify" depends="-js.libs.minify" description="(PRIVATE) Minifies the scripts.js files created by js.scripts.concat">
398+ <echo message="Minifying concatenated script- and library-file"/>
399+ <apply executable="java" parallel="false">
400+ <fileset dir="./${dir.publish}/${dir.js}">
401+ <include name="**/*.js"/>
402+ <exclude name="**/*.min.js"/>
403+ <exclude name="**/${dir.js.libs}/*.js"/>
404+ </fileset>
405+ <arg line="-jar"/>
406+ <arg path="./${dir.build.tools}/${tool.yuicompressor}"/>
407+ <srcfile/>
408+ <arg line="--line-break"/>
409+ <arg line="4000"/>
410+ <arg line="-o"/>
411+ <mapper type="glob" from="*.js" to="../${dir.publish}/${dir.js}/*.min.js"/>
412+ <targetfile/>
413+ </apply>
414+ </target>
415+
416+
417+ <target name="-js.libs.minify" depends="-load-build-info" description="(PRIVATE) Minifies the helper files in dir.js.libs">
418+ <echo message="Minifying helper JS files..."/>
419+
420+ <apply executable="java" parallel="false">
421+ <fileset dir="./${dir.publish}/${dir.js.libs}/" includes="*.js" excludes="*.min.js"/>
422+ <arg line="-jar"/>
423+ <arg path="./${dir.build.tools}/${tool.yuicompressor}"/>
424+ <srcfile/>
425+ <arg line="-o"/>
426+ <mapper type="glob" from="*.js" to="../${dir.publish}/${dir.js.libs}/*-${build.number}.min.js"/>
427+ <targetfile/>
428+ </apply>
429+ </target>
430+
431+
432+ <target name="-js.delete" depends="-load-build-info" description="(PRIVATE) Deletes the unoptimized js files from build if set">
433+ <if>
434+ <equals arg1="${build.delete.unoptimized}" arg2="true"/>
435+ <then>
436+ <echo message="Deleting unoptimized files..."/>
437+ <delete file="./${dir.publish}/${dir.js}/scripts-${build.number}.js"/>
438+ <delete file="./${dir.publish}/${dir.js}/scripts-${build.number}-debug.js"/>
439+ <!--
440+ <delete dir="./${dir.publish}/${dir.js.lib}/"/>
441+ <delete file="./${dir.publish}/${dir.js}/libs-${build.number}.js"/>
442+ this guy probably COULD be on but I think it's better if we keep him off for now. ^pi
443+ <delete includeemptydirs="true">
444+ <fileset dir="./${dir.publish}/${dir.js.libs}/" includes="*.js" excludes="*.min.js"/>
445+ </delete>
446+ -->
447+ </then>
448+ </if>
449+
450+ <if>
451+ <and>
452+ <equals arg1="${build.delete.unoptimized}" arg2="true"/>
453+ <equals arg1="${build.concat.scripts}" arg2="true"/>
454+ </and>
455+ <then>
456+ <delete file="./${dir.publish}/${dir.js}/libs-${build.number}.js"/>
457+ <delete file="./${dir.publish}/${dir.js}/scripts-${build.number}.js"/>
458+ </then>
459+ </if>
460+ </target>
461+
462+
463+ <target name="-strip-console.log" description="(PRIVATE)Comments out any console.log statements">
464+ <echo message="Commenting out console.log lines"/>
465+
466+
467+ <replaceregexp match="(console.log\(.*\))" replace="/\*\1\*/" flags="g" >
468+ <fileset dir="./${dir.publish}/${dir.js}/">
469+ <include name="**/*.js"/>
470+ <exclude name="**/*.min.js"/>
471+ </fileset>
472+ </replaceregexp>
473+ </target>
474+
475+
476+ <!-- HTML -->
477+ <target name="-usemin" depends="-serverconfig" description="(PRIVATE) Replaces references to non-minified scripts">
478+ <echo message="Switching to minified js files..."/>
479+
480+ <!-- switch from a regular jquery to minified -->
481+ <replaceregexp match="jquery-(\d|\d(\.\d)+)\.js" replace="jquery-\1.min.js" flags="">
482+ <fileset dir="./${dir.publish}" includes="${page-files}"/>
483+ </replaceregexp>
484+ <!-- switch any google CDN reference to minified -->
485+ <replaceregexp match="(\d|\d(\.\d)+)\/jquery\.js" replace="\1/jquery.min.js" flags="">
486+ <fileset dir="./${dir.publish}" includes="${page-files}"/>
487+ </replaceregexp>
488+
489+ <echo>kill off those versioning flags: ?v=2</echo>
490+ <replaceregexp match='\?v=\d+">' replace='">' flags="">
491+ <fileset dir="./${dir.publish}" includes="${page-files}"/>
492+ </replaceregexp>
493+ </target>
494+
495+
496+ <target name="-html" depends="-load-build-info" description="(PRIVATE) Very basic clean up of the HTML">
497+ <echo message="Clean up the html..."/>
498+ <!-- style.css replacement handled as a replacetoken above -->
499+ <replaceregexp match="<!-- scripts concatenated [\d\w\s\W]*?!-- end concatenated and minified scripts-->" replace="<script src='${dir.js}/scripts-${build.number}.min.js\'></script>" flags="m">
500+ <fileset dir="./${dir.publish}" includes="${page-files}"/>
501+ </replaceregexp>
502+ <!--[! use comments like this one to avoid having them get minified -->
503+ </target>
504+
505+
506+ <target name="-htmlclean">
507+ <apply executable="java" parallel="false" force="true" dest="./${dir.publish}/" >
508+ <fileset dir="./${dir.publish}/" includes="${page-files}"/>
509+ <arg value="-jar"/>
510+ <arg path="./${dir.build}/tools/${tool.htmlcompressor}"/>
511+ <arg line="--type html"/>
512+ <arg line="--preserve-multi-spaces"/>
513+ <arg line="--remove-quotes"/>
514+ <arg line="--compress-js"/>
515+ <arg line="--compress-css"/>
516+ <srcfile/>
517+ <arg value="-o"/>
518+ <mapper type="glob" from="*.html" to="../${dir.publish}/*.html"/>
519+ <targetfile/>
520+ </apply>
521+ </target>
522+
523+
524+ <target name="-htmlbuildkit">
525+ <apply executable="java" parallel="false" force="true" dest="./${dir.publish}/" >
526+ <fileset dir="./${dir.publish}/" includes="${page-files}"/>
527+ <arg value="-jar"/>
528+ <arg path="./${dir.build}/tools/${tool.htmlcompressor}"/>
529+ <arg value="--preserve-comments"/>
530+ <arg line="--preserve-multi-spaces"/>
531+ <arg line="--type html"/>
532+ <arg line="--compress-js"/>
533+ <arg line="--compress-css"/>
534+ <srcfile/>
535+ <arg value="-o"/>
536+ <mapper type="glob" from="*.html" to="../${dir.publish}/*.html"/>
537+ <targetfile/>
538+ </apply>
539+ </target>
540+
541+
542+ <target name="-htmlcompress">
543+ <apply executable="java" parallel="false" force="true" dest="./${dir.publish}/" >
544+ <fileset dir="./${dir.publish}/" includes="${page-files}"/>
545+ <arg value="-jar"/>
546+ <arg path="./${dir.build}/tools/${tool.htmlcompressor}"/>
547+ <arg line="--type html"/>
548+ <arg line="--remove-quotes"/>
549+ <arg line="--compress-js"/>
550+ <arg line="--compress-css"/>
551+ <srcfile/>
552+ <arg value="-o"/>
553+ <mapper type="glob" from="*.html" to="../${dir.publish}/*.html"/>
554+ <targetfile/>
555+ </apply>
556+ </target>
557+
558+
559+ <target name="-serverconfig" description="(PRIVATE) Upgrades expires headers">
560+ <echo message="Upgrading expires header timeouts for js/css"/>
561+ <replace file="./${dir.publish}/${file.serverconfig}" token="access plus 2 months" value="access plus 1 year"/>
562+ </target>
563+
564+
565+ <!-- CSS -->
566+ <target name="-css" description="Concatenates and Minifies any stylesheets listed in the file.stylesheets property">
567+ <echo message="Minifying css..."/>
568+
569+ <concat destfile="./${dir.publish}/${dir.css}/style-${build.number}.css">
570+ <filelist dir="./${dir.publish}/${dir.css}" files="${stylesheet-files}"/>
571+ </concat>
572+ <apply executable="php" parallel="false">
573+ <fileset dir="./${dir.publish}/${dir.css}/" includes="style-${build.number}.css"/>
574+ <arg line="-f"/>
575+ <arg path="./${dir.build.tools}/${tool.csscompressor}"/>
576+ <srcfile/>
577+ <redirector>
578+ <outputmapper type="glob" from="style-${build.number}.css" to="./${dir.publish}/${dir.css}/style-${build.number}.min.css"/>
579+ </redirector>
580+ </apply>
581+ <replace token="style.css" value="style-${build.number}.min.css" dir="${dir.publish}" includes="${page-files}"/>
582+ </target>
583+
584+
585+ <!-- IMAGES -->
586+ <target name="-imagespng" description="(PRIVATE) Optimizes .png images using optipng">
587+ <echo message="Optimizing images"/>
588+
589+ <!-- osfamily=unix is actually true on OS X as well -->
590+ <apply executable="optipng" osfamily="unix">
591+ <arg value="-o7"/>
592+ <fileset dir="./${dir.publish}/">
593+ <include name="**/*.png"/>
594+ </fileset>
595+ </apply>
596+ <apply executable="tools/optipng-0.6.4-exe/optipng.exe" osfamily="windows">
597+ <arg value="-o7"/>
598+ <fileset dir="./${dir.publish}/">
599+ <include name="**/*.png"/>
600+ </fileset>
601+ </apply>
602+ </target>
603+
604+
605+ <target name="-imagesjpg" description="(PRIVATE) Optimizes .jpg images using jpegtan">
606+ <echo message="Clean up those jpgs..."/>
607+ <if>
608+ <equals arg1="${images.strip.metadata}" arg2="true"/>
609+ <then>
610+ <var name="strip-meta-tags" value="none"/>
611+ </then>
612+ <else>
613+ <var name="strip-meta-tags" value="all"/>
614+ </else>
615+ </if>
616+ <apply executable="jpegtran" osfamily="unix">
617+ <fileset dir="./${dir.publish}/${dir.images}/" includes="*.jpg"/>
618+ <arg value="-copy"/>
619+ <arg value="${strip-meta-tags}"/>
620+ <srcfile/>
621+ <targetfile/>
622+ <!-- you may want to flag optimized images. If so, do it here. Otherwise change this to type="identity" -->
623+ <mapper type="glob" from="*.jpg" to="../${dir.publish}/${dir.images}/*.jpg"/>
624+ </apply>
625+ <apply executable="tools/jpegtran.exe" osfamily="windows">
626+ <fileset dir="./${dir.publish}/${dir.images}/" includes="*.jpg"/>
627+ <arg value="-copy"/>
628+ <arg value="${strip-meta-tags}"/>
629+ <srcfile/>
630+ <targetfile/>
631+ <!-- you may want to flag optimized images. If so, do it here. Otherwise change this to type="identity" -->
632+ <mapper type="glob" from="*.jpg" to="../${dir.publish}/${dir.images}/*.jpg"/>
633+ </apply>
634+ </target>
635+
636+</project>