build_init.xml 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. <?xml version="1.0"?>
  2. <!--
  3. This file is part of the DITA Open Toolkit project.
  4. Copyright 2006 IBM Corporation
  5. See the accompanying LICENSE file for applicable license.
  6. -->
  7. <project name="ditaot-init">
  8. <!-- Read configuration properties -->
  9. <loadproperties>
  10. <javaresource name="application.properties"/>
  11. </loadproperties>
  12. <property file="${dita.dir}/config/org.dita.dost.platform/plugin.properties"/>
  13. <property file="${dita.dir}/config/configuration.properties"/>
  14. <xmlcatalog id="dita.catalog">
  15. <catalogpath path="${dita.plugin.org.dita.base.dir}/catalog-dita.xml"/>
  16. </xmlcatalog>
  17. <taskdef name="pipeline" classname="org.dita.dost.ant.ExtensibleAntInvoker"/>
  18. <taskdef name="dita-ot-echo" classname="org.dita.dost.ant.DITAOTEchoTask"/>
  19. <taskdef name="dita-ot-fail" classname="org.dita.dost.ant.DITAOTFailTask"/>
  20. <taskdef name="dita-ot-copy" classname="org.dita.dost.ant.DITAOTCopy"/>
  21. <taskdef name="job-property" classname="org.dita.dost.ant.JobPropertyTask"/>
  22. <typedef name="isabsolute" classname="org.dita.dost.ant.IsAbsolute"/>
  23. <!-- Deprecated since 3.0 -->
  24. <typedef name="dita-fileset" classname="org.dita.dost.ant.types.JobSourceSet"/>
  25. <typedef name="ditafileset" classname="org.dita.dost.ant.types.JobSourceSet"/>
  26. <typedef name="jobmapper" classname="org.dita.dost.ant.types.JobMapper"/>
  27. <macrodef name="job-helper" >
  28. <attribute name="file"/>
  29. <attribute name="property"/>
  30. <sequential>
  31. <xslt in="${dita.temp.dir}/.job.xml" out="${dita.temp.dir}/@{file}"
  32. style="${dita.plugin.org.dita.base.dir}/xsl/job-helper.xsl"
  33. force="true" taskname="job-helper">
  34. <param name="property" expression="@{property}"/>
  35. <outputproperty name="encoding" value="${file.encoding}"/>
  36. </xslt>
  37. </sequential>
  38. </macrodef>
  39. <target name="build-init"
  40. depends="init-properties,
  41. check-arg,
  42. log-arg"/>
  43. <target name="init-properties">
  44. <property name="default.language" value="en"/>
  45. <property name="generate-debug-attributes" value="true"/>
  46. <property name="processing-mode" value="lax"/>
  47. <tstamp>
  48. <format property="current.date" pattern="yyyyMMddHHmmssSSS"/>
  49. </tstamp>
  50. <property name="base.temp.dir" location="${dita.dir}/temp"/>
  51. <property name="dita.temp.dir" location="${base.temp.dir}${file.separator}temp${current.date}" />
  52. <fail message="dita.temp.dir property must be an absolute path: ${dita.temp.dir}">
  53. <condition>
  54. <not><isabsolute path="${dita.temp.dir}"/></not>
  55. </condition>
  56. </fail>
  57. <property name="output.dir" location="${dita.dir}/out" />
  58. <condition property="dita.output.dir" value="${dita.temp.dir}${file.separator}${temp.output.dir.name}" else="${output.dir}">
  59. <isset property="temp.output.dir.name"/>
  60. </condition>
  61. <property environment="env" />
  62. </target>
  63. <!-- property value validation begin -->
  64. <target name="check-arg"
  65. description="Validate and init input arguments">
  66. <!-- begin to check input parameters -->
  67. <dita-ot-fail id="DOTA003F">
  68. <condition>
  69. <and>
  70. <isset property="args.xsl" />
  71. <not>
  72. <available file="${args.xsl}" type="file" />
  73. </not>
  74. </and>
  75. </condition>
  76. <param name="1" location="${args.xsl}"/>
  77. </dita-ot-fail>
  78. <!-- end to check input parameters -->
  79. <!-- begin to init required parameters -->
  80. <condition property="filter-stage" value="early">
  81. <not>
  82. <isset property="filter-stage"/>
  83. </not>
  84. </condition>
  85. <condition property="filter-on-parse" value="true">
  86. <and>
  87. <equals arg1="${filter-stage}" arg2="early"/>
  88. </and>
  89. </condition>
  90. <!-- append a '.' to out.ext if args.outext not contains '.' -->
  91. <condition property="out.ext" value=".${args.outext}">
  92. <and>
  93. <isset property="args.outext" />
  94. <not>
  95. <contains string="${args.outext}" substring="." />
  96. </not>
  97. </and>
  98. </condition>
  99. <condition property="out.ext" value="${args.outext}">
  100. <and>
  101. <isset property="args.outext" />
  102. <contains string="${args.outext}" substring="." />
  103. </and>
  104. </condition>
  105. <condition property="args.grammar.cache"
  106. value="yes">
  107. <not>
  108. <isset property="args.grammar.cache" />
  109. </not>
  110. </condition>
  111. <condition property="args.xml.systemid.set"
  112. value="yes">
  113. <not>
  114. <isset property="args.xml.systemid.set" />
  115. </not>
  116. </condition>
  117. <!-- end to init required parameters -->
  118. <!-- create required directories -->
  119. <mkdir dir="${output.dir}" />
  120. <delete dir="${dita.temp.dir}" quiet="false"/>
  121. <mkdir dir="${dita.temp.dir}" />
  122. <condition property="args.logdir" value="${output.dir}">
  123. <not>
  124. <isset property="args.logdir" />
  125. </not>
  126. </condition>
  127. <!-- Validate the xml file or not,default is validation(true)-->
  128. <condition property="validate" value="true">
  129. <not>
  130. <isset property="validate" />
  131. </not>
  132. </condition>
  133. <!-- Related links to output: none, all, nofamily -->
  134. <condition property="include.rellinks" value="">
  135. <equals arg1="${args.rellinks}" arg2="none"/>
  136. </condition>
  137. <condition property="include.rellinks" value="#default sibling friend cousin ancestor descendant sample external other">
  138. <equals arg1="${args.rellinks}" arg2="nofamily"/>
  139. </condition>
  140. <condition property="include.rellinks" value="#default child sibling friend next previous cousin ancestor descendant sample external other">
  141. <or>
  142. <equals arg1="${args.hide.parent.link}" arg2="yes"/>
  143. <equals arg1="${args.rellinks}" arg2="noparent"/>
  144. </or>
  145. </condition>
  146. <condition property="include.rellinks" value="#default parent child sibling friend next previous cousin ancestor descendant sample external other">
  147. <or>
  148. <equals arg1="${args.rellinks}" arg2="all"/>
  149. <not><isset property="args.rellinks"/></not>
  150. </or>
  151. </condition>
  152. <!--solution for the output control-->
  153. <condition property="generate.copy.outer" value="1">
  154. <not>
  155. <isset property="generate.copy.outer" />
  156. </not>
  157. </condition>
  158. <condition property="onlytopic.in.map" value="false">
  159. <not>
  160. <isset property="onlytopic.in.map" />
  161. </not>
  162. </condition>
  163. <property name="link-crawl" value="topic"/>
  164. <!--
  165. default value : warn
  166. fail :1a) Fail quickly if files are going to be generated/copied outside of that directory
  167. warn :1b) Complete if files will be generated/copied outside, but log a warning
  168. quiet :1c) Quietly finish with only those files (no warning or error)
  169. -->
  170. <condition property="outer.control" value="warn">
  171. <not>
  172. <isset property="outer.control" />
  173. </not>
  174. </condition>
  175. <condition property="inner.transform">
  176. <equals arg1="${generate.copy.outer}" arg2="1"/>
  177. </condition>
  178. <condition property="old.transform">
  179. <equals arg1="${generate.copy.outer}" arg2="3"></equals>
  180. </condition>
  181. <condition property="conserve-memory" value="false">
  182. <not><isset property="conserve-memory"/></not>
  183. </condition>
  184. </target>
  185. <target name="log-arg">
  186. <condition property="xml.parser" value="XMLReader ${org.xml.sax.driver}">
  187. <and>
  188. <isset property="org.xml.sax.driver"/>
  189. <not><isset property="xml.parser"/></not>
  190. </and>
  191. </condition>
  192. <condition property="xml.parser" value="Xerces">
  193. <and>
  194. <available classname="org.apache.xerces.parsers.SAXParser"/>
  195. <not><isset property="xml.parser"/></not>
  196. </and>
  197. </condition>
  198. <condition property="xml.parser" value="Xerces in Sun JDK 1.5">
  199. <and>
  200. <available classname="com.sun.org.apache.xerces.internal.parsers.SAXParser"/>
  201. <not><isset property="xml.parser"/></not>
  202. </and>
  203. </condition>
  204. <condition property="xml.parser" value="Crimson">
  205. <and>
  206. <available classname="org.apache.crimson.parser.XMLReaderImpl"/>
  207. <not><isset property="xml.parser"/></not>
  208. </and>
  209. </condition>
  210. <condition property="xslt.parser" value="Saxon" else="Xalan">
  211. <or>
  212. <available classname="net.sf.saxon.StyleSheet"/>
  213. <available classname="net.sf.saxon.Transform"/>
  214. </or>
  215. </condition>
  216. <condition property="collator" value="ICU" else="JDL">
  217. <available classname="com.ibm.icu.text.Collator"/>
  218. </condition>
  219. <!-- output parameters info -->
  220. <echo level="info">*****************************************************************</echo>
  221. <echo level="info">* basedir = ${basedir}</echo>
  222. <echo level="info">* dita.dir = ${dita.dir}</echo>
  223. <!--echo level="info">* input = ${args.input}</echo-->
  224. <echo level="info">* transtype = ${transtype}</echo>
  225. <echo level="info">* tempdir = ${dita.temp.dir}</echo>
  226. <echo level="info">* outputdir = ${output.dir}</echo>
  227. <echo level="info">* clean.temp = ${clean.temp}</echo>
  228. <echo level="info">* DITA-OT version = ${otversion}</echo>
  229. <echo level="info">* XML parser = ${xml.parser}</echo>
  230. <echo level="info">* XSLT processor = ${xslt.parser}</echo>
  231. <echo level="info">* collator = ${collator}</echo>
  232. <echo level="info">*****************************************************************</echo>
  233. <echoproperties regex="^(arg|preprocess|dita)" taskname="echo" failonerror="false"/>
  234. <echo level="info">*****************************************************************</echo>
  235. </target>
  236. </project>