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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453
  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. <!-- 2003 Contributors -->
  5. <!-- All rights reserved. -->
  6. <!-- This program and the accompanying materials are made available -->
  7. <!-- under the terms of the Common Public License v1.0 -->
  8. <!-- which accompanies this distribution and is available at -->
  9. <!-- http://www.eclipse.org/legal/cpl-v10.html -->
  10. <!-- -->
  11. <!-- Contributors: -->
  12. <!-- Xerox/PARC initial implementation -->
  13. <!-- Adrian Colyer / George Harley eclipse plugin targets -->
  14. <!-- ========================================================================= -->
  15. <!DOCTYPE project [
  16. <!ENTITY build-properties SYSTEM "build-properties.xml">
  17. ]>
  18. <project name="build" default="all" basedir=".">
  19. <target name="all" depends="aspectj,eclipse.plugins"/>
  20. <target name="rebuild" depends="clean,all"/>
  21. <target name="clean" depends="clean-directories"/>
  22. <!-- ===================================================================== -->
  23. <!-- Init -->
  24. <!-- ===================================================================== -->
  25. <!-- use this file to force prop values -->
  26. <property file="${basedir}/local.properties"/>
  27. &build-properties;
  28. <target name="init" depends="init-properties,init-directories">
  29. <property name="build.config" value="verbose"/>
  30. <property name="trim.testing.default" value="true"/>
  31. <property name="aj.installer.jar"
  32. location="${aj.dist.dir}/aspectj-${build.version.short}.jar"/>
  33. <available property="ant.lib.aspectjtools"
  34. file="${ant.home}/lib/aspectjtools.jar"
  35. value="Expect classpath errors from ${ant.home}/lib/aspectjtools.jar"/>
  36. <available property="ant.lib.aspectjrt"
  37. file="${ant.home}/lib/aspectjrt.jar"
  38. value="Expect classpath errors from ${ant.home}/lib/aspectjrt.jar"/>
  39. <available property="testing.drivers.all.available"
  40. file="${aj.jar.dir}/testing-drivers-all.jar"
  41. value="${aj.jar.dir}/testing-drivers-all.jar"/>
  42. </target>
  43. <target name="version-uptodate" depends="init,init-taskdefs"
  44. unless="version-uptodate.done">
  45. <!-- XXX change task to pre-check & avoid scan if dates uptodate -->
  46. <versionuptodate
  47. version="${build.version}"
  48. versionSourceFile="${aspectj.modules.dir}/bridge/src/org/aspectj/bridge/Version.java"
  49. versionTagFile="${aj.temp.dir}/versionUptodate"/>
  50. <available file="${aj.temp.dir}/versionUptodate"
  51. property="version.uptodate"/>
  52. <property name="version-uptodate.done" value="done"/>
  53. </target>
  54. <target name="init-version" depends="init,init-filters,version-uptodate" >
  55. <antcall target="init-filters"/>
  56. <copy file="${aspectj.modules.dir}/build/lib/BridgeVersion.java.txt"
  57. tofile="${aspectj.modules.dir}/bridge/src/org/aspectj/bridge/Version.java"
  58. overwrite="yes" filtering="yes"/>
  59. <property name="init.version.done" value="done"/>
  60. <!-- consider checking this in? -->
  61. </target>
  62. <!-- ===================================================================== -->
  63. <!-- Misc setup and warnings -->
  64. <!-- ===================================================================== -->
  65. <target name="warn.ant.lib.aspectjrt" if="ant.lib.aspectjrt">
  66. <echo message="----- WARNING: ${ant.lib.aspectjrt}" />
  67. </target>
  68. <target name="warn.ant.lib.aspectjtools" if="ant.lib.aspectjtools">
  69. <echo message="----- WARNING: ${ant.lib.aspectjtools}" />
  70. </target>
  71. <target name="fail-unless-boot-libraries-uptodate" depends="init"
  72. description="fail unless all boot libraries are up-to-date">
  73. <antcall target="verify-boot-lib">
  74. <param name="boot.lib" value="test/aspectjrt.jar"/>
  75. <param name="vbl.module.name" value="runtime"/>
  76. </antcall>
  77. <antcall target="verify-boot-lib">
  78. <param name="boot.lib" value="build/build.jar"/>
  79. <param name="vbl.module.name" value="build"/>
  80. </antcall>
  81. <antcall target="verify-boot-lib">
  82. <param name="boot.lib" value="test/testing-client.jar"/>
  83. <param name="vbl.module.name" value="testing-client"/>
  84. </antcall>
  85. <echo message="fyi, bridge/util changes rarely mean client is invalid"/>
  86. <antcall target="verify-boot-lib">
  87. <param name="boot.lib" value="test/testing-client.jar"/>
  88. <param name="vbl.module.name" value="util"/>
  89. </antcall>
  90. <antcall target="verify-boot-lib">
  91. <param name="boot.lib" value="test/testing-client.jar"/>
  92. <param name="vbl.module.name" value="bridge"/>
  93. </antcall>
  94. <echo message="all boot libraries verified"/>
  95. </target>
  96. <target name="update-tree" depends="init"
  97. description="update tree">
  98. <fail unless="CVSROOT"
  99. message="required: {ant} -DCVSROOT=... ..."/>
  100. <cvs cvsRoot="${CVSROOT}"
  101. dest="${aspectj.modules.dir}"
  102. quiet="on"
  103. failonerror="on"
  104. command="update -dP" />
  105. </target>
  106. <!-- ===================================================================== -->
  107. <!-- test targets -->
  108. <!-- ===================================================================== -->
  109. <target name="quicklook" >
  110. <antcall target="clean"/>
  111. <!-- todo: compile modules without test sources -->
  112. <!-- todo: junit tests (compile with test sources) -->
  113. <antcall target="aspectj"/>
  114. <antcall target="ajcTests"/>
  115. <!-- todo: product install and tests -->
  116. </target>
  117. <!-- ===================================================================== -->
  118. <!-- antcall targets -->
  119. <!-- ===================================================================== -->
  120. <target name="build-product" depends="init,init-taskdefs,init-version"
  121. description="build $${product.name}">
  122. <ajbuild jarDir="${aj.jar.dir}"
  123. baseDir="${aspectj.modules.dir}"
  124. distDir="${aj.dist.dir}"
  125. productDir="${aspectj.modules.dir}/build/products/${product.name}"
  126. trimTesting="${trim.testing.default}"
  127. buildConfig="${build.config}"
  128. version="${build.version.long}"
  129. verbose="true"
  130. failonerror="true"/>
  131. </target>
  132. <target name="build-module" depends="init,init-taskdefs,init-version">
  133. <ajbuild jarDir="${aj.jar.dir}"
  134. baseDir="${aspectj.modules.dir}"
  135. distDir="${aj.dist.dir}"
  136. module="${module.name}"
  137. trimTesting="${trim.testing.default}"
  138. buildConfig="${build.config}"
  139. version="${build.version.long}"
  140. verbose="true"
  141. failonerror="true"/>
  142. </target>
  143. <target name="build-module-all" depends="init,init-taskdefs,init-version">
  144. <ajbuild module="${module.name}"
  145. baseDir="${aspectj.modules.dir}"
  146. distDir="${aj.dist.dir}"
  147. jarDir="${aj.jar.dir}"
  148. trimTesting="${trim.testing.default}"
  149. buildConfig="${build.config}"
  150. version="${build.version.long}"
  151. verbose="true"
  152. assembleall="true"
  153. failonerror="true"/>
  154. </target>
  155. <target name="create-installer" depends="init,init-taskdefs,init-filters"
  156. description="create ${installer.file} from ${staging.dir} using ${htmlSrc.dir} and ${simpleClassName}">
  157. <!-- init-filters: filter on copy used by ajinstaller taskdef -->
  158. <delete quiet="on" file="${installer.file}"/>
  159. <ajinstaller zipfile="${installer.file}"
  160. installerclassjar="${aspectj.build.jar}"
  161. basedir="${staging.dir}"
  162. mainclass="$$installer$$.org.aspectj.${simpleClassName}"
  163. htmlSrc="${htmlSrc.dir}"
  164. resourcesSrc="${aspectj.modules.build.dir}/installer-resources"/>
  165. </target>
  166. <target name="verify-boot-lib" depends="init"
  167. description="fail if ${boot.lib} is out of date wrt ${vbl.module.name}">
  168. <uptodate property="lib-warning-${vbl.module.name}"
  169. targetfile="${aspectj.modules.dir}/lib/${boot.lib}">
  170. <srcfiles dir="${aspectj.modules.dir}/${vbl.module.name}/src"
  171. includes="**/*.java"/>
  172. </uptodate>
  173. <fail unless="lib-warning-${vbl.module.name}"
  174. message="${boot.lib} out of date wrt module ${vbl.module.name}"/>
  175. </target>
  176. <!-- ===================================================================== -->
  177. <!-- custom targets -->
  178. <!-- ===================================================================== -->
  179. <target name="build-testing-drivers" depends="init-taskdefs,init"
  180. unless="testing.drivers.all.available">
  181. <antcall target="any-module-all">
  182. <param name="module.name" value="testing-drivers"/>
  183. </antcall>
  184. </target>
  185. <target name="build-testing-jars"
  186. depends="aspectjrt,build,ajbrowser-all"
  187. description="build testing jars.
  188. Use -Dtrim.testing.default=false to build junit tests">
  189. <antcall target="any-module">
  190. <param name="module.name" value="testing"/>
  191. </antcall>
  192. <antcall target="any-module">
  193. <param name="module.name" value="testing-drivers"/>
  194. </antcall>
  195. <antcall target="build-testing-drivers"/>
  196. </target>
  197. <target name="build-testing-client" depends="init-taskdefs,init">
  198. <antcall target="build-module-all">
  199. <param name="module.name" value="testing-client"/>
  200. </antcall>
  201. <echo>
  202. To use testing client jar in tests,
  203. mv ../aj-build/jars/testing-client-all.jar ../lib/tests/testing-client.jar
  204. </echo>
  205. </target>
  206. <!-- remove as unused - see release/build.xml test-sources -->
  207. <target name="ajcTests" depends="init,build-testing-drivers">
  208. <java fork="true" jar="${aj.jar.dir}/testing-drivers-all.jar"
  209. dir="${aspectj.modules.tests.dir}"
  210. output="${aj.results.dir}/ajcTests.out.txt">
  211. <arg value="-traceTestsMin"/>
  212. <arg value="-logFail"/>
  213. <arg value="-hideStreams"/>
  214. <arg value="-loud"/>
  215. <arg value="-ajctestSkipKeywords=purejava,knownLimitations"/>
  216. <arg value="ajcTests.xml"/>
  217. </java>
  218. <echo message="find result in ${aj.results.dir}/ajcTests.out.txt"/>
  219. </target>
  220. <target name="aspectj" depends="init,aspectjtools-dist,docs-dist"
  221. description="create installer from local distributions">
  222. <property name="installer.staging.dir"
  223. location="${aj.temp.dir}/installer-staging"/>
  224. <mkdir dir="${installer.staging.dir}"/>
  225. <delete dir="${installer.staging.dir}"/>
  226. <mkdir dir="${installer.staging.dir}"/>
  227. <copy todir="${installer.staging.dir}">
  228. <fileset dir="${aj.dist.dir}/tools"/>
  229. <fileset dir="${aj.dist.dir}/docs"/>
  230. </copy>
  231. <antcall target="create-installer">
  232. <param name="installer.file"
  233. location="${aj.installer.jar}"/>
  234. <param name="staging.dir"
  235. location="${installer.staging.dir}"/>
  236. <param name="htmlSrc.dir"
  237. location="${aspectj.modules.build.dir}/products/aspectj/install"/>
  238. <param name="simpleClassName" value="ToolsInstaller"/>
  239. </antcall>
  240. <delete dir="${installer.staging.dir}"/>
  241. </target>
  242. <target name="docs-dist" depends="init">
  243. <ant dir="${aspectj.modules.dir}/docs"
  244. antfile="build.xml"
  245. target="local-dist"
  246. inheritAll="false"/> <!-- true? -->
  247. </target>
  248. <target name="aspectjrt" depends="init"
  249. description="build aspectjrt.jar (differently than release)">
  250. <antcall target="build-module-all">
  251. <param name="module.name" value="runtime"/>
  252. </antcall>
  253. <copy file="${aj.jar.dir}/runtime.jar"
  254. tofile="${aj.jar.dir}/aspectjrt.jar"/>
  255. </target>
  256. <!-- ===================================================================== -->
  257. <!-- boilerplate antcalls -->
  258. <!-- ===================================================================== -->
  259. <!-- for any-[module|product], define [module|product].name -->
  260. <target name="any-module" depends="init">
  261. <fail unless="module.name" message="use -Dmodule.name=... to define"/>
  262. <antcall target="build-module">
  263. <param name="module.name" value="${module.name}"/>
  264. </antcall>
  265. </target>
  266. <target name="any-module-all" depends="init">
  267. <fail unless="module.name" message="use -Dmodule.name=... to define"/>
  268. <antcall target="build-module-all">
  269. <param name="module.name" value="${module.name}"/>
  270. </antcall>
  271. </target>
  272. <target name="any-product" depends="init">
  273. <fail unless="product.name" message="use -Dproduct.name=... to define"/>
  274. <antcall target="build-product">
  275. <param name="product.name" value="${product.name}"/>
  276. </antcall>
  277. </target>
  278. <!-- literal targets -->
  279. <target name="eajc" depends="init">
  280. <antcall target="build-module-all">
  281. <param name="module.name" value="org.aspectj.ajdt.core"/>
  282. </antcall>
  283. <echo message="use org.aspectj.ajdt.core-all.jar for eajc.jar"/>
  284. </target>
  285. <target name="ajbrowser-all" >
  286. <antcall target="build-module-all">
  287. <param name="module.name" value="ajbrowser"/>
  288. </antcall>
  289. </target>
  290. <target name="ajdoc-all">
  291. <antcall target="build-module-all">
  292. <param name="module.name" value="ajdoc"/>
  293. </antcall>
  294. </target>
  295. <target name="build">
  296. <antcall target="build-module">
  297. <param name="module.name" value="build"/>
  298. </antcall>
  299. </target>
  300. <target name="aspectjtools-dist" depends="init"
  301. description="build local distribution">
  302. <antcall target="build-product">
  303. <param name="product.name" value="tools"/>
  304. </antcall>
  305. </target>
  306. <!-- ===================================================================== -->
  307. <!-- eclipse plugins -->
  308. <!-- ===================================================================== -->
  309. <target name="eclipse.plugins" depends="org.aspectj.ajde.source,
  310. org.aspectj.ajde.doc,
  311. org.aspectj.ajde,
  312. org.aspectj.aspectjrt"
  313. description="create the Eclipse distribution plugins"/>
  314. <target name="org.aspectj.ajde.source" depends="init"
  315. description="build the AspectJ source distribution plugin">
  316. <copy todir="${aj.plugin.org.aspectj.ajde.source.dir}">
  317. <fileset dir="${aspectj.modules.dir}/eclipse.plugin/org.aspectj.ajde.source"/>
  318. </copy>
  319. <replace file="${aj.plugin.org.aspectj.ajde.source.dir}/plugin.xml"
  320. token="build.version.eclipse.plugins"
  321. value="${build.version.eclipse.plugins}"/>
  322. <copy file="${aspectj.modules.dir}/org.eclipse.jdt.core/jdtcore-for-aspectj-src.zip"
  323. todir="${aj.plugin.org.aspectj.ajde.source.dir}/src"/>
  324. <zip destfile="${aj.plugin.org.aspectj.ajde.source.dir}/src/aspectjsrc.zip">
  325. <fileset dir="${aspectj.modules.dir}/ajbrowser/src" includes="**"/>
  326. <fileset dir="${aspectj.modules.dir}/ajdoc/src" includes="**"/>
  327. <fileset dir="${aspectj.modules.dir}/ajde/src" includes="**"/>
  328. <fileset dir="${aspectj.modules.dir}/asm/src" includes="**"/>
  329. <fileset dir="${aspectj.modules.dir}/bridge/src" includes="**"/>
  330. <fileset dir="${aspectj.modules.dir}/org.aspectj.ajdt.core/src" includes="**"/>
  331. <fileset dir="${aspectj.modules.dir}/runtime/src" includes="**"/>
  332. <fileset dir="${aspectj.modules.dir}/taskdefs/src" includes="**"/>
  333. <fileset dir="${aspectj.modules.dir}/util/src" includes="**"/>
  334. <fileset dir="${aspectj.modules.dir}/weaver/src" includes="**"/>
  335. </zip>
  336. <jar destfile="${aj.plugin.org.aspectj.ajde.source.dir}/../org.aspectj.ajde.source_${build.version.eclipse.plugins}.jar">
  337. <fileset dir="${aj.plugin.org.aspectj.ajde.source.dir}" includes="**"/>
  338. </jar>
  339. </target>
  340. <target name="org.aspectj.ajde.doc" depends="init,docs-dist"
  341. description="build the AspectJ documentation plugin for Eclipse">
  342. <copy todir="${aj.plugin.org.aspectj.ajde.doc.dir}">
  343. <fileset dir="${aspectj.modules.dir}/eclipse.plugin/org.aspectj.ajde.doc"/>
  344. </copy>
  345. <copy todir="${aj.plugin.org.aspectj.ajde.doc.dir}/doc">
  346. <fileset dir="${aj.dist.dir}/docs/doc" includes="**"/>
  347. </copy>
  348. <replace file="${aj.plugin.org.aspectj.ajde.doc.dir}/plugin.xml"
  349. token="build.version.eclipse.plugins"
  350. value="${build.version.eclipse.plugins}"/>
  351. <jar destfile="${aj.plugin.org.aspectj.ajde.doc.dir}/../org.aspectj.ajde.doc_${build.version.eclipse.plugins}.jar">
  352. <fileset dir="${aj.plugin.org.aspectj.ajde.doc.dir}" includes="**"/>
  353. </jar>
  354. </target>
  355. <target name="org.aspectj.ajde" depends="init,aspectj"
  356. description="build the AspectJ library plugin for Eclipse">
  357. <copy todir="${aj.plugin.org.aspectj.ajde.dir}">
  358. <fileset dir="${aspectj.modules.dir}/eclipse.plugin/org.aspectj.ajde"/>
  359. </copy>
  360. <replace file="${aj.plugin.org.aspectj.ajde.dir}/plugin.xml"
  361. token="build.version.eclipse.plugins"
  362. value="${build.version.eclipse.plugins}"/>
  363. <copy file="${aj.dist.dir}/tools/lib/aspectjrt.jar"
  364. todir="${aj.plugin.org.aspectj.ajde.dir}"/>
  365. <copy file="${aj.dist.dir}/tools/lib/aspectjtools.jar"
  366. todir="${aj.plugin.org.aspectj.ajde.dir}"/>
  367. <jar destfile="${aj.plugin.org.aspectj.ajde.dir}/ajde.jar">
  368. <zipfileset src="${aj.dist.dir}/tools/lib/aspectjtools.jar"
  369. includes="org/aspectj/**"/>
  370. </jar>
  371. <jar destfile="${aj.plugin.org.aspectj.ajde.dir}/../org.aspectj.ajde_${build.version.eclipse.plugins}.jar">
  372. <fileset dir="${aj.plugin.org.aspectj.ajde.dir}" includes="**"/>
  373. </jar>
  374. </target>
  375. <target name="org.aspectj.aspectjrt" depends="init,aspectj"
  376. description="build the AspectJ runtime library plugin for Eclipse">
  377. <copy todir="${aj.plugin.org.aspectj.aspectjrt.dir}">
  378. <fileset dir="${aspectj.modules.dir}/eclipse.plugin/org.aspectj.aspectjrt"/>
  379. </copy>
  380. <replace file="${aj.plugin.org.aspectj.aspectjrt.dir}/plugin.xml"
  381. token="build.version.eclipse.plugins"
  382. value="${build.version.eclipse.plugins}"/>
  383. <copy file="${aj.dist.dir}/tools/lib/aspectjrt.jar"
  384. todir="${aj.plugin.org.aspectj.aspectjrt.dir}"/>
  385. <jar destfile="${aj.plugin.org.aspectj.aspectjrt.dir}/../org.aspectj.aspectjrt_${build.version.eclipse.plugins}.jar">
  386. <fileset dir="${aj.plugin.org.aspectj.aspectjrt.dir}" includes="**"/>
  387. </jar>
  388. </target>
  389. </project>