Update Scintilla to v3.4.1
[TortoiseGit.git] / doc / doc.build
blob36d19f23a329717a935add715f15523b58953c09
1 <?xml version="1.0"?>
2 <!--
3 ============================================================
4 $Date: 2008-12-14 09:06:16 +0800 (Sun, 14 Dec 2008) $
5 $Author: simonlarge $
6 $Rev: 14835 $
7 ============================================================
9 NAnt build script for the TortoiseGit documentation
11 All project specific configuration is stored in doc.build.include.
12 All user/site specific configuration is stored in doc.build.user.
14 -->
16 <project name="Documentation" default="all" basedir=".">
17 <description>
18 Builds the Documentation in all languages and all output formats
19 </description>
21 <!-- default: we don't clean first -->
22 <property name="cleanup" value="" overwrite="false" />
24 <include buildfile="doc.build.include"/>
26 <!-- ====================================================================== -->
27 <!-- Loop over all languages -->
28 <!-- ====================================================================== -->
30 <target name="all"
31 description="Loop over all languages, output formats and applications and build documentation"
32 depends="prepare" >
34 <foreach item="String" in="${languages}" delim="," property="lang.target">
35 <!-- language code for English (US) (default)-->
36 <property name="lang.target.code" value="1033" />
37 <property name="languagebuildfile" value="${path.user.xsl}/${lang.target}/lang.build" />
38 <if test="${file::exists(languagebuildfile)}" >
39 <include buildfile="${languagebuildfile}" />
40 </if>
41 <call target="doit" failonerror="${critical or lang.base==lang.target}"/>
42 </foreach>
43 </target>
45 <!-- ====================================================================== -->
46 <!-- Loop over all applications and output formats -->
47 <!-- ====================================================================== -->
49 <target name="doit">
51 <foreach item="String" in="${applications}" delim="," property="app">
52 <property name="doc.source.file" value="source/${lang.base}/${app}.xml"/>
53 <property name="doc.base.name" value="${app}_${lang.base}"/>
54 <property name="doc.base.work" value="output/${doc.base.name}"/>
56 <property name="doc.target.name" value="${app}_${lang.target}"/>
57 <property name="doc.target.work" value="output/${doc.target.name}"/>
58 <property name="doc.target.source" value="source/${lang.target}/${app}/${app}.xml"/>
59 <property name="pofiletotranslate" value="po/${app}_${lang.target}.po" />
61 <echo message="------------------------------------------------------------"/>
62 <echo message="Creating '${doc.target.name}' documentation"/>
64 <if test="${file::exists(pofiletotranslate)}" >
65 <call target="translate" unless="${lang.base==lang.target}" />
66 </if>
67 <if test="${lang.base==lang.target or file::exists(pofiletotranslate)}" >
68 <!-- update version info in version.xml -->
69 <call target="UpdateVersionInfo"/>
71 <call target="spellcheck" if="${property::exists('spellcheck') and spellcheck=='true'}"/>
72 <call target="copyimages"/>
74 <property name="xslt.source" value="${doc.target.source}"/>
75 <foreach item="String" in="${docformats}" delim="," property="docformat">
76 <call target="${docformat}"/>
77 </foreach>
78 </if>
79 </foreach>
80 </target>
82 <!-- ====================================================================== -->
83 <!-- ====================================================================== -->
85 <target name="clean" description="remove all generated files">
86 <if test="${cleanup == 'yes'}">
87 <delete dir="output" failonerror="false"/>
88 </if>
89 </target>
91 <!-- ====================================================================== -->
92 <!-- ====================================================================== -->
94 <target name="prepare" description="Create directories" depends="clean">
95 <mkdir dir="output"/>
96 <call target="prepare.custom" if="${target::exists('prepare.custom')}"/>
98 <!-- find the path to the fonts -->
99 <script language="C#">
100 <code>
101 <![CDATA[
102 public static void ScriptMain(Project project)
104 string systemPath = Environment.GetFolderPath(Environment.SpecialFolder.System);
105 string fontsPath = Path.GetDirectoryName(systemPath) + Path.DirectorySeparatorChar + "FONTS";
106 fontsPath = fontsPath.Replace('\\','/');
107 project.Properties.Add("fontpath", fontsPath );
110 </code>
111 </script>
113 <!-- ensure "Version" translation invariant -->
114 <copy file="source\${lang.base}\version.in" tofile="source\${lang.base}\version.xml" overwrite="true"/>
116 <!-- tune path to xsltproc.exe in aspell.bat -->
117 <copy file="Aspell/aspell.in" tofile="Aspell/aspell.bat" overwrite="true">
118 <filterchain>
119 <replacetokens begintoken="$" endtoken="$">
120 <token key="XSLTProcPath" value="${path.bin}" />
121 </replacetokens>
122 </filterchain>
123 </copy>
125 </target>
127 <!-- ====================================================================== -->
128 <!-- ====================================================================== -->
130 <target name="copyimages" description="Copy images">
131 <delete dir="${doc.target.work}/images" failonerror="false"/>
132 <mkdir dir="${doc.target.work}/images"/>
133 <copy todir="${doc.target.work}/images">
134 <fileset basedir="images/${lang.base}">
135 <include name="*"/>
136 </fileset>
137 </copy>
139 <copy todir="${doc.target.work}/images" unless="${lang.base==lang.target}" overwrite="true">
140 <fileset basedir="images/${lang.target}">
141 <include name="*"/>
142 </fileset>
143 </copy>
144 </target>
146 <!-- ====================================================================== -->
147 <!-- ====================================================================== -->
149 <target name="uptodate" description="Check whether the given target is up to date">
151 <echo message="Checking if '${file.target}' is up to date"/>
152 <uptodate property="file.target.uptodate">
153 <sourcefiles>
154 <include name="source/${lang.target}/${app}/**/*.xml"/>
155 <include name="source/${lang.target}/glossary.xml"/>
156 <include name="source/${lang.target}/wishlist.xml"/>
157 <include name="source/${lang.target}/version.in"/>
158 </sourcefiles>
159 <targetfiles>
160 <include name="${file.target}"/>
161 </targetfiles>
162 </uptodate>
163 <if test="${file.target.uptodate}">
164 <echo message="Up to date"/>
165 </if>
166 </target>
168 <!-- ====================================================================== -->
169 <!-- Run xsltproc with the defined parameters -->
170 <!-- ====================================================================== -->
172 <target name="xsltproc" description="Run xsltproc with the defined parameters">
173 <echo message="Processing XML Source" />
175 <!-- Check whether a language specific xsl file exists and use it -->
176 <!-- if none is found, load XSL file from default location. -->
177 <property name="xslt.file.lang" value="${path.user.xsl}/${lang.target}/${xslt.file}" />
178 <property name="xslt.file" value="${xslt.file.lang}" if="${file::exists(xslt.file.lang)}"/>
179 <property name="xslt.file" value="${path.user.xsl}/${xslt.file}" unless="${file::exists(xslt.file.lang)}"/>
181 <echo message="Stylesheet: ${xslt.file}" />
182 <echo message="Parameters: ${xslt.params}" />
183 <exec program="xsltproc"
184 commandline="${xslt.params} --output ${xslt.target} ${xslt.file} ${xslt.source}"
185 basedir="${path.bin}"
186 verbose="false"/>
187 </target>
189 <!-- ====================================================================== -->
190 <!-- Profile source into a single file -->
191 <!-- ====================================================================== -->
193 <target name="profile" description="Profile source into a single file" >
195 <call target="uptodate"/>
197 <if test="${not file.target.uptodate}">
198 <property name="xslt.params" value="${xsl.profile.params}"/>
199 <property name="xslt.file" value="${xsl.profile.file}"/>
200 <property name="xslt.target" value="${file.target}.tmp"/>
202 <echo message="Profiling into: ${file.target}"/>
203 <call target="xsltproc"/>
205 <!-- Removes the moreinfo="" attributes added by xsltproc -->
206 <move file="${xslt.target}" tofile="${file.target}" overwrite="true">
207 <filterchain>
208 <replacestring from=" moreinfo=&quot;none&quot;" to="" />
209 </filterchain>
210 </move>
211 </if>
212 </target>
214 <!-- ====================================================================== -->
215 <!-- Create po template for each application from sources -->
216 <!-- ====================================================================== -->
218 <target name="potfile" description="Create po template from sources">
219 <property name="lang.target" value="${lang.base}"/>
221 <!-- ensure "Version" translation invariant -->
222 <copy file="source\${lang.base}\version.in" tofile="source\${lang.base}\version.xml" overwrite="true"/>
224 <foreach item="String" in="${potemplates}" delim="," property="app">
226 <property name="potfile" value="po/${app}.pot" />
227 <property name="xslt.source" value="source/${lang.base}/${app}/${app}.xml"/>
228 <property name="file.target" value="source/${app}_${lang.base}.xml"/>
230 <echo message="------------------------------------------------------------"/>
231 <echo message="Checking if ${potfile} is up to date"/>
233 <call target="profile" />
235 <if test="${not file::up-to-date(file.target, potfile)}">
236 <echo message="Creating po template from sources"/>
237 <exec program="python"
238 commandline="xml2po.py -e -o ${potfile}.tmp ${file.target}"
239 verbose="false"/>
241 <!-- Adjust path to source file -->
242 <move file="${potfile}.tmp" tofile="${potfile}" overwrite="true">
243 <filterchain>
244 <replacestring from="#: ${file.target}" to="#: ../${file.target}" />
245 </filterchain>
246 </move>
247 </if>
249 <echo message="" />
250 </foreach>
251 </target>
253 <!-- ====================================================================== -->
254 <!-- Create translated source files -->
255 <!-- ====================================================================== -->
257 <target name="translate" description="Create translated source file">
258 <property name="lang.pofile" value="po/${app}_${lang.target}.po"/>
260 <echo message="Translating: '${app} ${lang.target}' This may take a few minutes"/>
262 <exec program="msgfmt"
263 commandline="${lang.pofile} -o ${lang.target}.mo"
264 basedir="${path.gettext}"
265 verbose="false"/>
267 <foreach item="File" property="file.base">
268 <in>
269 <items>
270 <include name="source/${lang.base}/${app}/**/*.xml"/>
271 <include name="source/${lang.base}/glossary.xml"/>
272 <include name="source/${lang.base}/wishlist.xml"/>
273 <include name="source/${lang.base}/version.in"/>
274 </items>
275 </in>
276 <do>
277 <property name="file.target" value="${string::replace(file.base,'\'+lang.base+'\','\'+lang.target+'\')}"/>
279 <uptodate property="file.target.uptodate">
280 <sourcefiles>
281 <include name="${file.base}"/>
282 <include name="${lang.pofile}"/>
283 </sourcefiles>
284 <targetfiles>
285 <include name="${file.target}"/>
286 </targetfiles>
287 </uptodate>
289 <if test="${not file.target.uptodate}">
291 <echo message="Translating: ${path::get-file-name(file.target)}"/>
292 <property name="dir.target" value="${path::get-directory-name(file.target)}"/>
293 <mkdir dir="${dir.target}" unless="${directory::exists(dir.target)}"/>
294 <exec program="python"
295 commandline='xml2po.py -t "${lang.target}.mo" -o "${file.target}" "${file.base}"'
296 verbose="false"/>
297 </if>
299 </do>
300 </foreach>
302 <!--
303 <foreach item="File" property="file.base">
304 <in>
305 <items refid="files.exclude" />
306 </in>
307 <do>
308 <property name="file.target" value="${string::replace(file.base,'\'+lang.base+'\','\'+lang.target+'\')}"/>
309 <copy file="${file.base}" tofile="${file.target}" overwrite="true"/>
310 </do>
311 </foreach>
314 <delete file="${lang.target}.mo"/>
315 </target>
317 <!-- ====================================================================== -->
318 <!-- Try to update version info in the version file -->
319 <!-- ====================================================================== -->
321 <target name="UpdateVersionInfo" description="Updates the version file with version info">
323 <copy
324 file="source\${lang.target}\version.in"
325 tofile="source\${lang.target}\version.xml"
326 overwrite="true">
328 <filterchain>
329 <replacetokens begintoken="$" endtoken="$">
330 <token key="MajorVersion" value="${environment::get-variable('MajorVersion')}"/>
331 <token key="MinorVersion" value="${environment::get-variable('MinorVersion')}"/>
332 <token key="MicroVersion" value="${environment::get-variable('Microversion')}"/>
333 </replacetokens>
334 </filterchain>
335 </copy>
337 </target>
339 <!-- ====================================================================== -->
340 <!-- Run spellchecker on files -->
341 <!-- ====================================================================== -->
343 <target name="spellcheck" description="Run spellchecker on files">
344 <echo message="Spellchecking: '${app} ${lang.target}' This may take a few minutes"/>
345 <property name="spellcheck.log" value="ASpell/${app}_${lang.target}.log"/>
346 <mkdir dir="ASpell/${app}_${lang.target}"/>
348 <echo message="--- Spellchecking: '${lang.target}'"
349 file="${spellcheck.log}"
350 failonerror="false"/>
352 <copy file="Aspell/TortoiseGit.tmpl.pws" tofile="Aspell/Temp.pws" overwrite="true">
353 <filterchain>
354 <replacetokens begintoken="$" endtoken="$">
355 <token key="LANG" value="${lang.target}" />
356 </replacetokens>
357 </filterchain>
358 </copy>
360 <foreach item="File" property="file.base">
361 <in>
362 <items>
363 <include name="source/${lang.base}/${app}/**/*.xml"/>
364 <include name="source/${lang.base}/glossary.xml"/>
365 <include name="source/${lang.base}/wishlist.xml"/>
366 </items>
367 </in>
368 <do>
369 <property name="file.target" value="${string::replace(file.base,'\'+lang.base+'\','\'+lang.target+'\')}"/>
370 <property name="file.log" value="ASpell\${app}_${lang.target}\${path::get-file-name(file.target)}.log"/>
372 <uptodate property="file.target.uptodate">
373 <sourcefiles>
374 <include name="${file.target}"/>
375 <include name="ASpell/${lang.target}.pws"/>
376 <include name="ASpell/TortoiseGit.tmpl.pws"/>
377 </sourcefiles>
378 <targetfiles>
379 <include name="${file.log}"/>
380 </targetfiles>
381 </uptodate>
383 <if test="${not file.target.uptodate}">
384 <echo message="Checking: ${path::get-file-name(file.target)}"/>
385 <exec program="Aspell/aspell.bat"
386 commandline="${path.spellcheck} ${lang.target} ${file.target} ${file.log}"
387 failonerror="false"/>
388 </if>
389 <exec program="Aspell/append.bat"
390 commandline="${file.log} ${spellcheck.log}"/>
391 </do>
392 </foreach>
393 </target>
395 <!-- ====================================================================== -->
396 <!-- Create PDF documentation -->
397 <!-- ====================================================================== -->
399 <target name="pdf" description="Create PDF documentation">
401 <property name="file.target" value="output/${app}-${docverstring}-${lang.target}.pdf"/>
402 <call target="uptodate"/>
404 <if test="${not file.target.uptodate}">
405 <property name="xslt.params" value="${xsl.pdf.params}"/>
406 <property name="xslt.file" value="${xsl.pdf.file}"/>
407 <property name="xslt.final" value="${doc.target.work}/${doc.target.name}"/>
408 <!-- set xslt.target to the name of the temp file -->
409 <property name="xslt.target" value="${xslt.final}.tmp"/>
411 <call target="xsltproc" />
413 <!-- Removes the span="inherit" attribute added by xsltproc, which causes a warning -->
414 <move file="${xslt.target}" tofile="${xslt.final}.fo" overwrite="true">
415 <filterchain>
416 <replacestring from="span=&quot;inherit&quot; " to="" />
417 <replacestring from="width=&quot;auto&quot; height=&quot;auto&quot; content-width=&quot;auto&quot; content-height=&quot;auto&quot;" to="inline-progression-dimension.maximum=&quot;100%&quot; content-width=&quot;scale-down-to-fit&quot; content-height=&quot;scale-down-to-fit&quot;" />
418 </filterchain>
419 </move>
421 <property name="userconfig.langtemplate" value="${path.user.xsl}/${lang.target}/userconfig.template.xml" />
422 <property name="userconfig.lang" value="${path.user.xsl}/${lang.target}/userconfig.xml" />
424 <if test="${file::exists(userconfig.langtemplate)}">
425 <loadfile file="${userconfig.langtemplate}" property="configfile">
426 <filterchain>
427 <replacetokens begintoken="%" endtoken="%">
428 <token key="FONTSDIR" value="${fontpath}" />
429 </replacetokens>
430 </filterchain>
431 </loadfile>
432 <echo file="${userconfig.lang}" message="${configfile}" />
433 </if>
434 <property name="commandline" value="-q -fo ${xslt.final}.fo -pdf ${file.target}"/>
435 <property name="commandline" value="-c ${userconfig.lang} ${commandline}" if="${file::exists(userconfig.lang)}"/>
437 <exec program="fop.bat"
438 commandline="${commandline}"
439 basedir="${path.fop}"
440 verbose="false"/>
441 </if>
442 </target>
444 <!-- ====================================================================== -->
445 <!-- Create CHM documentation -->
446 <!-- ====================================================================== -->
448 <target name="chm" description="Create CHM documentation">
450 <property name="file.target" value="${doc.target.work}.chm"/>
451 <call target="uptodate"/>
453 <if test="${not file.target.uptodate}">
454 <property name="xslt.params" value="${xsl.chm.params}"/>
455 <property name="xslt.file" value="${xsl.chm.file}"/>
456 <property name="xslt.target" value="${doc.target.work}/${doc.target.name}"/>
458 <call target="xsltproc" />
460 <!-- The CHM helpcontext target resides in an external build file -->
461 <call target="help.prepare" if="${target::exists('help.prepare')}"/>
463 <copy file="${path.user.css}/styles_chm.css" todir="${doc.target.work}"/>
465 <exec program="SBAppLocale.exe"
466 commandline="${lang.target.code} ${path.bin}/hhc.exe ${doc.target.work}/htmlhelp.hhp"
467 basedir="${path.bin}"
468 resultproperty="result.hhc"
469 failonerror="false"
470 verbose="false"
471 timeout="600000" />
473 <copy file="${doc.target.work}/htmlhelp.chm" tofile="${file.target}"/>
474 </if>
475 <!--
476 <delete>
477 <fileset>
478 <include name="${doc.target.work}/*.*"/>
479 </fileset>
480 </delete>
482 </target>
484 <!-- ====================================================================== -->
485 <!-- Create HTML multi page documentation -->
486 <!-- ====================================================================== -->
487 <target name="html" description="Create HTML documentation" depends="">
489 <property name="file.target" value="${doc.target.work}/index.html"/>
490 <call target="uptodate"/>
492 <if test="${not file.target.uptodate}">
493 <property name="xslt.params" value="${xsl.htmlsingle.params}"/>
494 <property name="xslt.file" value="${xsl.htmlsingle.file}"/>
495 <property name="xslt.target" value="${doc.target.work}/${doc.target.name}"/>
497 <copy file="${path.user.css}/styles_chm.css" todir="${doc.target.work}"/>
498 <copy file="${path.user.css}/styles_html.css" todir="${doc.target.work}"/>
500 <call target="xsltproc" />
502 </if>
503 </target>
505 <!-- ====================================================================== -->
506 <!-- Create HTML single page documentation -->
507 <!-- ====================================================================== -->
509 <target name="htmlsingle" description="Create HTML single page documentation" depends="">
511 <property name="file.target" value="${doc.target.work}/help-onepage.html"/>
512 <call target="uptodate"/>
514 <if test="${not file.target.uptodate}">
515 <property name="xslt.params" value="${xsl.html.params}"/>
516 <property name="xslt.file" value="${xsl.html.file}"/>
517 <property name="xslt.target" value="${file.target}"/>
519 <copy file="${path.user.css}/styles_chm.css" todir="${doc.target.work}"/>
520 <copy file="${path.user.css}/styles_html.css" todir="${doc.target.work}"/>
522 <call target="xsltproc" />
524 </if>
525 </target>
527 <!-- ====================================================================== -->
528 <!-- Create the API documentation -->
529 <!-- ====================================================================== -->
531 <target name="apidoc" depends="GitAPIdoc,TortoiseGitAPIdoc" />
533 <target name="GitAPIdoc">
534 <loadfile file="API\DoxyfileSVN" property="GitDoxyFile" />
535 <echo file="Doxyfile" message="${GitDoxyFile}" />
536 <echo file="Doxyfile" message="HHC_LOCATION=${environment::get-variable('HHLOC')}" append="true" />
537 <mkdir dir="output" />
538 <exec program="doxygen.exe">
539 <arg value="Doxyfile" />
540 </exec>
541 <move file="output\doxygen\html\GitAPI.chm" tofile="output\GitAPI.chm" overwrite="true" />
542 <delete dir="output\doxygen" />
543 <delete file="Doxyfile" />
544 </target>
546 <target name="TortoiseGitAPIdoc">
547 <loadfile file="API\Doxyfile" property="TortoiseGitDoxyFile" />
548 <echo file="Doxyfile" message="${TortoiseGitDoxyFile}" />
549 <echo file="Doxyfile" message="HHC_LOCATION=${environment::get-variable('HHLOC')}" append="true" />
550 <mkdir dir="output" />
551 <exec program="doxygen.exe">
552 <arg value="Doxyfile" />
553 </exec>
554 <move file="output\doxygen\html\TortoiseAPI.chm" tofile="output\TortoiseGitAPI.chm" overwrite="true" />
555 <delete dir="output\doxygen" />
556 <delete file="Doxyfile" />
557 </target>
559 </project>