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 20KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519
  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 v1.0 -->
  8. <!-- which accompanies this distribution and is available at -->
  9. <!-- http://www.eclipse.org/legal/epl-v10.html -->
  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/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,api,faq,devguide,progguide, adk15guide, pdguide"
  185. description="finish products by copying dist files and library sources"
  186. >
  187. <copy todir="${docs.dist.dir}" filtering="on">
  188. <fileset dir="${docs.src.dir}/dist"
  189. excludes="${binary.pattern}"
  190. />
  191. </copy>
  192. <copy todir="${docs.dist.dir}" filtering="off">
  193. <fileset dir="${docs.src.dir}/dist"
  194. includes="${binary.pattern}"
  195. />
  196. </copy>
  197. <available file="${docs.src.dir}/../org.aspectj.lib/build-aspectjlib.xml"
  198. property="org.aspectj.lib.available"
  199. />
  200. <fail unless="org.aspectj.lib.available"
  201. message="unable to find org.aspectj.lib"
  202. />
  203. <mkdir dir="${docs.dist.dir}/doc/aspectjlib" />
  204. <copy todir="${docs.dist.dir}/doc/aspectjlib" filtering="off">
  205. <fileset dir="${docs.src.dir}/../org.aspectj.lib"
  206. includes="build-aspectjlib.xml,src/**"
  207. excludes="CVS"
  208. />
  209. </copy>
  210. </target>
  211. <target name="api"
  212. depends="init"
  213. description="javadoc for AspectJ runtime and weaver"
  214. >
  215. <property file="${docs.src.dir}/docs.build.properties" />
  216. <delete quiet="on">
  217. <fileset dir="${docs.dist.dir}/doc" includes="*api/*" />
  218. </delete>
  219. <aspectj-javadoc module="runtime" />
  220. <aspectj-javadoc module="aspectj5rt"/>
  221. <aspectj-javadoc module="weaver" />
  222. </target>
  223. <macrodef name="aspectj-javadoc">
  224. <attribute name="module" />
  225. <sequential>
  226. <mkdir dir="${docs.dist.dir}/doc/@{module}-api" />
  227. <javadoc sourcepath="${@{module}.sourcepath}"
  228. destdir="${docs.dist.dir}/doc/@{module}-api"
  229. windowtitle="AspectJ(tm) @{module} API"
  230. classpath="${@{module}.classpath}"
  231. packagenames="${@{module}.packagenames}"
  232. >
  233. <link offline="true"
  234. href="http://java.sun.com/j2se/1.5/docs/api"
  235. packagelistLoc="${docs.src.dir}/jdk15-packages.txt"
  236. />
  237. </javadoc>
  238. </sequential>
  239. </macrodef>
  240. <target name="faq" depends="init">
  241. <antcall target="xml-html">
  242. <param name="xml-source-dir"
  243. value="${docs.src.dir}/faq"
  244. />
  245. <param name="xml-source-root" value="faq.xml" />
  246. <param name="xsl-source-file"
  247. value="${nochunk.xsl.source}"
  248. />
  249. <param name="xml-target-dir" value="${docs.dist.dir}" />
  250. <param name="xml-target-file"
  251. value="${docs.dist.dir}/doc/faq.html"
  252. />
  253. <param name="xml-html-stylesheet" value="aspectj-faq.css" />
  254. </antcall>
  255. </target>
  256. <target name="progguide" depends="init">
  257. <antcall target="build-guide">
  258. <param name="guide.dir" value="progGuideDB" />
  259. <param name="guide.name" value="progguide" />
  260. <param name="xml-html-copy"
  261. value="dd_arrow.gif,aspects.gif,figureUML.gif,overview.gif,telecom.gif,aspectj-docs.css"/>
  262. </antcall>
  263. </target>
  264. <target name="adk15guide" depends="init">
  265. <antcall target="build-guide">
  266. <param name="guide.dir" value="adk15ProgGuideDB" />
  267. <param name="guide.name" value="adk15notebook" />
  268. <param name="xml-html-copy"
  269. value="dd_arrow.gif,aspectj-docs.css"/>
  270. </antcall>
  271. </target>
  272. <target name="devguide" depends="init">
  273. <copy todir="${docs.src.dir}/devGuideDB" filtering="off">
  274. <fileset dir="${devguide.icons.dir}"
  275. includes="${include.devguide.icons}"
  276. />
  277. </copy>
  278. <antcall target="build-guide">
  279. <param name="xml-html-copy"
  280. value="dd_arrow.gif,aspectj-docs.css,ajbrowser-building.gif,ajbrowser-options.gif,${include.devguide.icons}"
  281. />
  282. <param name="guide.dir" value="devGuideDB" />
  283. <param name="guide.name" value="devguide" />
  284. </antcall>
  285. <delete quiet="on">
  286. <fileset dir="${docs.src.dir}/devGuideDB"
  287. includes="${include.devguide.icons}"
  288. />
  289. </delete>
  290. </target>
  291. <target name="pdguide" depends="init">
  292. <copy todir="${docs.src.dir}/pdGuideDB" filtering="off">
  293. <fileset dir="${devguide.icons.dir}"
  294. includes="${include.pdguide.icons}"
  295. />
  296. </copy>
  297. <antcall target="build-guide">
  298. <param name="xml-html-copy"
  299. value="dd_arrow.gif,aspectj-docs.css,ajbrowser-building.gif,ajbrowser-options.gif,${include.pdguide.icons}"
  300. />
  301. <param name="guide.dir" value="pdGuideDB" />
  302. <param name="guide.name" value="pdguide" />
  303. </antcall>
  304. <delete quiet="on">
  305. <fileset dir="${docs.src.dir}/pdGuideDB"
  306. includes="${include.pdguide.icons}"
  307. />
  308. </delete>
  309. </target>
  310. <target name="build-guide"
  311. depends="init"
  312. description="build prog or dev guide, using guide.dir and guide.name"
  313. >
  314. <!-- chunked -->
  315. <antcall target="xml-html">
  316. <param name="xml-source-dir"
  317. value="${docs.src.dir}/${guide.dir}"
  318. />
  319. <param name="xml-source-root" value="${guide.name}.xml" />
  320. <param name="xsl-source-file"
  321. value="${chunk.xsl.source}"
  322. />
  323. <param name="xml-target-dir"
  324. value="${docs.dist.dir}/doc/${guide.name}"
  325. />
  326. </antcall>
  327. <!-- single -->
  328. <antcall target="xml-html">
  329. <param name="xml-source-dir"
  330. value="${docs.src.dir}/${guide.dir}"
  331. />
  332. <param name="xml-source-root" value="${guide.name}.xml" />
  333. <param name="xsl-source-file"
  334. value="${nochunk.xsl.source}"
  335. />
  336. <param name="xml-target-dir"
  337. value="${docs.dist.dir}/doc/${guide.name}"
  338. />
  339. <param name="xml-target-file"
  340. value="${docs.dist.dir}/doc/${guide.name}/printable.html"
  341. />
  342. </antcall>
  343. <!-- pdf TODO pdf rendering completes, result is awful
  344. <antcall target="xml-pdf">
  345. <param name="xml-source-dir"
  346. value="${docs.src.dir}/${guide.dir}"/>
  347. <param name="xml-source-root" value="${guide.name}.xml"/>
  348. <param name="pdf-target-file"
  349. value="${docs.dist.dir}/doc/${guide.name}.pdf"/>
  350. </antcall>
  351. -->
  352. </target>
  353. <target name="test-pdf"
  354. depends="init"
  355. description="test pdf build of [prog|dev|adk]guide"
  356. >
  357. <!-- NPE in fop task when building programming guide.
  358. see patch at https://bugs.eclipse.org/bugs/show_bug.cgi?id=81654
  359. <antcall target="build-pdf">
  360. <param name="guide.dir" value="progGuideDB" />
  361. <param name="guide.name" value="progguide" />
  362. </antcall>
  363. -->
  364. <antcall target="build-pdf">
  365. <param name="guide.dir" value="adk15ProgGuideDB" />
  366. <param name="guide.name" value="adk15notebook" />
  367. </antcall>
  368. <copy todir="${docs.src.dir}/devGuideDB" filtering="off">
  369. <fileset dir="${devguide.icons.dir}"
  370. includes="${include.devguide.icons}"
  371. />
  372. </copy>
  373. <antcall target="build-pdf">
  374. <param name="xml-html-copy"
  375. value="ajbrowser-building.gif,ajbrowser-options.gif,${include.devguide.icons}"
  376. />
  377. <param name="guide.dir" value="devGuideDB" />
  378. <param name="guide.name" value="devguide" />
  379. </antcall>
  380. </target>
  381. <target name="build-pdf"
  382. depends="init"
  383. description="build prog or dev guide, using guide.dir and guide.name"
  384. >
  385. <antcall target="xml-pdf">
  386. <param name="xml-source-dir"
  387. value="${docs.src.dir}/${guide.dir}"
  388. />
  389. <param name="xml-source-root" value="${guide.name}.xml" />
  390. <param name="pdf-target-file"
  391. value="${docs.dist.dir}/doc/${guide.name}.pdf"
  392. />
  393. </antcall>
  394. </target>
  395. <!-- XML conversion stuff -->
  396. <!-- xml-pdf -->
  397. <target name="xml-pdf">
  398. <delete file="${pdf-target-file}" />
  399. <touch file="${pdf-target-file}" />
  400. <delete file="${xml-source-dir}/index.fo" />
  401. <!-- produce index.fo from docbook sources -->
  402. <java classname="com.icl.saxon.StyleSheet" fork="yes">
  403. <classpath>
  404. <pathelement location="${aspectj.modules.lib.dir}/saxon/saxon.jar"
  405. />
  406. </classpath>
  407. <arg value="-o" />
  408. <arg value="${xml-source-dir}/index.fo" />
  409. <arg value="${xml-source-dir}/${xml-source-root}" />
  410. <arg value="${aspectj.modules.lib.dir}/docbook/docbook-xsl/fo/docbook.xsl"
  411. />
  412. </java>
  413. <!-- index.fo to pdf (TODO if formatting fixed, to init-taskdefs) -->
  414. <taskdef name="fop"
  415. classname="org.apache.fop.tools.anttasks.Fop"
  416. >
  417. <classpath>
  418. <fileset dir="${aspectj.modules.lib.dir}/docbook/fop">
  419. <include name="fop.jar" />
  420. <include name="batik.jar" />
  421. <include name="avalon.jar" />
  422. </fileset>
  423. <fileset dir="${aspectj.modules.lib.dir}/ant">
  424. <include name="xalan.jar" />
  425. <include name="xercesImpl.jar" />
  426. <include name="xml-apis.jar" />
  427. </fileset>
  428. </classpath>
  429. </taskdef>
  430. <!-- TODO messagelevel="info" -->
  431. <fop format="application/pdf"
  432. messagelevel="verbose"
  433. basedir="${guide.dir}"
  434. fofile="${guide.dir}/index.fo"
  435. outfile="${pdf-target-file}"
  436. >
  437. </fop>
  438. <delete quiet="on" file="${guide.dir}/index.fo" />
  439. </target>
  440. <target name="xml-html"
  441. description="antcall(xml-source-dir, xml-source-root, xml-target-dir, xml-target-file)
  442. convert xml to html using docbook. parameters:
  443. xml-source-dir # base directory of source
  444. xml-source-root # base file of source (relative to xml-source-dir)
  445. xsl-source-file # xsl transform to apply (use chunk.xsl.source by default)
  446. xml-target-dir # target directory for output (used as xsl param base.dir)
  447. xml-target-file # full path to output file in xml-source-dir, ignored when chunking
  448. xml-html-copy # copy files to target (defaults to *.gif,*.png)
  449. xml-html-stylesheet # style sheet to use (defaults to ${xml-html-stylesheet})"
  450. >
  451. <mkdir dir="${xml-target-dir}" />
  452. <copy todir="${xml-target-dir}">
  453. <fileset dir="${xml-source-dir}"
  454. includes="${xml-html-copy}"
  455. />
  456. </copy>
  457. <java classname="com.icl.saxon.StyleSheet"
  458. classpath="${aspectj.modules.lib.dir}/saxon/saxon.jar"
  459. fork="yes"
  460. failonerror="yes"
  461. >
  462. <!-- todo: establish failure policy -->
  463. <arg value="-o" />
  464. <arg value="${xml-target-file}" />
  465. <arg value="${xml-source-dir}/${xml-source-root}" />
  466. <arg value="${xsl-source-file}" />
  467. <arg value="base.dir=${xml-target-dir}/" />
  468. <arg value="use.id.as.filename=1" />
  469. <arg value="html.stylesheet=${xml-html-stylesheet}" />
  470. </java>
  471. </target>
  472. </project>