You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

build.xml 19KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517
  1. <!-- -*- Mode: SGML; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -->
  2. <!-- ========================================================================= -->
  3. <!-- Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC), -->
  4. <!-- 2004-2005 Contributors. -->
  5. <!-- All rights reserved. -->
  6. <!-- This program and the accompanying materials are made available -->
  7. <!-- under the terms of the Eclipse Public License v 2.0 -->
  8. <!-- which accompanies this distribution and is available at -->
  9. <!-- https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt -->
  10. <!-- -->
  11. <!-- Contributors: -->
  12. <!-- Xerox/PARC initial implementation -->
  13. <!-- ========================================================================= -->
  14. <project name="docs" default="dist" basedir=".">
  15. <property name="project.name" value="build-docs" />
  16. <target name="product" depends="local-dist" />
  17. <target name="clean"
  18. depends="clean-doc-directories"
  19. />
  20. <!-- ===================================================================== -->
  21. <!-- Init -->
  22. <!-- ===================================================================== -->
  23. <import file="${basedir}/../build/build-properties.xml"/>
  24. <target name="init" depends="init-properties,init-directories">
  25. <property name="docs.src.pattern"
  26. value="**/*.xml,**/*.html,**/*.doc,**/*.gif,**/*.java,**/*.lst,**/*.pdf"
  27. />
  28. <property name="docs.src.dir"
  29. location="${aspectj.modules.docs.dir}"
  30. />
  31. <property name="docs.dist.dir"
  32. location="${aj.dist.dir}/docs"
  33. />
  34. <property name="docs.temp.dir"
  35. location="${aj.temp.dir}/doc"
  36. />
  37. <property name="web.doc.dir"
  38. location="${aj.webDeploy.dir}/documentation/dist"
  39. />
  40. <property name="docs.product.name"
  41. value="aspectj-docs-${build.version}"
  42. />
  43. <property name="docs.product.zip"
  44. location="${aj.dist.dir}/${docs.product.name}.zip"
  45. />
  46. <!-- must specify (not *.gif) to not delete other gifs during build-in-place -->
  47. <!-- to find refs: gp ax imagedata | sed -n 's|.*\=\"\(..*\)\".*|\1|p' -->
  48. <property name="devguide.icons.dir"
  49. location="${aspectj.modules.dir}/ajde/src/main/resources/org/aspectj/ajde/resources/actions"
  50. />
  51. <property name="include.devguide.icons"
  52. value="build.gif,openConfig.gif,browseroptions.gif"
  53. />
  54. <!-- callers of xml-html use these by default -->
  55. <property name="chunk.xsl.source"
  56. location="${aspectj.modules.lib.dir}/docbook/docbook-xsl/html/chunk.xsl"
  57. />
  58. <property name="nochunk.xsl.source"
  59. location="${aspectj.modules.lib.dir}/docbook/docbook-xsl/html/docbook.xsl"
  60. />
  61. <!-- default xml-html nochunking file (0-length dummy created when chunking) -->
  62. <property name="xml-target-file"
  63. location="${docs.temp.dir}/xml-target-file.dummy"
  64. />
  65. <!-- default value for xml-html copying (copy all graphics) -->
  66. <property name="xml-html-copy" value="*.gif,*.png" />
  67. <property name="xml-html-stylesheet" value="aspectj-docs.css" />
  68. <property name="binary.pattern"
  69. value="**/*.gif,**/*.png,**/*.doc,**/*.pdf,**/*.jpg,**/*.JPG,**/*.css"
  70. />
  71. <uptodate property="local.dist.uptodate"
  72. targetfile="${docs.dist.dir}/doc/faq.html"
  73. >
  74. <!-- use faq as tag file -->
  75. <srcfiles dir="${docs.src.dir}"
  76. includes="${docs.src.pattern}"
  77. />
  78. </uptodate>
  79. <uptodate property="dist.uptodate"
  80. targetfile="${docs.product.zip}"
  81. >
  82. <!-- use zip as tag file -->
  83. <srcfiles dir="${docs.src.dir}"
  84. includes="${docs.src.pattern}"
  85. />
  86. <srcfiles dir="${docs.dist.dir}"
  87. includes="${docs.src.pattern}"
  88. />
  89. </uptodate>
  90. </target>
  91. <target name="clean-doc-directories"
  92. depends="init"
  93. description="clean build dirs (including local deploy dir)"
  94. >
  95. <delete quiet="on">
  96. <fileset dir="${docs.dist.dir}" />
  97. <fileset dir="${docs.jar.dir}" />
  98. <fileset dir="${docs.temp.dir}" />
  99. </delete>
  100. </target>
  101. <target name="dist"
  102. depends="init,local-dist"
  103. description="create unused doc zip - see ../build/build.xml for installer"
  104. unless="dist.uptodate"
  105. >
  106. <delete file="${docs.product.zip}" />
  107. <zip zipfile="${docs.product.zip}"
  108. basedir="${docs.dist.dir}"
  109. />
  110. <echo message="find doc zip in ${docs.product.zip}" />
  111. </target>
  112. <target name="web.deploy.faqonly"
  113. depends="init,faq"
  114. description="deploy docs.dist.dir faq to web.doc.dir"
  115. >
  116. <copy todir="${web.doc.dir}" filtering="on">
  117. <fileset dir="${docs.dist.dir}/doc" includes="faq.html" />
  118. </copy>
  119. <stripnonbodyhtml srcdir="${web.doc.dir}"
  120. includes="faq.html"
  121. />
  122. <echo message="do link check on index and faq before release"
  123. />
  124. </target>
  125. <target name="web.deploy.faqindex"
  126. depends="init,dist"
  127. description="deploy built faq and index to web.doc.dir"
  128. >
  129. <copy todir="${web.doc.dir}" filtering="on">
  130. <fileset dir="${docs.dist.dir}/doc"
  131. includes="faq.html,index.html"
  132. />
  133. </copy>
  134. <stripnonbodyhtml srcdir="${web.doc.dir}"
  135. includes="faq.html,index.html"
  136. />
  137. <echo message="do link check on index and faq before release"
  138. />
  139. </target>
  140. <target name="web.deploy" depends="web.deploy.README-11" />
  141. <target name="web.deploy.README-11"
  142. depends="init"
  143. description="deploy README-11.html to the web site"
  144. >
  145. <property name="readme11.dir"
  146. location="${web.doc.dir}/documentation/readme11"
  147. />
  148. <mkdir dir="${readme11.dir}" />
  149. <delete file="${readme11.dir}/index.html" />
  150. <mkdir dir="${readme11.dir}" />
  151. <copy tofile="${readme11.dir}/index.html"
  152. file="${aspectj.products.dir}/tools/dist/README-11.html"
  153. filtering="on"
  154. />
  155. <stripnonbodyhtml srcdir="${readme11.dir}"
  156. includes="index.html"
  157. />
  158. </target>
  159. <target name="web.deploy.old"
  160. depends="init"
  161. description="deploy built docs to the web site"
  162. >
  163. <mkdir dir="${web.doc.dir}" />
  164. <delete dir="${web.doc.dir}" />
  165. <mkdir dir="${web.doc.dir}" />
  166. <copy todir="${web.doc.dir}">
  167. <fileset dir="${docs.dist.dir}/doc" />
  168. </copy>
  169. <stripnonbodyhtml srcdir="${web.doc.dir}"
  170. includes="**/*.html"
  171. />
  172. </target>
  173. <!-- ============================================================ -->
  174. <!-- build all doc products -->
  175. <!-- ============================================================ -->
  176. <target name="local-dist"
  177. depends="init"
  178. unless="local.dist.uptodate"
  179. description="avoid local-dist antecedants if uptodate"
  180. >
  181. <antcall target="do-local-dist" />
  182. </target>
  183. <target name="do-local-dist"
  184. depends="init,init-filters,faq,devguide,progguide, adk15guide, pdguide"
  185. description="finish products by copying dist files and library sources"
  186. >
  187. <!--
  188. depends="init,init-filters,api,faq,devguide,progguide, adk15guide, pdguide"
  189. -->
  190. <copy todir="${docs.dist.dir}" filtering="on">
  191. <fileset dir="${docs.src.dir}/dist"
  192. excludes="${binary.pattern}"
  193. />
  194. </copy>
  195. <copy todir="${docs.dist.dir}" filtering="off">
  196. <fileset dir="${docs.src.dir}/dist"
  197. includes="${binary.pattern}"
  198. />
  199. </copy>
  200. <available file="${docs.src.dir}/../org.aspectj.lib/build-aspectjlib.xml"
  201. property="org.aspectj.lib.available"
  202. />
  203. <!--fail unless="org.aspectj.lib.available"
  204. message="unable to find org.aspectj.lib"
  205. />
  206. <mkdir dir="${docs.dist.dir}/doc/aspectjlib" />
  207. <copy todir="${docs.dist.dir}/doc/aspectjlib" filtering="off">
  208. <fileset dir="${docs.src.dir}/../org.aspectj.lib"
  209. includes="build-aspectjlib.xml,src/**"
  210. excludes="CVS"
  211. />
  212. </copy>
  213. -->
  214. </target>
  215. <target name="api"
  216. depends="init"
  217. description="javadoc for AspectJ runtime and weaver"
  218. >
  219. <property file="${docs.src.dir}/docs.build.properties" />
  220. <delete quiet="on">
  221. <fileset dir="${docs.dist.dir}/doc" includes="*api/*" />
  222. </delete>
  223. <aspectj-javadoc module="runtime" />
  224. <aspectj-javadoc module="aspectj5rt"/>
  225. <aspectj-javadoc module="weaver" />
  226. </target>
  227. <macrodef name="aspectj-javadoc">
  228. <attribute name="module" />
  229. <sequential>
  230. <mkdir dir="${docs.dist.dir}/doc/@{module}-api" />
  231. <javadoc sourcepath="${@{module}.sourcepath}"
  232. destdir="${docs.dist.dir}/doc/@{module}-api"
  233. windowtitle="AspectJ(tm) @{module} API"
  234. classpath="${@{module}.classpath}"
  235. packagenames="${@{module}.packagenames}"
  236. >
  237. <link offline="true"
  238. href="http://java.sun.com/j2se/1.5/docs/api"
  239. packagelistLoc="${docs.src.dir}/jdk15-packages.txt"
  240. />
  241. </javadoc>
  242. </sequential>
  243. </macrodef>
  244. <target name="faq" depends="init">
  245. <antcall target="xml-html">
  246. <param name="xml-source-dir"
  247. value="${docs.src.dir}/faq"
  248. />
  249. <param name="xml-source-root" value="faq.xml" />
  250. <param name="xsl-source-file"
  251. value="${nochunk.xsl.source}"
  252. />
  253. <param name="xml-target-dir" value="${docs.dist.dir}" />
  254. <param name="xml-target-file"
  255. value="${docs.dist.dir}/doc/faq.html"
  256. />
  257. <param name="xml-html-stylesheet" value="aspectj-faq.css" />
  258. </antcall>
  259. </target>
  260. <target name="progguide" depends="init">
  261. <antcall target="build-guide">
  262. <param name="guide.dir" value="progGuideDB" />
  263. <param name="guide.name" value="progguide" />
  264. <param name="xml-html-copy"
  265. value="dd_arrow.gif,aspects.gif,figureUML.gif,overview.gif,telecom.gif,aspectj-docs.css"/>
  266. </antcall>
  267. </target>
  268. <target name="adk15guide" depends="init">
  269. <antcall target="build-guide">
  270. <param name="guide.dir" value="adk15ProgGuideDB" />
  271. <param name="guide.name" value="adk15notebook" />
  272. <param name="xml-html-copy"
  273. value="dd_arrow.gif,aspectj-docs.css"/>
  274. </antcall>
  275. </target>
  276. <target name="devguide" depends="init">
  277. <copy todir="${docs.src.dir}/devGuideDB" filtering="off">
  278. <fileset dir="${devguide.icons.dir}"
  279. includes="${include.devguide.icons}"
  280. />
  281. </copy>
  282. <antcall target="build-guide">
  283. <param name="xml-html-copy"
  284. value="dd_arrow.gif,aspectj-docs.css,ajbrowser-building.gif,ajbrowser-options.gif,${include.devguide.icons}"
  285. />
  286. <param name="guide.dir" value="devGuideDB" />
  287. <param name="guide.name" value="devguide" />
  288. </antcall>
  289. <delete quiet="on">
  290. <fileset dir="${docs.src.dir}/devGuideDB"
  291. includes="${include.devguide.icons}"
  292. />
  293. </delete>
  294. </target>
  295. <target name="pdguide" depends="init">
  296. <copy todir="${docs.src.dir}/pdGuideDB" filtering="off">
  297. <fileset dir="${devguide.icons.dir}"
  298. includes="${include.pdguide.icons}"
  299. />
  300. </copy>
  301. <antcall target="build-guide">
  302. <param name="xml-html-copy"
  303. value="dd_arrow.gif,aspectj-docs.css,ajbrowser-building.gif,ajbrowser-options.gif,${include.pdguide.icons}"
  304. />
  305. <param name="guide.dir" value="pdGuideDB" />
  306. <param name="guide.name" value="pdguide" />
  307. </antcall>
  308. <delete quiet="on">
  309. <fileset dir="${docs.src.dir}/pdGuideDB"
  310. includes="${include.pdguide.icons}"
  311. />
  312. </delete>
  313. </target>
  314. <target name="build-guide"
  315. depends="init"
  316. description="build prog or dev guide, using guide.dir and guide.name"
  317. >
  318. <!-- chunked -->
  319. <antcall target="xml-html">
  320. <param name="xml-source-dir"
  321. value="${docs.src.dir}/${guide.dir}"
  322. />
  323. <param name="xml-source-root" value="${guide.name}.xml" />
  324. <param name="xsl-source-file"
  325. value="${chunk.xsl.source}"
  326. />
  327. <param name="xml-target-dir"
  328. value="${docs.dist.dir}/doc/${guide.name}"
  329. />
  330. </antcall>
  331. <!-- single -->
  332. <antcall target="xml-html">
  333. <param name="xml-source-dir"
  334. value="${docs.src.dir}/${guide.dir}"
  335. />
  336. <param name="xml-source-root" value="${guide.name}.xml" />
  337. <param name="xsl-source-file"
  338. value="${nochunk.xsl.source}"
  339. />
  340. <param name="xml-target-dir"
  341. value="${docs.dist.dir}/doc/${guide.name}"
  342. />
  343. <param name="xml-target-file"
  344. value="${docs.dist.dir}/doc/${guide.name}/printable.html"
  345. />
  346. </antcall>
  347. <!-- pdf TODO pdf rendering completes, result is awful
  348. <antcall target="xml-pdf">
  349. <param name="xml-source-dir"
  350. value="${docs.src.dir}/${guide.dir}"/>
  351. <param name="xml-source-root" value="${guide.name}.xml"/>
  352. <param name="pdf-target-file"
  353. value="${docs.dist.dir}/doc/${guide.name}.pdf"/>
  354. </antcall>
  355. -->
  356. </target>
  357. <target name="test-pdf"
  358. depends="init"
  359. description="test pdf build of [prog|dev|adk]guide"
  360. >
  361. <!-- NPE in fop task when building programming guide.
  362. see patch at https://bugs.eclipse.org/bugs/show_bug.cgi?id=81654
  363. <antcall target="build-pdf">
  364. <param name="guide.dir" value="progGuideDB" />
  365. <param name="guide.name" value="progguide" />
  366. </antcall>
  367. -->
  368. <antcall target="build-pdf">
  369. <param name="guide.dir" value="adk15ProgGuideDB" />
  370. <param name="guide.name" value="adk15notebook" />
  371. </antcall>
  372. <copy todir="${docs.src.dir}/devGuideDB" filtering="off">
  373. <fileset dir="${devguide.icons.dir}"
  374. includes="${include.devguide.icons}"
  375. />
  376. </copy>
  377. <antcall target="build-pdf">
  378. <param name="xml-html-copy"
  379. value="ajbrowser-building.gif,ajbrowser-options.gif,${include.devguide.icons}"
  380. />
  381. <param name="guide.dir" value="devGuideDB" />
  382. <param name="guide.name" value="devguide" />
  383. </antcall>
  384. </target>
  385. <target name="build-pdf"
  386. depends="init"
  387. description="build prog or dev guide, using guide.dir and guide.name"
  388. >
  389. <antcall target="xml-pdf">
  390. <param name="xml-source-dir"
  391. value="${docs.src.dir}/${guide.dir}"
  392. />
  393. <param name="xml-source-root" value="${guide.name}.xml" />
  394. <param name="pdf-target-file"
  395. value="${docs.dist.dir}/doc/${guide.name}.pdf"
  396. />
  397. </antcall>
  398. </target>
  399. <!-- XML conversion stuff -->
  400. <!-- xml-pdf -->
  401. <target name="xml-pdf">
  402. <delete file="${pdf-target-file}" />
  403. <touch file="${pdf-target-file}" />
  404. <delete file="${xml-source-dir}/index.fo" />
  405. <!-- produce index.fo from docbook sources -->
  406. <java classname="com.icl.saxon.StyleSheet" fork="yes">
  407. <classpath>
  408. <pathelement location="${aspectj.modules.lib.dir}/saxon/saxon.jar"
  409. />
  410. </classpath>
  411. <arg value="-o" />
  412. <arg value="${xml-source-dir}/index.fo" />
  413. <arg value="${xml-source-dir}/${xml-source-root}" />
  414. <arg value="${aspectj.modules.lib.dir}/docbook/docbook-xsl/fo/docbook.xsl"
  415. />
  416. </java>
  417. <!-- index.fo to pdf (TODO if formatting fixed, to init-taskdefs) -->
  418. <taskdef name="fop"
  419. classname="org.apache.fop.tools.anttasks.Fop"
  420. >
  421. <classpath>
  422. <fileset dir="${aspectj.modules.lib.dir}/docbook">
  423. <include name="fop.jar" />
  424. <include name="batik.jar" />
  425. </fileset>
  426. </classpath>
  427. </taskdef>
  428. <!-- TODO messagelevel="info" -->
  429. <fop format="application/pdf"
  430. messagelevel="verbose"
  431. basedir="${guide.dir}"
  432. fofile="${guide.dir}/index.fo"
  433. outfile="${pdf-target-file}"
  434. >
  435. </fop>
  436. <delete quiet="on" file="${guide.dir}/index.fo" />
  437. </target>
  438. <target name="xml-html"
  439. description="antcall(xml-source-dir, xml-source-root, xml-target-dir, xml-target-file)
  440. convert xml to html using docbook. parameters:
  441. xml-source-dir # base directory of source
  442. xml-source-root # base file of source (relative to xml-source-dir)
  443. xsl-source-file # xsl transform to apply (use chunk.xsl.source by default)
  444. xml-target-dir # target directory for output (used as xsl param base.dir)
  445. xml-target-file # full path to output file in xml-source-dir, ignored when chunking
  446. xml-html-copy # copy files to target (defaults to *.gif,*.png)
  447. xml-html-stylesheet # style sheet to use (defaults to ${xml-html-stylesheet})"
  448. >
  449. <mkdir dir="${xml-target-dir}" />
  450. <copy todir="${xml-target-dir}">
  451. <fileset dir="${xml-source-dir}"
  452. includes="${xml-html-copy}"
  453. />
  454. </copy>
  455. <java classname="com.icl.saxon.StyleSheet"
  456. classpath="${aspectj.modules.lib.dir}/saxon/saxon.jar"
  457. fork="yes"
  458. failonerror="yes"
  459. >
  460. <!-- todo: establish failure policy -->
  461. <arg value="-o" />
  462. <arg value="${xml-target-file}" />
  463. <arg value="${xml-source-dir}/${xml-source-root}" />
  464. <arg value="${xsl-source-file}" />
  465. <arg value="base.dir=${xml-target-dir}/" />
  466. <arg value="use.id.as.filename=1" />
  467. <arg value="html.stylesheet=${xml-html-stylesheet}" />
  468. </java>
  469. </target>
  470. </project>