build.xml 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592
  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. <!-- Runtime properties:
  9. website.local.files: Generates website as local files
  10. -->
  11. <!-- Include platform-specific or machine-specific properties, if any. -->
  12. <property file="local.properties" />
  13. <!-- The documentation source files located beneath this directory.
  14. They may be structured into folders of arbitrary depth. -->
  15. <property name="src.dir" value="src" />
  16. <!-- CSS files are located here. -->
  17. <property name="css.dir" value="css" />
  18. <!-- Root CSS file to be referenced by the generated HTML files. -->
  19. <property name="css.root.file" value="style.css" />
  20. <!-- Javascript files are located here. -->
  21. <property name="js.dir" value="js" />
  22. <!-- Image files reside in subdirectories with the following name: -->
  23. <property name="img.dir" value="images" />
  24. <!-- Target directories for various output formats: -->
  25. <property name="help.dir" value="help" />
  26. <property name="website.dir" value="website" />
  27. <property name="pdf.dir" value="pdf" />
  28. <property name="epub.dir" value="epub" />
  29. <!-- Libraries used by various Ant tasks are located here: -->
  30. <property name="lib.dir" location="${basedir}/lib" />
  31. <!-- Aether Ant Tasks configuration -->
  32. <property name="aether.jar.version" value="1.0.1.v20141111" />
  33. <property name="aether.jar.checksum"
  34. value="195ea2e75242b2a4919463e8e95f57bd3cfcfeb3920879fca5b680255dba4a22b9ec0d53138e608d3be94d80a444aa9b7b8522e5bf01660f0dfb4688dae998dd" />
  35. <property name="aether.jar.src"
  36. value="http://search.maven.org/remotecontent?filepath=org/eclipse/aether/aether-ant-tasks/${aether.jar.version}/aether-ant-tasks-${aether.jar.version}-uber.jar" />
  37. <property name="aether.jar.file" value="${lib.dir}/aether-ant-tasks-uber.jar" />
  38. <!-- MyLyn Wikitext version: -->
  39. <property name="wikitext.version" value="3.0.20" />
  40. <!-- Remove generated stuff. The "lib" directory will not be deleted. Remove it manually, if you have to. -->
  41. <target name="clean">
  42. <delete includeemptydirs="true" failonerror="false">
  43. <fileset dir="${basedir}" defaultexcludes="false">
  44. <include name="${help.dir}/**" />
  45. <include name="${website.dir}/**" />
  46. <include name="${pdf.dir}/**" />
  47. <include name="${epub.dir}/**" />
  48. </fileset>
  49. <fileset dir="${src-merged.dir}" />
  50. </delete>
  51. </target>
  52. <!-- Aether Ant Tasks are used to access Maven dependencies from an Ant build. It is initialized by downloading
  53. the Aether Ant Tasks JAR to the library folder, if needed. The downloaded JAR will not be removed by the
  54. "clean" target. If the JAR is present, a typedef will make Aether Ant Tasks' elements available in the Ant
  55. build file. -->
  56. <target name="init.aether"
  57. description="Initializes Aether Ant Tasks JAR by downloading the JAR and defining a type.">
  58. <condition property="target.exists">
  59. <available file="${aether.jar.file}" />
  60. </condition>
  61. <sequential unless:set="target.exists">
  62. <mkdir dir="${lib.dir}" />
  63. <get src="${aether.jar.src}"
  64. dest="${aether.jar.file}"
  65. skipexisting="true"
  66. usetimestamp="true"
  67. verbose="true" />
  68. <fail message="Checksum mismatch for ${aether.jar.file}. Please delete it and rerun ant to redownload.">
  69. <condition>
  70. <not>
  71. <checksum file="${aether.jar.file}"
  72. algorithm="SHA-512"
  73. property="${aether.jar.checksum}"
  74. verifyproperty="checksum.matches" />
  75. </not>
  76. </condition>
  77. </fail>
  78. </sequential>
  79. <path id="aether-ant-tasks.classpath" path="${aether.jar.file}" />
  80. <typedef resource="org/eclipse/aether/ant/antlib.xml"
  81. uri="antlib:org.eclipse.aether.ant"
  82. classpathref="aether-ant-tasks.classpath" />
  83. </target>
  84. <!-- Resolves the Wikitext dependencies: -->
  85. <target name="init.wikitext" description="Resolves the Wikitext dependencies." depends="init.aether">
  86. <!-- Classpath for MyLyn Wikitext: -->
  87. <artifact:resolve>
  88. <artifact:dependencies>
  89. <dependency groupId="org.eclipse.mylyn.docs"
  90. artifactId="org.eclipse.mylyn.wikitext"
  91. version="${wikitext.version}"
  92. scope="compile" />
  93. </artifact:dependencies>
  94. <path refid="wikitext.classpath" />
  95. <files dir="${lib.dir}/bin" layout="{groupId}/{artifactId}-{baseVersion}.{extension}" />
  96. </artifact:resolve>
  97. <!-- Sources of MyLyn Wikitext: -->
  98. <artifact:resolve>
  99. <artifact:dependencies>
  100. <dependency groupId="org.eclipse.mylyn.docs"
  101. artifactId="org.eclipse.mylyn.wikitext"
  102. version="${wikitext.version}"
  103. scope="compile"
  104. classifier="sources" />
  105. </artifact:dependencies>
  106. <files dir="${lib.dir}/src" layout="{groupId}/{artifactId}-{baseVersion}-{classifier}.{extension}" />
  107. </artifact:resolve>
  108. <!-- Classpath for MyLyn Wikitext's Textile support: -->
  109. <artifact:resolve>
  110. <artifact:dependencies>
  111. <dependency groupId="org.eclipse.mylyn.docs"
  112. artifactId="org.eclipse.mylyn.wikitext.textile"
  113. version="${wikitext.version}"
  114. scope="compile" />
  115. </artifact:dependencies>
  116. <path refid="wikitext.textile.classpath" />
  117. <files dir="${lib.dir}/bin" layout="{groupId}/{artifactId}-{baseVersion}.{extension}" />
  118. </artifact:resolve>
  119. <!-- Sources of MyLyn Wikitext's Textile support: -->
  120. <artifact:resolve>
  121. <artifact:dependencies>
  122. <dependency groupId="org.eclipse.mylyn.docs"
  123. artifactId="org.eclipse.mylyn.wikitext.textile"
  124. version="${wikitext.version}"
  125. scope="compile"
  126. classifier="sources" />
  127. </artifact:dependencies>
  128. <files dir="${lib.dir}/src" layout="{groupId}/{artifactId}-{baseVersion}-{classifier}.{extension}" />
  129. </artifact:resolve>
  130. <!-- Classpath for MyLyn Wikitext's Ant support: -->
  131. <artifact:resolve>
  132. <artifact:dependencies>
  133. <dependency groupId="org.eclipse.mylyn.docs"
  134. artifactId="org.eclipse.mylyn.wikitext.ant"
  135. version="${wikitext.version}"
  136. scope="compile" />
  137. </artifact:dependencies>
  138. <path refid="wikitext.ant.classpath" />
  139. </artifact:resolve>
  140. <!-- Classpath for Wikitext: -->
  141. <path id="wikitext.all.classpath">
  142. <path refid="wikitext.classpath" />
  143. <path refid="wikitext.textile.classpath" />
  144. <path refid="wikitext.ant.classpath" />
  145. </path>
  146. <!-- Classpath for YAKINDU Docs: -->
  147. <artifact:resolve>
  148. <artifact:dependencies>
  149. <dependency groupId="org.yakindu.docs"
  150. artifactId="yakindu-docs-maven-plugin"
  151. version="0.0.1-SNAPSHOT"
  152. scope="compile" />
  153. </artifact:dependencies>
  154. <path refid="org.yakindu.docs.classpath" />
  155. </artifact:resolve>
  156. </target>
  157. <!-- Generates the documentation in all supported formats. -->
  158. <target name="generate.all"
  159. description="Generates the documentation in all supported formats."
  160. depends="generate.eclipsehelp, generate.website" />
  161. <!-- Generates the documentation as Eclipse help. -->
  162. <target name="generate.eclipsehelp"
  163. description="Generates the documentation as separate Eclipse help (HTML) files from their respective textile (wikitext) sources."
  164. depends="init.wikitext">
  165. <sequential>
  166. <taskdef classpathref="wikitext.all.classpath" resource="org/eclipse/mylyn/wikitext/ant/tasks.properties" />
  167. <!-- Textile source files to turn into HTML: -->
  168. <fileset id="fileset.eclipsehelp" dir="${src.dir}">
  169. <include name="tutorials/tutorials.textile" />
  170. <include name="user-guide/overview.textile" />
  171. <include name="user-guide/installation.textile" />
  172. <include name="user-guide/editing_statecharts.textile" />
  173. <include name="user-guide/simulating_statecharts.textile" />
  174. <include name="user-guide/c-domain.textile" />
  175. <!-- include name="user-guide/typescript-domain.textile" / -->
  176. <include name="user-guide/statechart_language.textile" />
  177. <include name="user-guide/code_generation_intro.textile" />
  178. <include name="user-guide/code_generation_c.textile" />
  179. <include name="user-guide/code_generation_cpp.textile" />
  180. <include name="user-guide/code_generation_java.textile" />
  181. <include name="user-guide/code_generation_statechart_image.textile" />
  182. <include name="user-guide/code_generation_custom.textile" />
  183. <include name="user-guide/generating_code_headless.textile" />
  184. <include name="user-guide/sctunit.textile" />
  185. <include name="user-guide/search_and_navigate.textile" />
  186. <!-- <include name="user-guide/glossary.textile" /> -->
  187. </fileset>
  188. <!-- Check whether we have all the expected textile source files – no more, no less: -->
  189. <fail message="Number of textile source file(s) doesn't match.">
  190. <condition>
  191. <resourcecount refid="fileset.eclipsehelp" when="ne" count="16" />
  192. </condition>
  193. </fail>
  194. <!-- Convert textile source files to HTML: -->
  195. <wikitext-to-eclipse-help markupLanguage="Textile"
  196. multipleOutputFiles="false"
  197. navigationImages="true"
  198. formatoutput="true"
  199. validate="true"
  200. failOnValidationError="true"
  201. failOnValidationWarning="true"
  202. sourceEncoding="UTF-8"
  203. title="YAKINDU Statechart Tools"
  204. helpPrefix="${help.dir}">
  205. <fileset refid="fileset.eclipsehelp" />
  206. <stylesheet url="../${css.dir}/${css.root.file}" />
  207. </wikitext-to-eclipse-help>
  208. <!-- Files have been generated in the source directory, which is bad practice. Move them to the destination
  209. directory: -->
  210. <move todir="${help.dir}" flatten="no" verbose="no">
  211. <fileset dir="${src.dir}">
  212. <include name="**/*.html" />
  213. <include name="**/*-toc.xml" />
  214. </fileset>
  215. </move>
  216. <!-- Add HTML META element for Internet Explorer :-( -->
  217. <replaceregexp byline="false"
  218. match='(\s*)(&lt;title&gt;)'
  219. replace='\1&lt;meta http-equiv="X-UA-Compatible" content="IE=edge"/&gt;\1\2'>
  220. <fileset dir="${help.dir}">
  221. <include name="**/*.html" />
  222. </fileset>
  223. </replaceregexp>
  224. <!-- Add HTML META element to support viewport scaling -->
  225. <replaceregexp byline="false"
  226. match='(\s*)(&lt;title&gt;)'
  227. replace='\1&lt;meta name="viewport" content="width=device-width, initial-scale=1.0"/&gt;\1\2'>
  228. <fileset dir="${help.dir}">
  229. <include name="**/*.html" />
  230. </fileset>
  231. </replaceregexp>
  232. <!-- Add CSS classes "eclipsehelp" and "body-container" to BODY element and
  233. nest a DIV child with CSS class "primary" into the BODY element. -->
  234. <replaceregexp byline="true"
  235. match='&lt;body&gt;'
  236. replace='&lt;body class="eclipsehelp body-container"&gt;&lt;div class="primary"&gt;'>
  237. <fileset dir="${help.dir}">
  238. <include name="**/*.html" />
  239. </fileset>
  240. </replaceregexp>
  241. <replaceregexp byline="true" match='&lt;/body&gt;' replace='&lt;/div&gt;&lt;/body&gt;'>
  242. <fileset dir="${help.dir}">
  243. <include name="**/*.html" />
  244. </fileset>
  245. </replaceregexp>
  246. <!-- Remove H1 headings produced by "early separators" -->
  247. <replaceregexp byline="false"
  248. flags="g"
  249. match='&lt;h1 id=".+" style="%EARLY_SEPARATOR%"&gt;.*&lt;/h1&gt;'
  250. replace=''>
  251. <fileset dir="${help.dir}">
  252. <include name="**/*.html" />
  253. </fileset>
  254. </replaceregexp>
  255. <!-- Fix DIV elements -->
  256. <replaceregexp byline="false" flags="g" match='&lt;p&gt;&lt;div(.*)&gt;&lt;/p&gt;' replace='&lt;div\1&gt;'>
  257. <fileset dir="${help.dir}">
  258. <include name="**/*.html" />
  259. </fileset>
  260. </replaceregexp>
  261. <replaceregexp byline="false" flags="g" match='&lt;p&gt;&lt;/div&gt;&lt;/p&gt;' replace='&lt;/div&gt;'>
  262. <fileset dir="${help.dir}">
  263. <include name="**/*.html" />
  264. </fileset>
  265. </replaceregexp>
  266. <!-- Validate the generated and modified HTML: -->
  267. <xmlvalidate failonerror="yes" lenient="yes" warn="no">
  268. <fileset dir="${help.dir}" includes="**/*.html" />
  269. <attribute name="http://xml.org/sax/features/validation" value="false" />
  270. <attribute name="http://apache.org/xml/features/validation/schema" value="false" />
  271. <attribute name="http://apache.org/xml/features/validation/schema-full-checking" value="false" />
  272. <attribute name="http://apache.org/xml/features/validation/warn-on-undeclared-elemdef" value="false" />
  273. <attribute name="http://apache.org/xml/features/validation/dynamic" value="false" />
  274. <attribute name="http://apache.org/xml/features/nonvalidating/load-dtd-grammar" value="false" />
  275. <attribute name="http://apache.org/xml/features/nonvalidating/load-external-dtd" value="false" />
  276. <attribute name="http://xml.org/sax/features/namespaces" value="false" />
  277. <attribute name="http://xml.org/sax/features/external-general-entities" value="false" />
  278. <attribute name="http://xml.org/sax/features/external-parameter-entities" value="false" />
  279. <attribute name="http://xml.org/sax/features/resolve-dtd-uris" value="false" />
  280. <attribute name="http://xml.org/sax/features/use-entity-resolver2" value="false" />
  281. <attribute name="http://xml.org/sax/features/namespace-prefixes" value="false" />
  282. <attribute name="http://xml.org/sax/features/namespaces" value="false" />
  283. </xmlvalidate>
  284. <!-- Copy the CSS files to the destination directory: -->
  285. <copy todir="${help.dir}/${css.dir}">
  286. <fileset dir="${css.dir}">
  287. <include name="*" />
  288. </fileset>
  289. </copy>
  290. <!-- Copy the Javascript files to the destination directory: -->
  291. <copy todir="${help.dir}/${js.dir}">
  292. <fileset dir="${js.dir}">
  293. <include name="*" />
  294. </fileset>
  295. </copy>
  296. <!-- Copy the image files to the destination directory: -->
  297. <copy todir="${help.dir}">
  298. <fileset dir="src">
  299. <include name="**/${img.dir}/*" />
  300. <exclude name="**/${img.dir}/*.xcf" />
  301. </fileset>
  302. </copy>
  303. </sequential>
  304. </target>
  305. <!-- Generates the documentation as various HTML files, each being composed of selected sections. Each part has a
  306. name and a title, and consists of a set of source files. The generated documentation structure looks like this:
  307. website
  308. YSCT-installation.html
  309. YSCT-user-guide.html
  310. YSCT-tutorials.html
  311. css/yakindu.css
  312. css/ysct.css
  313. js/yakindu.js
  314. images/…
  315. -->
  316. <target name="generate.website"
  317. description="Generates the documentation as various HTML files for the website, each being composed of selected sections. Use -Dwebsite.local.files=true to generate the website as local files for preview."
  318. depends="init.wikitext">
  319. <sequential>
  320. <taskdef classpathref="wikitext.all.classpath" resource="org/eclipse/mylyn/wikitext/ant/tasks.properties" />
  321. <!-- Tutorials -->
  322. <create-website-part name="YSCT-tutorials" title="Tutorials">
  323. <textile-files>
  324. <filelist dir="${src.dir}">
  325. <file name="tutorials/tutorials.textile" />
  326. </filelist>
  327. </textile-files>
  328. <image-files>
  329. <fileset dir="${src.dir}">
  330. <include name="tutorials/images/**/*" />
  331. </fileset>
  332. </image-files>
  333. </create-website-part>
  334. <!-- User Guide -->
  335. <create-website-part name="YSCT-user-guide" title="User Guide">
  336. <textile-files>
  337. <filelist dir="${src.dir}">
  338. <file name="user-guide/overview.textile" />
  339. <file name="user-guide/installation.textile" />
  340. <file name="user-guide/editing_statecharts.textile" />
  341. <file name="user-guide/simulating_statecharts.textile" />
  342. <file name="user-guide/c-domain.textile" />
  343. <!-- file name="user-guide/typescript-domain.textile" /-->
  344. <file name="user-guide/statechart_language.textile" />
  345. <file name="user-guide/code_generation_intro.textile" />
  346. <file name="user-guide/code_generation_c.textile" />
  347. <file name="user-guide/code_generation_cpp.textile" />
  348. <file name="user-guide/code_generation_java.textile" />
  349. <file name="user-guide/code_generation_statechart_image.textile" />
  350. <file name="user-guide/code_generation_custom.textile" />
  351. <file name="user-guide/generating_code_headless.textile" />
  352. <file name="user-guide/sctunit.textile" />
  353. <file name="user-guide/search_and_navigate.textile" />
  354. <!-- file name="user-guide/glossary.textile" / -->
  355. </filelist>
  356. </textile-files>
  357. <image-files>
  358. <fileset dir="${src.dir}">
  359. <include name="user-guide/images/**/*" />
  360. </fileset>
  361. </image-files>
  362. </create-website-part>
  363. </sequential>
  364. </target>
  365. <!-- Creates a certain part of the HTML documentation for the website. -->
  366. <macrodef name="create-website-part"
  367. description="Creates a certain part of the HTML documentation for the website.">
  368. <attribute name="name" />
  369. <attribute name="title" />
  370. <element name="textile-files" />
  371. <element name="image-files" />
  372. <sequential>
  373. <!-- The directory for this particular part of the HTML documentation: -->
  374. <local name="work.dir" />
  375. <property name="work.dir" location="${website.dir}" />
  376. <!-- The names of the concatenated documentation files: -->
  377. <local name="index.textile" />
  378. <property name="index.textile" value="@{name}.textile" />
  379. <local name="index.html" />
  380. <property name="index.html" value="@{name}.html" />
  381. <!-- Append those source files that make up the particular piece of documentation: -->
  382. <mkdir dir="${work.dir}" />
  383. <concat destfile="${work.dir}/${index.textile}"
  384. append="false"
  385. overwrite="true"
  386. encoding="UTF-8"
  387. outputencoding="UTF-8"
  388. fixlastline="true"
  389. binary="false"
  390. ignoreempty="true">
  391. <textile-files />
  392. </concat>
  393. <!-- Convert textile source files to Hubspot HTML: -->
  394. <path id="converter.classpath">
  395. <path refid="org.yakindu.docs.classpath" />
  396. <path refid="wikitext.all.classpath" />
  397. </path>
  398. <java classname="org.yakindu.docs.wikitext.TextileToHubspotConverter"
  399. classpathref="converter.classpath"
  400. fork="true"
  401. dir="${basedir}"
  402. failonerror="true">
  403. <arg value="--p1-file" />
  404. <arg value="${src.dir}/website/p1.htmlf" />
  405. <arg value="--contents-template-file" />
  406. <arg value="${src.dir}/website/contents.htmlf" />
  407. <arg value="--p2-file" />
  408. <arg value="${src.dir}/website/p2.htmlf" />
  409. <arg value="--toc-template-file" />
  410. <arg value="${src.dir}/website/toc.htmlf" />
  411. <arg value="--p3-file" />
  412. <arg value="${src.dir}/website/p3.htmlf" />
  413. <arg value="--input" />
  414. <arg value="${work.dir}/${index.textile}" />
  415. <arg value="--output" />
  416. <arg value="${work.dir}/${index.html}" />
  417. <arg value="--property" />
  418. <arg value="${navigation.title}=@{title}" />
  419. </java>
  420. <!-- Replace "<pre><code>" durch "<pre class="prettyprint"><code>": -->
  421. <replaceregexp byline="false"
  422. flags="g"
  423. match='&lt;pre&gt;&lt;code&gt;'
  424. replace='&lt;pre class="prettyprint"&gt;&lt;code&gt;'>
  425. <fileset dir="${work.dir}">
  426. <include name="${index.html}" />
  427. </fileset>
  428. </replaceregexp>
  429. <!-- Replace relative image links by absolute ones for the website, unless we are generating local files: -->
  430. <replaceregexp byline="false"
  431. flags="g"
  432. match='src="images/'
  433. replace='src="http://info.itemis.com/hubfs/yakindu/statechart-tools/documentation/images/'
  434. unless:set="website.local.files">
  435. <fileset dir="${work.dir}">
  436. <include name="${index.html}" />
  437. </fileset>
  438. </replaceregexp>
  439. <!-- If the generated code contains a table with the ID "updaterepositories", replace it by a
  440. "call-to-action" button on the website: -->
  441. <replaceregexp byline="false" flags="s" replace="${website.calltoaction.download}">
  442. <regexp pattern='&lt;table id="updaterepositories"&gt;.*&lt;/table&gt;' />
  443. <fileset dir="${work.dir}">
  444. <include name="${index.html}" />
  445. </fileset>
  446. </replaceregexp>
  447. <!-- Fix links: -->
  448. <adjust-website-document-links document.dir.name="tutorials"
  449. work.dir="${work.dir}"
  450. html.file="${index.html}" />
  451. <adjust-website-document-links document.dir.name="user-guide"
  452. work.dir="${work.dir}"
  453. html.file="${index.html}" />
  454. <!-- Fix "pro-feature" elements -->
  455. <replaceregexp byline="false"
  456. flags="g"
  457. match='&lt;p&gt;&lt;div class="pro-feature"&gt;&lt;/p&gt;'
  458. replace='&lt;div class="pro-feature"&gt;'>
  459. <fileset dir="${work.dir}">
  460. <include name="${index.html}" />
  461. </fileset>
  462. </replaceregexp>
  463. <replaceregexp byline="false" flags="g" match='&lt;p&gt;&lt;/div&gt;&lt;/p&gt;' replace='&lt;/div&gt;'>
  464. <fileset dir="${work.dir}">
  465. <include name="${index.html}" />
  466. </fileset>
  467. </replaceregexp>
  468. <!-- Copy the CSS files to the destination directory: -->
  469. <copy todir="${work.dir}/${css.dir}">
  470. <fileset dir="${css.dir}">
  471. <include name="*" />
  472. </fileset>
  473. </copy>
  474. <!-- Copy the Javascript files to the destination directory: -->
  475. <copy todir="${work.dir}/${js.dir}">
  476. <fileset dir="${js.dir}">
  477. <include name="*" />
  478. </fileset>
  479. </copy>
  480. <!-- Copy the image files to the destination directory: -->
  481. <copy todir="${work.dir}/${img.dir}" flatten="yes">
  482. <image-files />
  483. </copy>
  484. <!-- The textile source file is no longer needed in the website directory. Remove it: -->
  485. <delete includeemptydirs="true" failonerror="false">
  486. <fileset dir="${website.dir}" defaultexcludes="false">
  487. <include name="${index.textile}" />
  488. </fileset>
  489. </delete>
  490. </sequential>
  491. </macrodef>
  492. <!-- Adjusts links in the generated HTML document for either the website or a local equivalent. -->
  493. <macrodef name="adjust-website-document-links"
  494. description="Adjusts links in the generated HTML document for either the website or a local equivalent.">
  495. <attribute name="work.dir" />
  496. <attribute name="html.file" />
  497. <attribute name="document.dir.name" />
  498. <sequential>
  499. <replaceregexp byline="false"
  500. flags="g"
  501. match='&lt;a href="(\.\./@{document.dir.name})/.+\.html(.*)"&gt;'
  502. replace='&lt;a href="\1/\2"&gt;'
  503. unless:set="website.local.files">
  504. <fileset dir="@{work.dir}">
  505. <include name="@{html.file}" />
  506. </fileset>
  507. </replaceregexp>
  508. <replaceregexp byline="false"
  509. flags="g"
  510. match='&lt;a href="\.\.(/@{document.dir.name})/.+\.html(.*)"&gt;'
  511. replace='&lt;a href="YSCT-@{document.dir.name}.html\2"&gt;'
  512. if:set="website.local.files">
  513. <fileset dir="@{work.dir}">
  514. <include name="@{html.file}" />
  515. </fileset>
  516. </replaceregexp>
  517. </sequential>
  518. </macrodef>
  519. </project>