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

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