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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469
  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-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: (See CVS checkin's) -->
  12. <!-- Xerox/PARC initial implementation -->
  13. <!-- Adrian Colyer / George Harley eclipse plugin targets -->
  14. <!-- ========================================================================= -->
  15. <project name="build" default="all" basedir=".">
  16. <target name="all" depends="aspectj">
  17. <antcall target="eclipse.plugins"/>
  18. </target>
  19. <target name="clean" depends="clean-directories"/>
  20. <target name="compile" depends="build-module"
  21. description="compile module ${module.name} (without tests, by default)"/>
  22. <target name="compile-tests" depends="init"
  23. description="compile module ${module.name} tests">
  24. <assemble-module-test module="${module.name}"/>
  25. </target>
  26. <target name="test" depends="compile-tests">
  27. <antcall target="do-test-junit"/>
  28. </target>
  29. <!-- ===================================================================== -->
  30. <!-- Init -->
  31. <!-- ===================================================================== -->
  32. <property name="modules.dir" location="${basedir}/.."/>
  33. <property name="module.name" value="${ant.project.name}"/>
  34. <import file="${modules.dir}/build/build-properties.xml"/>
  35. <target name="init" depends="init-properties,init-directories">
  36. <property name="build.config" value=""/>
  37. <property name="trim.testing.default" value="true"/>
  38. <property name="aj.installer.jar"
  39. location="${aj.dist.dir}/aspectj-${build.version.long}.jar"/>
  40. <available property="ant.lib.aspectjtools"
  41. file="${ant.home}/lib/aspectjtools.jar"
  42. value="Expect classpath errors from ${ant.home}/lib/aspectjtools.jar"/>
  43. <available property="ant.lib.aspectjrt"
  44. file="${ant.home}/lib/aspectjrt.jar"
  45. value="Expect classpath errors from ${ant.home}/lib/aspectjrt.jar"/>
  46. <available property="testing.drivers.all.available"
  47. file="${aj.jar.dir}/testing-drivers-all.jar"
  48. value="${aj.jar.dir}/testing-drivers-all.jar"/>
  49. </target>
  50. <target name="version-uptodate" depends="init,init-taskdefs"
  51. unless="version-uptodate.done">
  52. <!-- XXX change task to pre-check & avoid scan if dates uptodate -->
  53. <versionuptodate
  54. version="${build.version}"
  55. versionSourceFile="${aspectj.modules.dir}/bridge/src/org/aspectj/bridge/Version.java"
  56. versionTagFile="${aj.temp.dir}/versionUptodate"/>
  57. <available file="${aj.temp.dir}/versionUptodate"
  58. property="version.uptodate"/>
  59. <property name="version-uptodate.done" value="done"/>
  60. </target>
  61. <target name="init-version" depends="init,init-filters,version-uptodate" >
  62. <antcall target="init-filters"/>
  63. <copy file="${aspectj.modules.dir}/build/lib/BridgeVersion.java.txt"
  64. tofile="${aspectj.modules.dir}/bridge/src/org/aspectj/bridge/Version.java"
  65. overwrite="yes" filtering="yes"/>
  66. <property name="init.version.done" value="done"/>
  67. <!-- consider checking this in? -->
  68. </target>
  69. <!-- ===================================================================== -->
  70. <!-- Misc setup and warnings -->
  71. <!-- ===================================================================== -->
  72. <target name="warn.ant.lib.aspectjrt" if="ant.lib.aspectjrt">
  73. <echo message="----- WARNING: ${ant.lib.aspectjrt}" />
  74. </target>
  75. <target name="warn.ant.lib.aspectjtools" if="ant.lib.aspectjtools">
  76. <echo message="----- WARNING: ${ant.lib.aspectjtools}" />
  77. </target>
  78. <target name="fail-unless-boot-libraries-uptodate" depends="init"
  79. description="fail unless all boot libraries are up-to-date">
  80. <antcall target="verify-boot-lib">
  81. <param name="boot.lib" value="test/aspectjrt.jar"/>
  82. <param name="vbl.module.name" value="runtime"/>
  83. </antcall>
  84. <antcall target="verify-boot-lib">
  85. <param name="boot.lib" value="build/build.jar"/>
  86. <param name="vbl.module.name" value="build"/>
  87. </antcall>
  88. <antcall target="verify-boot-lib">
  89. <param name="boot.lib" value="test/testing-client.jar"/>
  90. <param name="vbl.module.name" value="testing-client"/>
  91. </antcall>
  92. <echo message="fyi, bridge/util changes rarely mean client is invalid"/>
  93. <antcall target="verify-boot-lib">
  94. <param name="boot.lib" value="test/testing-client.jar"/>
  95. <param name="vbl.module.name" value="util"/>
  96. </antcall>
  97. <antcall target="verify-boot-lib">
  98. <param name="boot.lib" value="test/testing-client.jar"/>
  99. <param name="vbl.module.name" value="bridge"/>
  100. </antcall>
  101. <echo message="all boot libraries verified"/>
  102. </target>
  103. <target name="update-tree" depends="init"
  104. description="update tree">
  105. <fail unless="CVSROOT"
  106. message="required: {ant} -DCVSROOT=... ..."/>
  107. <cvs cvsRoot="${CVSROOT}"
  108. dest="${aspectj.modules.dir}"
  109. quiet="on"
  110. failonerror="on"
  111. command="update -dP" />
  112. </target>
  113. <!-- ===================================================================== -->
  114. <!-- antcall targets -->
  115. <!-- ===================================================================== -->
  116. <target name="build-product" depends="init,init-taskdefs,init-version"
  117. description="build $${product.name}">
  118. <ajbuild jarDir="${aj.jar.dir}"
  119. baseDir="${aspectj.modules.dir}"
  120. distDir="${aj.dist.dir}"
  121. productDir="${aspectj.modules.dir}/build/products/${product.name}"
  122. trimTesting="true"
  123. buildConfig="${build.config}"
  124. version="${build.version.long}"
  125. verbose="${build.verbose}"
  126. failonerror="true"/>
  127. </target>
  128. <target name="build-module" depends="init,init-taskdefs,init-version">
  129. <ajbuild module="${module.name}"
  130. baseDir="${aspectj.modules.dir}"
  131. distDir="${aj.dist.dir}"
  132. jarDir="${aj.jar.dir}"
  133. trimTesting="${trim.testing}"
  134. buildConfig="${build.config}"
  135. version="${build.version.long}"
  136. verbose="${build.verbose}"
  137. assembleall="${assemble}"
  138. failonerror="true"/>
  139. </target>
  140. <macrodef name="build-module-all">
  141. <attribute name="module"/>
  142. <attribute name="trimTesting" default="${trim.testing.default}"/>
  143. <sequential>
  144. <antcall target="build-module">
  145. <param name="module.name" value="@{module}"/>
  146. <param name="trim.testing" value="@{trimTesting}"/>
  147. <param name="assemble" value="true"/>
  148. </antcall>
  149. </sequential>
  150. </macrodef>
  151. <macrodef name="build-module">
  152. <attribute name="module"/>
  153. <attribute name="trimTesting" default="${trim.testing.default}"/>
  154. <attribute name="assemble" default="false"/>
  155. <sequential>
  156. <antcall target="build-module">
  157. <param name="module.name" value="@{module}"/>
  158. <param name="trim.testing" value="@{trimTesting}"/>
  159. <param name="assemble" value="@{assemble}"/>
  160. </antcall>
  161. </sequential>
  162. </macrodef>
  163. <macrodef name="assemble-module-test">
  164. <attribute name="module"/>
  165. <sequential>
  166. <build-module module="@{module}" assemble="true" trimTesting="false"/>
  167. </sequential>
  168. </macrodef>
  169. <target name="create-installer" depends="init,init-taskdefs,init-filters"
  170. description="create ${installer.file} from ${staging.dir} using ${htmlSrc.dir} and ${simpleClassName}">
  171. <!-- init-filters: filter on copy used by ajinstaller taskdef -->
  172. <delete quiet="on" file="${installer.file}"/>
  173. <ajinstaller zipfile="${installer.file}"
  174. installerclassjar="${aspectj.build.jar}"
  175. basedir="${staging.dir}"
  176. mainclass="$$installer$$.org.aspectj.${simpleClassName}"
  177. htmlSrc="${htmlSrc.dir}"
  178. resourcesSrc="${aspectj.modules.build.dir}/installer-resources"/>
  179. </target>
  180. <target name="verify-boot-lib" depends="init"
  181. description="fail if ${boot.lib} is out of date wrt ${vbl.module.name}">
  182. <uptodate property="lib-warning-${vbl.module.name}"
  183. targetfile="${aspectj.modules.dir}/lib/${boot.lib}">
  184. <srcfiles dir="${aspectj.modules.dir}/${vbl.module.name}/src"
  185. includes="**/*.java"/>
  186. </uptodate>
  187. <fail unless="lib-warning-${vbl.module.name}"
  188. message="${boot.lib} out of date wrt module ${vbl.module.name}"/>
  189. </target>
  190. <!-- ===================================================================== -->
  191. <!-- test targets -->
  192. <!-- ===================================================================== -->
  193. <target name="test-run-all-junit-tests"
  194. depends="init"
  195. description="run unit tests via run-all-junit-tests module">
  196. <antcall target="test">
  197. <param name="module.name" value="run-all-junit-tests"/>
  198. </antcall>
  199. </target>
  200. <target name="test-compiler-tests"
  201. depends="init"
  202. description="run compiler tests via tests module">
  203. <antcall target="test">
  204. <param name="module.name" value="tests"/>
  205. </antcall>
  206. </target>
  207. <target name="test-each-module"
  208. depends="init"
  209. description="run JUnit tests for each module">
  210. <subant target="test">
  211. <filelist dir="${aspectj.modules.dir}"
  212. files="${aspectj.tools.modules},${aspectj.test.modules}"/>
  213. </subant>
  214. </target>
  215. <target name="junitreport" depends="init,init-taskdefs"
  216. if="junitreport.available">
  217. <clean-dir dir="${aj.junit.dir}/html"/>
  218. <junitreport todir="${aj.junit.dir}/html">
  219. <fileset dir="${aj.junit.dir}">
  220. <include name="**/TEST-*.xml"/>
  221. </fileset>
  222. <report format="frames" todir="${aj.junit.dir}/html"/>
  223. </junitreport>
  224. <pathconvert property="jur.url" targetos="unix">
  225. <path location="${aj.junit.dir}/html/index.html"/>
  226. </pathconvert>
  227. <echo message="see file:${jur.url}"/>
  228. </target>
  229. <target name="do-test-junit"
  230. depends="init-taskdefs"
  231. description="run junit tests for a module using module root or leaves">
  232. <property name="dtj.dir"
  233. location="${aj.junit.dir}/${module.name}"/>
  234. <mkdir dir="${dtj.dir}"/>
  235. <condition property="dtj.includes"
  236. value="${junit.includes}"
  237. else="${junit.rootSuites}">
  238. <istrue value="${junit.leaves}"/>
  239. </condition>
  240. <condition property="dtj.excludes"
  241. value="${junit.excludes}"
  242. else="">
  243. <istrue value="${junit.leaves}"/>
  244. </condition>
  245. <junit
  246. dir="${aspectj.modules.build.dir}"
  247. failureproperty="test-junit-${module.name}.failed"
  248. fork="on"
  249. forkmode="perTest"
  250. maxmemory="400m"
  251. includeAntRuntime="off"
  252. printsummary="yes"
  253. haltonfailure="${haltOnTestFailure}" >
  254. <classpath>
  255. <pathelement location="${aj.jar.dir}/${module.name}-test-all.jar"/>
  256. <!-- see skipped libraries in Builder.properties -->
  257. <pathelement location="${jdk.tools.jar}"/>
  258. <pathelement location="${aspectj.modules.lib.dir}/junit/junit.jar"/>
  259. <!-- XML api's used by loadtime, also needed when running under 1.3 per Ant FAQ -->
  260. <fileset dir="${aspectj.modules.lib.dir}/ant/lib"
  261. includes="ant.jar,ant-junit.jar,xml-apis.jar,xercesImpl.jar"/>
  262. </classpath>
  263. <jvmarg value="-Daspectjrtpath=${lib.test.aspectjrt.jar}" />
  264. <formatter type="xml"/>
  265. <batchtest todir="${dtj.dir}">
  266. <fileset dir="${modules.dir}/${module.name}/testsrc"
  267. includes="${dtj.includes}"
  268. excludes="${dtj.excludes}"/>
  269. </batchtest>
  270. </junit>
  271. <report-if-failed text="JUnit tests for ${module.name} failed"
  272. property="test-junit-${module.name}.failed"/>
  273. </target>
  274. <!-- ===================================================================== -->
  275. <!-- custom targets -->
  276. <!-- ===================================================================== -->
  277. <target name="build-harness-jar" depends="init"
  278. description="build harness jar from scratch">
  279. <antcall target="clean-jars"/>
  280. <assemble-module-test module="testing-drivers"/>
  281. </target>
  282. <target name="build-testing-jars" depends="init"
  283. description="build testing jars from scratch">
  284. <antcall target="build-harness-jar"/>
  285. </target>
  286. <target name="build-testing-client" depends="init-taskdefs,init">
  287. <build-module module="testing-client" assemble="true"/>
  288. <assemble-module-test module="testing-client"/>
  289. <echo>
  290. To use testing client jar in tests,
  291. mv ../aj-build/jars/testing-client-all.jar ../lib/tests/testing-client.jar
  292. </echo>
  293. </target>
  294. <target name="aspectj" depends="init,aspectjtools-dist,docs-dist"
  295. description="create installer from local distributions">
  296. <property name="installer.staging.dir"
  297. location="${aj.temp.dir}/installer-staging"/>
  298. <clean-dir dir="${installer.staging.dir}"/>
  299. <copy todir="${installer.staging.dir}">
  300. <fileset dir="${aj.dist.dir}/tools"/>
  301. <fileset dir="${aj.dist.dir}/docs"/>
  302. </copy>
  303. <antcall target="create-installer">
  304. <param name="installer.file"
  305. location="${aj.installer.jar}"/>
  306. <param name="staging.dir"
  307. location="${installer.staging.dir}"/>
  308. <param name="htmlSrc.dir"
  309. location="${aspectj.modules.build.dir}/products/aspectj/install"/>
  310. <param name="simpleClassName" value="ToolsInstaller"/>
  311. </antcall>
  312. <delete dir="${installer.staging.dir}"/>
  313. </target>
  314. <target name="docs-dist" depends="init">
  315. <ant dir="${aspectj.modules.dir}/docs"
  316. antfile="build.xml"
  317. target="local-dist"
  318. inheritAll="false"/>
  319. </target>
  320. <target name="aspectjrt" depends="init"
  321. description="build aspectjrt.jar (differently than release)">
  322. <build-module-all module="aspectj5rt"/>
  323. <copy file="${aj.jar.dir}/aspectj5rt-all.jar"
  324. tofile="${aj.jar.dir}/aspectjrt.jar"/>
  325. </target>
  326. <target name="compile-runtime-11" depends="init-properties"
  327. description="compile runtime under 1.1 - fails, but by how much?">
  328. <condition property="cr1.in13">
  329. <equals arg1="1.3" arg2="${ant.java.version}"/>
  330. </condition>
  331. <antcall target="compile-runtime-11-flag-unless13"/>
  332. <antcall target="compile-runtime-11-do-if13"/>
  333. </target>
  334. <target name="compile-runtime-11-flag-unless13" depends="init-properties"
  335. unless="cr1.in13">
  336. <echo message="Skipping compile-runtime-11 unless 1.3"/>
  337. </target>
  338. <target name="compile-runtime-11-do-if13" depends="init-properties"
  339. if="cr1.in13">
  340. <mkdir dir="${aj.build.dir}/classes-1.1"/>
  341. <property name="java11.classes.zip"
  342. location="${java11.home}/lib/classes.zip"/>
  343. <available property="classes.zip.available"
  344. file="${java11.classes.zip}"/>
  345. <fail unless="classes.zip.available" message="no 1.1 bootclasspath"/>
  346. <javac
  347. compiler="javac1.1"
  348. bootclasspath="${java11.classes.zip}"
  349. source="1.3"
  350. includejavaruntime="no"
  351. includeantruntime="no"
  352. destdir="${aj.build.dir}/classes-1.1"
  353. srcdir="${aspectj.modules.dir}/runtime/src"
  354. target="1.1"
  355. verbose="false"
  356. failonerror="true"
  357. />
  358. <delete dir="${aj.build.dir}/classes-1.1"/>
  359. </target>
  360. <!-- ===================================================================== -->
  361. <!-- boilerplate antcalls -->
  362. <!-- ===================================================================== -->
  363. <!-- for any-[module|product], define [module|product].name -->
  364. <target name="any-module" depends="init">
  365. <fail unless="module.name" message="use -Dmodule.name=... to define"/>
  366. <build-module module="${module.name}"/>
  367. </target>
  368. <target name="any-module-all" depends="init">
  369. <fail unless="module.name" message="use -Dmodule.name=... to define"/>
  370. <build-module-all module="${module.name}"/>
  371. </target>
  372. <target name="any-product" depends="init">
  373. <fail unless="product.name" message="use -Dproduct.name=... to define"/>
  374. <antcall target="build-product">
  375. <param name="product.name" value="${product.name}"/>
  376. </antcall>
  377. </target>
  378. <target name="ajbrowser-all" >
  379. <build-module-all module="ajbrowser"/>
  380. </target>
  381. <target name="ajdoc-all">
  382. <build-module-all module="ajdoc"/>
  383. </target>
  384. <target name="build">
  385. <build-module-all module="build"/>
  386. </target>
  387. <target name="aspectjtools-dist" depends="init"
  388. description="build local distribution">
  389. <antcall target="build-product">
  390. <param name="product.name" value="tools"/>
  391. </antcall>
  392. </target>
  393. <!-- ===================================================================== -->
  394. <!-- eclipse plugins -->
  395. <!-- ===================================================================== -->
  396. <target name="eclipse.plugins" depends="init"
  397. description="create the Eclipse distribution plugins">
  398. <ant dir="${aspectj.modules.dir}/eclipse.plugin" inheritAll="false"/>
  399. </target>
  400. </project>