I broke the build using loc.replace in PHPManualView.java. I changed this to replaceA...
[phpeclipse.git] / net.sourceforge.phpeclipse.help / docbook-src / guide / build.xml
1 <?xml version='1.0'?>
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)              -->
6
7 <project default="all" name="phpeclipsedoc" basedir=".">
8   <description>Build the phpeclipse documents</description>
9
10
11   <taskdef resource="net/sf/antcontrib/antcontrib.properties" />
12
13
14   <property environment="env"/>
15   <property name="user_docs" value="xo-002"></property>
16   <property name="doc_langs" value="en,de,fr,es"></property>
17
18
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"/>
27   </path>
28
29
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"/>
41   </path>
42
43
44   <target name="all" depends="docs"/>
45
46 <!-- the outer loop (for every document, which is in the list)             -->
47
48   <target name="docs" description="target1">
49     <echo message="for every document" />
50
51     <foreach list="${user_docs}" target="target_lang" param="param_doc">
52     </foreach>
53   </target>
54
55 <!-- the inner loop (for every language, which is in the list)             -->
56
57   <target name="target_lang" description="language loop">
58     <echo message="for every language we have" />
59
60     <foreach list="${doc_langs}" target="build_the_doc" param="param_lang">
61     </foreach>
62   </target>
63
64 <!-- builds every output (with doc and language as parameter)              -->
65
66   <target name="build_the_doc" depends="fop, htmlhelp_compile, htmlchunk_compile">
67     <echo message="prop is ${param_doc} ${param_lang}" />
68   </target>
69
70 <!-- isavail checks whether a document (source) is available               -->
71
72   <target name="isavail">
73     <available file="docmaster.xml" filepath="src/${param_lang}/${param_doc}" property="source_is_available"></available>
74   </target>
75
76 <!-- ===================================================================== -->
77 <!-- isrequired checks whether an update/compile is necessarry             -->
78 <!-- ===================================================================== -->
79
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"/>
86     </uptodate>
87
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"/>
93     </uptodate>
94
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"/>
100     </uptodate>
101
102    <uptodate property="docBuild.xmllintNotRequired" targetfile="${param_lang}_${param_doc}.xml">
103       <srcfiles dir="src/${param_lang}/${param_doc}" includes="**/*.xml"/>
104     </uptodate>
105
106    <condition property="docBuild.RecodeNotRequired">
107      <equals arg1="${env.INPUT_ENCODING}" arg2="${env.OUTPUT_ENCODING}" />
108    </condition>
109
110 <!--
111    <condition property="docBuild.RecodeNotRequired">
112      <or>
113        <and>
114          <equals arg1="${env.INPUT_ENCODING}" arg2="UTF-8" />
115          <equals arg1="${env.OUTPUT_ENCODING}" arg2="UTF-8" />
116        </and>
117        <and>
118          <not>
119            <and>
120              <equals arg1="${env.INPUT_ENCODING}" arg2="UTF-8" />
121              <equals arg1="${env.OUTPUT_ENCODING}" arg2="UTF-8" />
122            </and>
123          </not>
124          <isset property="docBuild.XHTMLnotRequired"/>
125        </and>
126      </or>
127    </condition>
128 -->
129   </target>
130
131 <!-- ===================================================================== -->
132 <!-- xmllint generates a single xml file from the splitted source files    -->
133 <!-- ===================================================================== -->
134
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"/>
140       <arg value="-o"/>
141       <arg value="${param_lang}_${param_doc}.xml"/>
142     </exec>
143   </target>
144
145 <!-- ===================================================================== -->
146 <!-- Generate the output for PDF                                           -->
147 <!-- ===================================================================== -->
148
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"/>
153       <arg line="-u"/>
154       <arg line="-o ${param_lang}_${param_doc}.fo"/>
155       <arg line="${param_lang}_${param_doc}.xml xsl/phpeclipse_pdf.xsl" />
156     </java>
157   </target>
158
159
160   <target name="fop" depends="saxon" if="source_is_available" unless="docBuild.PDFnotRequired">
161     <mkdir dir="out/${param_lang}/pdf"/>
162
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"/>
167     </java>
168   </target>
169
170 <!-- ===================================================================== -->
171 <!-- Generate the XHML output for the htmlhelp compiler                    -->
172 <!-- ===================================================================== -->
173
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"/>
177     </exec>
178
179     <copy file="htmlhelp.chm" overwrite="true" tofile="out/${param_lang}/chm/${param_doc}.chm"/>
180   </target>
181
182
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 -->
185     <delete>
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>
191     </delete>
192
193
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"/>
199     </exec>
200   </target>
201
202
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"/>
209     </exec>
210   </target>
211
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}"/>
221     </exec>
222   </target>
223 -->
224
225   <target name="recode_file" depends="isrequired" unless="docBuild.RecodeNotRequired">
226     <echo>recoding: ${param_file}</echo>
227
228     <move file="${param_file}" overwrite="true" tofile="${param_file}.tmp"/>
229
230     <exec executable="${env.RECODE_HOME}/iconv" output="${param_file}" error="iconv_error.log">
231       <arg value="-c" />
232       <arg value="-f" />
233       <arg value="${env.INPUT_ENCODING}"/>
234       <arg value="-t"/>
235       <arg value="${env.OUTPUT_ENCODING}"/>
236       <arg value="${param_file}.tmp"/>
237     </exec>
238
239     <delete file="${param_file}.tmp" />
240
241   </target>
242
243
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>
253     </delete>
254
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}"/>
262     </exec>
263
264     <foreach target="recode_file" param="param_file">
265       <fileset dir="tmp" includes="*.html"></fileset>
266       <fileset dir="tmp" includes="*.xml"></fileset>
267     </foreach>
268
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"/>
272
273     <!-- Now make a tar.gz file with the original xhtml files  -->
274     <!-- Delete first all the converted xhtml files -->
275     <delete>
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>
283     </delete>
284
285     <!-- Copy all the original xhtml files to the tmp dir -->
286     <copy todir="tmp">
287       <fileset dir="." includes="*.html"></fileset>
288     </copy>
289
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}"/>
294     </exec>
295
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"/>
300
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"/>
304
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>
314     </delete>
315   </target>
316
317
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 -->
320     <delete>
321       <fileset dir="." includes="*.html"></fileset>
322     </delete>
323
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"/>
329     </exec>
330   </target>
331
332
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"/>
337     </exec>
338
339     <!-- and here add the encoding to <?xml version="1.0"?> -->
340
341   </target>
342
343
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"/>
350     </exec>
351   </target>
352
353
354 </project>