2 <!-- This is the first version of the ant build file -->
3 <!-- The build process isn't yet optimized and don't work -->
4 <!-- perfect for every situation (i.e. when xsl files are changed -->
5 <!-- Nevertheless, it works for the every day build) -->
7 <project default="all" name="phpeclipsedoc" basedir=".">
8 <description>Build the phpeclipse documents</description>
11 <taskdef resource="net/sf/antcontrib/antcontrib.properties" />
14 <property environment="env"/>
15 <property name="user_docs" value="xo-002"></property>
16 <property name="doc_langs" value="en,de,fr,es"></property>
19 <!-- This is the setting for calling saxon (for making fo) -->
20 <path id="project.class.path.saxon">
21 <pathelement location="c:/docbook/docbook-xsl/extensions/saxon651.jar"/>
22 <pathelement location="c:/docbook/saxon/saxon.jar"/>
23 <pathelement location="c:/docbook/saxon/saxon_fop.jar"/>
24 <pathelement location="c:/docbook/saxon/saxon_jdom.jar"/>
25 <pathelement location="c:/docbook/docbook-xsl/extensions/resolver.jar"/>
26 <pathelement location="c:/docbook/docbook-xsl/extensions"/>
30 <!-- This is the setting for calling fop (for making pdf) -->
31 <path id="project.class.path.fop">
32 <pathelement location="c:/docbook/fop/build/fop.jar"/>
33 <pathelement location="c:/docbook/fop/lib/xml-apis.jar"/>
34 <pathelement location="c:/docbook/fop/lib/xercesImpl-2.2.1.jar"/>
35 <pathelement location="c:/docbook/fop/lib/xalan-2.4.1.jar"/>
36 <pathelement location="c:/docbook/fop/lib/batik.jar"/>
37 <pathelement location="c:/docbook/fop/lib/avalon-framework-cvs-20020806.jar"/>
38 <pathelement location="c:/docbook/jimi/jimiProClasses.zip"/>
39 <pathelement location="c:/docbook/jai/jai_core.jar"/>
40 <pathelement location="c:/docbook/jai/jai_codec.jar"/>
44 <target name="all" depends="docs"/>
46 <!-- the outer loop (for every document, which is in the list) -->
48 <target name="docs" description="target1">
49 <echo message="for every document" />
51 <foreach list="${user_docs}" target="target_lang" param="param_doc">
55 <!-- the inner loop (for every language, which is in the list) -->
57 <target name="target_lang" description="language loop">
58 <echo message="for every language we have" />
60 <foreach list="${doc_langs}" target="build_the_doc" param="param_lang">
64 <!-- builds every output (with doc and language as parameter) -->
66 <target name="build_the_doc" depends="fop, htmlhelp_compile, htmlchunk_compile">
67 <echo message="prop is ${param_doc} ${param_lang}" />
70 <!-- isavail checks whether a document (source) is available -->
72 <target name="isavail">
73 <available file="docmaster.xml" filepath="src/${param_lang}/${param_doc}" property="source_is_available"></available>
76 <!-- ===================================================================== -->
77 <!-- isrequired checks whether an update/compile is necessarry -->
78 <!-- ===================================================================== -->
80 <target name="isrequired" depends="isavail">
81 <uptodate property="docBuild.PDFnotRequired" targetfile="out/${param_lang}/pdf/${param_doc}.pdf">
82 <srcfiles dir="src/${param_lang}/${param_doc}" includes="**/*.xml"/>
83 <srcfiles dir="xsl" includes="phpeclipse_pdf.xsl"/>
84 <srcfiles dir="xsl" includes="phpeclipse_pagemaster.xsl"/>
85 <srcfiles dir="xsl" includes="userconfig.xsl"/>
88 <uptodate property="docBuild.CHMnotRequired" targetfile="out/${param_lang}/chm/${param_doc}.chm">
89 <srcfiles dir="src/${param_lang}/${param_doc}" includes="**/*.xml"/>
90 <srcfiles dir="xsl" includes="phpeclipse_htmlhelpprofile.xsl"/>
91 <srcfiles dir="xsl" includes="phpeclipse_htmlhelp.xsl"/>
92 <srcfiles dir="xsl" includes="userconfig.xsl"/>
95 <uptodate property="docBuild.XHTMLnotRequired" targetfile="out/${param_lang}/xhtml_dm/${param_doc}_dm.tar.gz">
96 <srcfiles dir="src/${param_lang}/${param_doc}" includes="**/*.xml"/>
97 <srcfiles dir="xsl" includes="phpeclipse_xhtmlprofile.xsl"/>
98 <srcfiles dir="xsl" includes="phpeclipse_htmlchunk.xsl"/>
99 <srcfiles dir="xsl" includes="userconfig.xsl"/>
102 <uptodate property="docBuild.xmllintNotRequired" targetfile="${param_lang}_${param_doc}.xml">
103 <srcfiles dir="src/${param_lang}/${param_doc}" includes="**/*.xml"/>
106 <condition property="docBuild.RecodeNotRequired">
107 <equals arg1="${env.INPUT_ENCODING}" arg2="${env.OUTPUT_ENCODING}" />
111 <condition property="docBuild.RecodeNotRequired">
114 <equals arg1="${env.INPUT_ENCODING}" arg2="UTF-8" />
115 <equals arg1="${env.OUTPUT_ENCODING}" arg2="UTF-8" />
120 <equals arg1="${env.INPUT_ENCODING}" arg2="UTF-8" />
121 <equals arg1="${env.OUTPUT_ENCODING}" arg2="UTF-8" />
124 <isset property="docBuild.XHTMLnotRequired"/>
131 <!-- ===================================================================== -->
132 <!-- xmllint generates a single xml file from the splitted source files -->
133 <!-- ===================================================================== -->
135 <target name="xmllint" depends="isrequired" if="source_is_available" unless="docBuild.xmllintNotRequired">
136 <exec executable="xmllint" output="xmllint.log">
137 <arg value="--noent"/>
138 <arg value="--valid"/>
139 <arg value="src/${param_lang}/${param_doc}/docmaster.xml"/>
141 <arg value="${param_lang}_${param_doc}.xml"/>
145 <!-- ===================================================================== -->
146 <!-- Generate the output for PDF -->
147 <!-- ===================================================================== -->
149 <target name="saxon" depends="xmllint" if="source_is_available" unless="docBuild.PDFnotRequired">
150 <java classname="com.icl.saxon.StyleSheet" classpathref="project.class.path.saxon" output="saxon.log">
151 <arg line="-x org.apache.xml.resolver.tools.ResolvingXMLReader"/>
152 <arg line="-y org.apache.xml.resolver.tools.ResolvingXMLReader"/>
154 <arg line="-o ${param_lang}_${param_doc}.fo"/>
155 <arg line="${param_lang}_${param_doc}.xml xsl/phpeclipse_pdf.xsl" />
160 <target name="fop" depends="saxon" if="source_is_available" unless="docBuild.PDFnotRequired">
161 <mkdir dir="out/${param_lang}/pdf"/>
163 <java classname="org.apache.fop.apps.Fop" classpathref="project.class.path.fop" output="fop.log">
164 <arg line="-fo ${param_lang}_${param_doc}.fo"/>
165 <arg line="-pdf out/${param_lang}/pdf/${param_doc}.pdf"/>
166 <arg line="-c c:/docbook/fop/conf/userconfig.xml"/>
170 <!-- ===================================================================== -->
171 <!-- Generate the XHML output for the htmlhelp compiler -->
172 <!-- ===================================================================== -->
174 <target name="htmlhelp_compile" depends="htmlhelp_build_xml" if="source_is_available" unless="docBuild.CHMnotRequired">
175 <exec executable="${env.HTMLHELP_HOME}/hhc">
176 <arg value="htmlhelp.hhp"/>
179 <copy file="htmlhelp.chm" overwrite="true" tofile="out/${param_lang}/chm/${param_doc}.chm"/>
183 <target name="htmlhelp_build_xml" depends="htmlhelp_profile" if="source_is_available" unless="docBuild.CHMnotRequired">
184 <!-- Delete all the old stuff within the document directory -->
186 <fileset dir="." includes="*.html"></fileset>
187 <fileset dir="." includes="*.hhp"></fileset>
188 <fileset dir="." includes="*.hhc"></fileset>
189 <fileset dir="." includes="*.hhk"></fileset>
190 <fileset dir="." includes="*.chm"></fileset>
194 <exec executable="xsltproc">
195 <arg value="--output"/>
196 <arg value="${param_doc}.xhtml"/>
197 <arg value="xsl/phpeclipse_htmlhelp.xsl"/>
198 <arg value="pro_${param_lang}_${param_doc}.xml"/>
203 <target name="htmlhelp_profile" depends="isrequired" if="source_is_available" unless="docBuild.CHMnotRequired">
204 <exec executable="xsltproc">
205 <arg value="--output"/>
206 <arg value="pro_${param_lang}_${param_doc}.xml"/>
207 <arg value="xsl/phpeclipse_htmlhelpprofile.xsl"/>
208 <arg value="${param_lang}_${param_doc}.xml"/>
212 <!-- ===================================================================== -->
213 <!-- Generate the XHTML output for user and docman module -->
214 <!-- ===================================================================== -->
215 <!-- Doesn't work correctly
216 <target name="recode_file" depends="isrequired" unless="docBuild.RecodeNotRequired">
217 <echo>recoding: ${param_file}</echo>
218 <exec executable="${env.RECODE_HOME}/recode" output="recode.log">
219 <arg value="${env.INPUT_ENCODING}..${env.OUTPUT_ENCODING}"/>
220 <arg value="${param_file}"/>
225 <target name="recode_file" depends="isrequired" unless="docBuild.RecodeNotRequired">
226 <echo>recoding: ${param_file}</echo>
228 <move file="${param_file}" overwrite="true" tofile="${param_file}.tmp"/>
230 <exec executable="${env.RECODE_HOME}/iconv" output="${param_file}" error="iconv_error.log">
233 <arg value="${env.INPUT_ENCODING}"/>
235 <arg value="${env.OUTPUT_ENCODING}"/>
236 <arg value="${param_file}.tmp"/>
239 <delete file="${param_file}.tmp" />
244 <target name="htmlchunk_compile" depends="htmlchunk_build_xml" if="source_is_available" unless="docBuild.XHTMLnotRequired">
245 <!-- Delete all the old stuff within the tmp directory -->
246 <delete dir="tmp/img">
247 <fileset dir="tmp" includes="**/*.html"></fileset>
248 <fileset dir="tmp" includes="**/*.css"></fileset>
249 <fileset dir="tmp" includes="**/*.xml"></fileset>
250 <fileset dir="." includes="*.tar"></fileset>
251 <fileset dir="." includes="*.tar.gz"></fileset>
252 <fileset dir="." includes="*.zip"></fileset>
255 <!-- Parse the sources, copy all the needed images into tmp/img and convert the html files for docman -->
256 <exec executable="${env.PHP4_HOME}/phpcli" output="parse.log">
257 <arg value="parse.php"/>
258 <arg value="${param_lang}"/>
259 <arg value="${param_doc}"/>
260 <arg value="${env.INPUT_ENCODING}"/>
261 <arg value="${env.OUTPUT_ENCODING}"/>
264 <foreach target="recode_file" param="param_file">
265 <fileset dir="tmp" includes="*.html"></fileset>
266 <fileset dir="tmp" includes="*.xml"></fileset>
269 <tar basedir="tmp" tarfile="${param_doc}.tar"></tar>
270 <gzip src="${param_doc}.tar" zipfile="${param_doc}.tar.gz"/>
271 <copy file="${param_doc}.tar.gz" overwrite="true" tofile="out/${param_lang}/xhtml_dm/${param_doc}_dm.tar.gz"/>
273 <!-- Now make a tar.gz file with the original xhtml files -->
274 <!-- Delete first all the converted xhtml files -->
276 <fileset dir="tmp" includes="**/*.html"></fileset>
277 <fileset dir="tmp" includes="**/*.xml"></fileset>
278 <fileset dir="tmp/img" includes="*.jpg"></fileset>
279 <fileset dir="tmp/img" includes="*.png"></fileset>
280 <fileset dir="." includes="*.tar"></fileset>
281 <fileset dir="." includes="*.tar.gz"></fileset>
282 <fileset dir="." includes="*.zip"></fileset>
285 <!-- Copy all the original xhtml files to the tmp dir -->
287 <fileset dir="." includes="*.html"></fileset>
290 <!-- Now check for the images we need, and copy them into tmp/img/ -->
291 <exec executable="${env.PHP4_HOME}/phpcli" output="parseimages.log">
292 <arg value="parseimages.php"/>
293 <arg value="${param_doc}"/>
296 <!-- Tar and gzip the original xhmtl files including the images, and copy to destination -->
297 <tar basedir="tmp" tarfile="${param_doc}.tar"></tar>
298 <gzip src="${param_doc}.tar" zipfile="${param_doc}.tar.gz"/>
299 <copy file="${param_doc}.tar.gz" overwrite="true" tofile="out/${param_lang}/xhtml/${param_doc}.tar.gz"/>
301 <!-- Generate also an zip file, for those which feel uncomfortable with the tar.gz -->
302 <zip basedir="tmp" zipfile="${param_doc}.zip"></zip>
303 <copy file="${param_doc}.zip" overwrite="true" tofile="out/${param_lang}/xhtml/${param_doc}.zip"/>
305 <!-- Delete all the old stuff within the tmp directory -->
306 <delete dir="tmp/img">
307 <fileset dir="tmp" includes="**/*.html"></fileset>
308 <fileset dir="tmp" includes="**/*.css"></fileset>
309 <fileset dir="tmp" includes="**/*.xml"></fileset>
310 <fileset dir="." includes="*.tar"></fileset>
311 <fileset dir="." includes="*.tar.gz"></fileset>
312 <fileset dir="." includes="*.zip"></fileset>
313 <fileset dir="." includes="*.html"></fileset>
318 <target name="htmlchunk_build_xml" depends="htmlchunk_profile" if="source_is_available" unless="docBuild.XHTMLnotRequired">
319 <!-- Delete all the old html files within the root directory -->
321 <fileset dir="." includes="*.html"></fileset>
324 <exec executable="xsltproc">
325 <arg value="--output"/>
326 <arg value="${param_doc}.xhtml"/>
327 <arg value="xsl/phpeclipse_htmlchunk.xsl"/>
328 <arg value="xpro_${param_lang}_${param_doc}.xml"/>
333 <target name="htmlchunk_recode" depends="htmlchunk_profile" if="source_is_available" unless="docBuild.RecodeNotRequired">
334 <exec executable="${env.RECODE_HOME}/recode" output="recode.log">
335 <arg value="${env.INPUT_ENCODING}..${env.OUTPUT_ENCODING}"/>
336 <arg value="xpro_${param_lang}_${param_doc}.xml"/>
339 <!-- and here add the encoding to <?xml version="1.0"?> -->
344 <target name="htmlchunk_profile" depends="xmllint" if="source_is_available" unless="docBuild.XHTMLnotRequired">
345 <exec executable="xsltproc" output="xsltproc.log">
346 <arg value="--output"/>
347 <arg value="xpro_${param_lang}_${param_doc}.xml"/>
348 <arg value="xsl/phpeclipse_xhtmlprofile.xsl"/>
349 <arg value="${param_lang}_${param_doc}.xml"/>