build.xml 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <project default="help" name="mainbuild">
  2. <dirname property="ant.file.dir" file="${ant.file.mainbuild}"/>
  3. <loadproperties srcFile="${ant.file.dir}/build.properties"/>
  4. <property name="webhelp.include.search.tab" value="true"/>
  5. <property name="extensions.dir" value="${ant.file.dir}/../extensions"/>
  6. <path id="classpath">
  7. <pathelement location="${extensions.dir}/webhelpindexer.jar"/>
  8. <pathelement location="${extensions.dir}/lucene-analyzers-3.0.0.jar"/>
  9. <pathelement location="${extensions.dir}/lucene-core-3.0.0.jar"/>
  10. <pathelement location="${extensions.dir}/tagsoup-1.2.1.jar"/>
  11. </path>
  12. <condition property="perform-validation-dtd">
  13. <equals arg1="${validate-against-dtd}" arg2="true"/>
  14. </condition>
  15. <condition property="do-search-indexing">
  16. <equals arg1="${webhelp.include.search.tab}" arg2="true"/>
  17. </condition>
  18. <target name="validate" if="perform-validation-dtd">
  19. <xmlvalidate file="${input-xml}" classname="org.apache.xerces.parsers.SAXParser"/>
  20. </target>
  21. <target name="chunk" depends="clean">
  22. <mkdir dir="${output-dir}"/>
  23. <tempfile destdir="${output-dir}" deleteonexit="true" property="xincluded-profiled.xml"/>
  24. <tempfile destdir="${output-dir}" deleteonexit="true" property="dummy.html"/>
  25. <xslt
  26. in="${input-xml}"
  27. out="${xincluded-profiled.xml}"
  28. style="${ant.file.dir}/../profiling/profile.xsl"
  29. classpath="${xercesImpl.jar}">
  30. <sysproperty key="org.apache.xerces.xni.parser.XMLParserConfiguration"
  31. value="org.apache.xerces.parsers.XIncludeParserConfiguration"/>
  32. <param name="profile.arch" expression="${profile.arch}" if="profile.arch"/>
  33. <param name="profile.audience" expression="${profile.audience}" if="profile.audience"/>
  34. <param name="profile.condition" expression="${profile.condition}" if="profile.condition"/>
  35. <param name="profile.conformance" expression="${profile.conformance}" if="profile.conformance"/>
  36. <param name="profile.lang" expression="${profile.lang}" if="profile.lang"/>
  37. <param name="profile.os" expression="${profile.os}" if="profile.os"/>
  38. <param name="profile.revision" expression="${profile.revision}" if="profile.revision"/>
  39. <param name="profile.revisionflag" expression="${profile.revisionflag}" if="profile.revisionflag"/>
  40. <param name="profile.role" expression="${profile.role}" if="profile.role"/>
  41. <param name="profile.security" expression="${profile.security}" if="profile.security"/>
  42. <param name="profile.status" expression="${profile.status}" if="profile.status"/>
  43. <param name="profile.userlevel" expression="${profile.userlevel}" if="profile.userlevel"/>
  44. <param name="profile.vendor" expression="${profile.vendor}" if="profile.vendor"/>
  45. <param name="profile.wordsize" expression="${profile.wordsize}" if="profile.wordsize"/>
  46. <param name="profile.attribute" expression="${profile.attribute}" if="profile.attribute"/>
  47. <param name="profile.value" expression="${profile.value}" if="profile.value"/>
  48. </xslt>
  49. <xslt
  50. in="${xincluded-profiled.xml}"
  51. out="${dummy.html}"
  52. style="${stylesheet-path}"
  53. scanincludeddirectories="false"
  54. classpath="${xslt-processor-classpath}">
  55. <param name="webhelp.include.search.tab" expression="${webhelp.include.search.tab}"
  56. if="webhelp.include.search.tab"/>
  57. <param name="output_file_name" expression="${output_file_name}"/>
  58. <param name="webhelp.base.dir" expression="${output-dir}" if="output-dir"/>
  59. <param name="webhelp.indexer.language" expression="${webhelp.indexer.language}" if="webhelp.indexer.language"/>
  60. <param name="branding" expression="${branding}" if="branding"/>
  61. <param name="brandname" expression="${brandname}" if="brandname"/>
  62. <param name="admon.graphics" expression="${admon.graphics}" if="admon.graphics"/>
  63. <param name="suppress.footer.navigation" expression="${suppress.footer.navigation}" if="suppress.footer.navigation"/>
  64. </xslt>
  65. <!-- Copy common content such as js files of tree, css etc. to template folder. They will be copied to doc folder. They are NOT page specific! -->
  66. <copy todir="${output-dir}">
  67. <fileset dir="${ant.file.dir}/template">
  68. <include name="**/*"/>
  69. <exclude name="**/search/**"/>
  70. </fileset>
  71. </copy>
  72. <!-- Very simple-minded copy to handle the source document's images -->
  73. <!-- TODO: Look at html help code that produces a manifest file...list of images -->
  74. <!-- Customize webhelp.xsl to produce ant file to copy images actually used? -->
  75. <dirname property="input-images-basedir" file="${input-xml}"/>
  76. <copy todir="${output-dir}" failonerror="false">
  77. <fileset dir="${input-images-basedir}" includes="${input-images-dirs}" />
  78. </copy>
  79. </target>
  80. <target name="index" if="do-search-indexing">
  81. <copy todir="${output-dir}/search">
  82. <fileset dir="${ant.file.dir}/template/search">
  83. <include name="**/*"/>
  84. <exclude name="**/*.props"/>
  85. <exclude name="**/stemmers/*"/>
  86. </fileset>
  87. </copy>
  88. <!-- We separate this out so we only copy the stopwords list and stemmer for the indexer language -->
  89. <copy todir="${output-dir}/search">
  90. <fileset dir="${ant.file.dir}/template/search">
  91. <include name="**/default.props"/>
  92. <include name="**/punctuation.props"/>
  93. <include name="**/${webhelp.indexer.language}*.props"/>
  94. <include name="**/stemmers/${webhelp.indexer.language}_stemmer.js"/>
  95. </fileset>
  96. </copy>
  97. <echo>Indexing html files in ${output-dir}</echo>
  98. <java classname="com.nexwave.nquindexer.IndexerMain" fork="true">
  99. <sysproperty key="htmlDir" value="${output-dir}"/>
  100. <sysproperty key="indexerLanguage" value="${webhelp.indexer.language}"/>
  101. <sysproperty key="htmlExtension" value="${html.extension}"/>
  102. <sysproperty key="doStem" value="${enable.stemming}"/>
  103. <sysproperty key="tocFile" value="${toc.file}"/>
  104. <sysproperty key="indexerExcludedFiles" value="${indexer-excluded-files}"/>
  105. <!--TagSoup SAX Parser for parsing even the bad html contents. see
  106. http://sourceforge.net/tracker/?func=detail&aid=3401185&group_id=21935&atid=373750-->
  107. <sysproperty key="org.xml.sax.driver" value="org.ccil.cowan.tagsoup.Parser"/>
  108. <sysproperty key="javax.xml.parsers.SAXParserFactory" value="org.ccil.cowan.tagsoup.jaxp.SAXFactoryImpl"/>
  109. <!-- Uncomment the following if Xerces is your preference as the SAX XML Parser. Note that the indexing will fail with Xerces
  110. if the html files are not XML-conformance -->
  111. <!--sysproperty key="org.xml.sax.driver" value="org.apache.xerces.parsers.SAXParser"/>
  112. <sysproperty key="javax.xml.parsers.SAXParserFactory" value="org.apache.xerces.jaxp.SAXParserFactoryImpl"/-->
  113. <!-- Debug the indexer on port 5005 via remote-debug -->
  114. <!--jvmarg line="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"/-->
  115. <classpath>
  116. <path refid="classpath"/>
  117. <pathelement location="${xercesImpl.jar}"/>
  118. <pathelement location="${xml-apis.jar}"/>
  119. <!-- <pathelement location="/usr/share/java/xercesImpl.jar"/> -->
  120. <!-- <pathelement location="/usr/share/java/xml-apis.jar"/> -->
  121. <!-- Gentoo Linux friendly default classpath-->
  122. <pathelement location="/usr/share/xerces-2/lib/xercesImpl.jar"/>
  123. <pathelement location="/usr/share/xml-commons/lib/xml-apis.jar"/>
  124. </classpath>
  125. </java>
  126. <delete>
  127. <fileset dir="${output-dir}/search" includes="*.props"/>
  128. </delete>
  129. </target>
  130. <target name="webhelp" depends="validate,chunk,index"/>
  131. <target name="clean">
  132. <delete dir="${output-dir}"/>
  133. </target>
  134. <target name="help">
  135. <echo>
  136. Usage:
  137. webhelp: Generates the document in webhelp format and indexes the content.
  138. clean: Deletes webhelp output directory.
  139. index: Indexes the content.
  140. </echo>
  141. </target>
  142. </project>