build.xml 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project default="generate.all"
  3. basedir="."
  4. name="org.yakindu.sct.doc.user"
  5. xmlns:if="ant:if"
  6. xmlns:unless="ant:unless"
  7. xmlns:artifact="antlib:org.eclipse.aether.ant">
  8. <property file="build.properties" />
  9. <property file="local.properties" />
  10. <!-- The documentation source files are located here: -->
  11. <property name="src.basename" value="documentation" />
  12. <property name="src.dir.name" value="src" />
  13. <property name="css.dir.name" value="css" />
  14. <property name="img.dir.name" value="images" />
  15. <property name="src.dir" location="${basedir}/${src.dir.name}" />
  16. <property name="css.dir" location="${basedir}/${css.dir.name}" />
  17. <property name="img.dir" location="${src.dir}/${img.dir.name}" />
  18. <!-- Location of source file with XIncludes resolved: -->
  19. <property name="res.basename" value="${src.basename}.resolved" />
  20. <property name="res.dir.name" value="src-gen" />
  21. <!-- Target directory names and directories for various output formats: -->
  22. <property name="help.dir.name" value="help" />
  23. <property name="html.dir.name" value="html" />
  24. <property name="pdf.dir.name" value="pdf" />
  25. <property name="epub.dir.name" value="epub" />
  26. <property name="help.dir" location="${basedir}/${help.dir.name}" />
  27. <property name="html.dir" location="${basedir}/${html.dir.name}" />
  28. <property name="pdf.dir" location="${basedir}/${pdf.dir.name}" />
  29. <property name="epub.dir" location="${basedir}/${epub.dir.name}" />
  30. <!-- Libraries used by Ant tasks: -->
  31. <property name="lib.dir.name" value="lib" />
  32. <property name="lib.dir" location="${basedir}/${lib.dir.name}" />
  33. <!-- Aether Ant Tasks configuration -->
  34. <property name="aether.jar.version" value="1.0.0.v20140518" />
  35. <property name="aether.jar.checksum"
  36. value="9008c0c96390eacc0f7fdde542dacbd921f942dcd5c139465e21f8b583942edb995304025bb436cfeeea0b89698ef9dfccf8a027da68cd079669adea8cca381f" />
  37. <property name="aether.jar.src"
  38. value="http://search.maven.org/remotecontent?filepath=org/eclipse/aether/aether-ant-tasks/${aether.jar.version}/aether-ant-tasks-${aether.jar.version}-uber.jar" />
  39. <property name="aether.jar.file" value="${lib.dir}/aether-ant-tasks-uber.jar" />
  40. <!-- Wikitext download configuration -->
  41. <property name="wikitext.zip.version" value="1.0.0.v20140518" />
  42. <property name="wikitext.zip.checksum"
  43. value="a4c9c3c4c6ff21dea10368b2085021088294b5fd7fc19e445d9670cbdb00390e4095fcccca29d6e58fc42d067af49ef86d6f03f7811d47cf212fe8e2418775b9" />
  44. <!--
  45. <property name="wikitext.zip.src"
  46. value="http://www.eclipse.org/downloads/download.php?file=/mylyn/snapshots/nightly/docs/wikitext-standalone-latest.zip" />
  47. -->
  48. <property name="wikitext.zip.src" value="file:///${basedir}/externals/wikitext.zip" />
  49. <property name="wikitext.zip.file" value="${lib.dir}/wikitext.zip" />
  50. <property name="wikitext.basename" value="wikitext-standalone" />
  51. <property name="wikitext.version" value="2.8.0-SNAPSHOT" />
  52. <!-- Remove generated stuff: -->
  53. <target name="clean">
  54. <delete includeemptydirs="true" failonerror="false">
  55. <fileset dir="${res.dir.name}" />
  56. <fileset dir="${basedir}" defaultexcludes="false">
  57. <include name="${help.dir.name}/**" />
  58. <include name="${html.dir.name}/**" />
  59. <include name="${pdf.dir.name}/**" />
  60. <include name="${epub.dir.name}/**" />
  61. </fileset>
  62. </delete>
  63. </target>
  64. <!-- Download and unpack the wikitext standalone distribution. Unfortunately it is currently available as a nightly build only. -->
  65. <target name="wikitext.download" description="Download and unpack the wikitext standalone distribution.">
  66. <condition property="wikitext.zip.file.exists">
  67. <available file="${wikitext.zip.file}" />
  68. </condition>
  69. <sequential unless:set="wikitext.zip.file.exists">
  70. <mkdir dir="${lib.dir}" />
  71. <get src="${wikitext.zip.src}"
  72. dest="${wikitext.zip.file}"
  73. skipexisting="true"
  74. usetimestamp="true"
  75. verbose="true" />
  76. <fail message="Checksum mismatch for ${wikitext.zip.file}. Please delete it and rerun ant to redownload.">
  77. <condition>
  78. <not>
  79. <checksum file="${wikitext.zip.file}"
  80. algorithm="SHA-512"
  81. property="${wikitext.zip.checksum}"
  82. verifyproperty="checksum.matches" />
  83. </not>
  84. </condition>
  85. </fail>
  86. <unzip dest="${lib.dir}" src="${wikitext.zip.file}" />
  87. </sequential>
  88. </target>
  89. <!-- Resolves the necessary dependencies: -->
  90. <target name="init.wikitext"
  91. description="Resolves the necessary wikitext dependencies."
  92. depends="wikitext.download">
  93. <property name="wikitext.dir" location="${lib.dir}/${wikitext.basename}-${wikitext.version}" />
  94. <path id="wikitext.classpath">
  95. <fileset dir="${wikitext.dir}">
  96. <include name="*.jar" />
  97. </fileset>
  98. </path>
  99. </target>
  100. <!-- Generates the documentation in all supported formats. -->
  101. <target name="generate.all"
  102. description="Generates the documentation in all supported formats."
  103. depends="generate.eclipsehelp" />
  104. <!-- Generates the documentation as Eclipse help. -->
  105. <target name="generate.eclipsehelp"
  106. description="Generates the documentation as Eclipse help from the textile (wikitext) sources."
  107. depends="init.wikitext">
  108. <wikitext.conversion src.dir="${src.dir.name}"
  109. src.file.name="${src.basename}.textile"
  110. dst.dir="${help.dir.name}"
  111. dst.file.name="---"
  112. style="---" />
  113. </target>
  114. <!-- Converts a Textile document into Eclipsehelp format. Produces an HTML document and a corresponding toc.xml -->
  115. <macrodef name="wikitext.conversion"
  116. description="Converts a textile document into a target format. Produces an HTML document and a corresponding toc.xml">
  117. <attribute name="src.dir" />
  118. <attribute name="src.file.name" />
  119. <attribute name="dst.dir" />
  120. <attribute name="dst.file.name" />
  121. <attribute name="style" />
  122. <sequential>
  123. <basename property="src.file.basename" file="@{src.file.name}" suffix=".textile" />
  124. <taskdef classpathref="wikitext.classpath"
  125. resource="org/eclipse/mylyn/wikitext/core/ant/tasks.properties" />
  126. <wikitext-to-eclipse-help markupLanguage="Textile"
  127. multipleOutputFiles="false"
  128. navigationImages="true"
  129. formatoutput="true"
  130. validate="true"
  131. failOnValidationError="true"
  132. failOnValidationWarning="false"
  133. title="YAKINDU Statechart Tools"
  134. helpPrefix="@{dst.dir}">
  135. <fileset dir="@{src.dir}">
  136. <include name="@{src.file.name}" />
  137. </fileset>
  138. <stylesheet url="css/style.css" />
  139. </wikitext-to-eclipse-help>
  140. <!-- Files have been generated in the source directory, which is bad practice. Move them to the destination
  141. directory: -->
  142. <move todir="@{dst.dir}">
  143. <fileset dir="${src.dir}">
  144. <include name="${src.file.basename}.html" />
  145. <include name="${src.file.basename}-toc.xml" />
  146. </fileset>
  147. </move>
  148. <!-- Copy the CSS files to the destination directory: -->
  149. <copy todir="@{dst.dir}/${css.dir.name}">
  150. <fileset dir="${css.dir}">
  151. <include name="*" />
  152. </fileset>
  153. </copy>
  154. <!-- Copy the image files to the destination directory: -->
  155. <copy todir="@{dst.dir}/${img.dir.name}">
  156. <fileset dir="${img.dir}">
  157. <include name="*" />
  158. </fileset>
  159. </copy>
  160. </sequential>
  161. </macrodef>
  162. </project>