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.

ant-example.xml 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. <!-- -*- Mode: SGML; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -->
  2. <!-- -->
  3. <!-- This file is part of the compiler and core tools for the AspectJ(tm) -->
  4. <!-- programming language; see http://aspectj.org -->
  5. <!-- -->
  6. <!-- The contents of this file are subject to the Mozilla Public License -->
  7. <!-- Version 1.1 (the "License"); you may not use this file except in -->
  8. <!-- compliance with the License. You may obtain a copy of the License at -->
  9. <!-- either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. -->
  10. <!-- -->
  11. <!-- Software distributed under the License is distributed on an "AS IS" basis, -->
  12. <!-- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -->
  13. <!-- for the specific language governing rights and limitations under the -->
  14. <!-- License. -->
  15. <!-- -->
  16. <!-- The Original Code is AspectJ. -->
  17. <!-- -->
  18. <!-- The Initial Developer of the Original Code is Xerox Corporation. Portions -->
  19. <!-- created by Xerox Corporation are Copyright (C) 1999, 2000 Xerox Corporation. -->
  20. <!-- All Rights Reserved. -->
  21. <!-- todo: non-distribution license?? -->
  22. <!DOCTYPE build SYSTEM "build.dtd">
  23. <project name="ant-example" default="test" basedir=".">
  24. <!-- define target init.product -->
  25. &aspectj_initProduct;
  26. <!-- ========================================================================== -->
  27. <!-- Init -->
  28. <!-- ========================================================================== -->
  29. <target name="init" depends="init.product"
  30. description="caller must define jdk.tools.jar and product.dir or run from product.dir">
  31. <echo message="init ant-examples.xml"/>
  32. <!-- directory produced during test install -->
  33. <property name="ajx.base.dir"
  34. location="${productTest.output.dir}/ajx-output"/>
  35. <property name="ajx.expect.dir"
  36. location="${productTest.expect.dir}/ajx"/>
  37. <property name="noclass"
  38. value="noclass"/>
  39. <property name="noclass.dir"
  40. location="${productTest.output.dir}/${noclass}"/>
  41. <property name="aj.public.taskdef.package"
  42. value="org.aspectj.tools.ant.taskdef"/>
  43. <property name="taskdef.classpath"
  44. value="${product.taskdefs.jar}${PS}${product.tools.jar}${PS}${jdk.tools.jar}"/>
  45. </target>
  46. <target name="init.taskdefs" depends="init,product.taskdefs.jar,product.tools.jar">
  47. <!-- define taskdefs used here - requires jars, etc. -->
  48. <taskdef name="ajc"
  49. classname="${aj.public.taskdef.package}.Ajc" >
  50. <classpath>
  51. <pathelement path="${product.taskdefs.jar}"/>
  52. <pathelement path="${product.tools.jar}"/>
  53. <pathelement path="${jdk.tools.jar}"/>
  54. </classpath>
  55. </taskdef>
  56. <taskdef name="ajdoc"
  57. classname="${aj.public.taskdef.package}.Ajdoc">
  58. <classpath>
  59. <pathelement path="${product.taskdefs.jar}"/>
  60. <pathelement path="${product.tools.jar}"/>
  61. <pathelement path="${jdk.tools.jar}"/>
  62. </classpath>
  63. </taskdef>
  64. </target>
  65. <!-- ========================================================================== -->
  66. <!-- Clean everything in created dirs -->
  67. <!-- ========================================================================== -->
  68. <target name="clean" depends="init"
  69. description="clean output created by this script">
  70. <antcall target="mkdir"><param name="dir" value="${ajx.base.dir}"/>
  71. </antcall>
  72. <antcall target="mkdir"><param name="dir" value="${noclass.dir}"/>
  73. </antcall>
  74. </target>
  75. <target name="noclass.setup" depends="init"
  76. description="setup no-op dummy class to invoke when test class n/a or requires gui">
  77. <echo file="${noclass}.java">
  78. public class ${noclass} { public static void main(String[]args){}}
  79. </echo>
  80. <mkdir dir="${noclass.dir}"/>
  81. <delete dir="${noclass.dir}"/>
  82. <mkdir dir="${noclass.dir}"/>
  83. <javac srcdir="."
  84. includes="${noclass}.java"
  85. destdir="${noclass.dir}"
  86. failonerror="true"/>
  87. <delete file="${noclass}.java"/>
  88. <echo message=" todo check file: ${noclass}.java"/>
  89. <java classname="${noclass}"
  90. failonerror="true"
  91. classpath="${noclass.dir}"/>
  92. </target>
  93. <!-- ========================================================================== -->
  94. <!-- Run tests -->
  95. <!-- ========================================================================== -->
  96. <target name="Ajx" depends="init.taskdefs"
  97. description="for {example}, compile {list}, doc {list}, and run {class}">
  98. <echo message="##### START Ajx example=${example} list=${list} class=${class}" />
  99. <property name="exdir"
  100. value="${ajx.base.dir}/${example}"/>
  101. <property name="expect.exdir" value="${ajx.expect.dir}/${example}"/>
  102. <mkdir dir="${exdir}/classes"/>
  103. <mkdir dir="${exdir}/output"/>
  104. <mkdir dir="${exdir}/docs"/>
  105. <delete dir="${exdir}/classes"/>
  106. <delete dir="${exdir}/output"/>
  107. <delete dir="${exdir}/docs"/>
  108. <mkdir dir="${exdir}/classes"/>
  109. <mkdir dir="${exdir}/output"/>
  110. <mkdir dir="${exdir}/docs"/>
  111. <echo message="##################### Ajx ajc ${list}"/>
  112. <ajc
  113. destdir="${exdir}/classes"
  114. argfile="${list}"
  115. failonerror="false" >
  116. <classpath>
  117. <pathelement location="${product.rt.jar}" />
  118. <pathelement location="${jdk.tools.jar}" /> <!-- to compile ajdoc -->
  119. </classpath>
  120. </ajc>
  121. <!-- copying resources, etc. as javac does todo weak -->
  122. <copy todir="${exdir}/classes">
  123. <fileset dir="${srcDir}"
  124. includes="**/*.properties,**/*.gif,**/*.jpg,**/*.props" />
  125. </copy>
  126. <echo message="##################### Ajx ajdoc ${list} "/>
  127. <ajdoc fork="yes"
  128. private="yes"
  129. verbose="yes"
  130. sourcepath="${product.examples.dir}"
  131. destdir="${exdir}/docs"
  132. argfile="${list}"
  133. classpath="${product.rt.jar}${PS}${jdk.tools.jar}"
  134. failonerror="false" >
  135. <!-- internalclasspath
  136. internalclasspath="${taskdef.classpath}"
  137. is required now - but still not producing docs
  138. <classpath>
  139. <pathelement location="${product.rt.jar}" />
  140. </classpath>
  141. -->
  142. </ajdoc>
  143. <echo message="##################### Ajx run ${class} START - output in ${exdir}/output/out.txt"/>
  144. <java classname="${class}"
  145. output="${exdir}/output/out.txt"
  146. fork="yes"
  147. failonerror="false" >
  148. <!-- fork because ajc does a System.exit -->
  149. <classpath>
  150. <pathelement location="${exdir}/classes"/>
  151. <pathelement location="${product.rt.jar}"/>
  152. <pathelement location="${noclass.dir}"/>
  153. <pathelement location="${jdk.tools.jar}" /> <!-- to run ajdoc and old ajc -->
  154. </classpath>
  155. </java>
  156. <echo message="##################### Ajx run ${class} STOP"/>
  157. <echo message="##################### Ajx run ${class} check output START "/>
  158. <comparefiles rhsFile="${exdir}/output/out.txt"
  159. lhsFile="${expect.exdir}/output/out.txt"/>
  160. <echo message="##################### Ajx run ${class} check output STOP "/>
  161. <echo message="##### FINISH Ajx example=${example} list=${list} class=${class}" />
  162. </target>
  163. <target name="test" depends="test.examples,test.sources"/>
  164. <target name="test.sources" depends="init,noclass.setup,productTest.expect.dir"
  165. description="compile, doc, and run the tools-source targets using taskdefs" >
  166. <property name="tools.src.dir"
  167. location="${product.source.tools.dir}/src"/>
  168. <antcall target="Ajx">
  169. <param name="list" value="${tools.src.dir}/runtime.lst"/>
  170. <param name="example" value="source-tools-runtime"/>
  171. <param name="class" value="${noclass}"/>
  172. <param name="srcDir" value="${tools.src.dir}"/>
  173. </antcall>
  174. <antcall target="Ajx">
  175. <param name="list" value="${tools.src.dir}/ajc.lst"/>
  176. <param name="example" value="source-tools-ajc"/>
  177. <param name="class" value="org.aspectj.tools.ajc.Main"/>
  178. <param name="srcDir" value="${tools.src.dir}"/>
  179. <!-- ajc does a System.exit -->
  180. </antcall>
  181. <antcall target="Ajx">
  182. <param name="list" value="${tools.src.dir}/tools.lst"/>
  183. <param name="example" value="source-tools-all"/>
  184. <param name="class" value="${noclass}"/>
  185. <param name="srcDir" value="${tools.src.dir}"/>
  186. </antcall>
  187. <antcall target="Ajx">
  188. <param name="list" value="${tools.src.dir}/ajdoc.lst"/>
  189. <param name="example" value="source-tools-ajdoc"/>
  190. <param name="class" value="org.aspectj.tools.ajdoc.Main"/>
  191. <param name="srcDir" value="${tools.src.dir}"/>
  192. </antcall>
  193. </target>
  194. <target name="test.examples" depends="init,noclass.setup,productTest.expect.dir"
  195. description="compile, doc, and run the valid examples using taskdefs" >
  196. <antcall target="Ajx">
  197. <param name="list" value="bean/files.lst"/>
  198. <param name="example" value="bean"/>
  199. <param name="class" value="bean.Demo"/>
  200. <param name="srcDir" value="."/>
  201. </antcall>
  202. <antcall target="Ajx">
  203. <param name="list" value="coordination/lib.lst"/>
  204. <param name="example" value="coordination"/>
  205. <param name="class" value="${noclass}"/>
  206. <param name="srcDir" value="."/>
  207. </antcall>
  208. <antcall target="Ajx">
  209. <param name="list" value="introduction/files.lst"/>
  210. <param name="example" value="introduction-point"/>
  211. <param name="class" value="introduction.Point"/>
  212. <param name="srcDir" value="."/>
  213. </antcall>
  214. <antcall target="Ajx">
  215. <param name="list" value="introduction/files.lst"/>
  216. <param name="example" value="introduction-cloneablepoint"/>
  217. <param name="class" value="introduction.CloneablePoint"/>
  218. <param name="srcDir" value="."/>
  219. </antcall>
  220. <antcall target="Ajx">
  221. <param name="list" value="introduction/files.lst"/>
  222. <param name="example" value="introduction-comparablepoint"/>
  223. <param name="class" value="introduction.ComparablePoint"/>
  224. <param name="srcDir" value="."/>
  225. </antcall>
  226. <antcall target="Ajx">
  227. <param name="list" value="introduction/files.lst"/>
  228. <param name="example" value="introduction-hashablepoint"/>
  229. <param name="class" value="introduction.HashablePoint"/>
  230. <param name="srcDir" value="."/>
  231. </antcall>
  232. <antcall target="Ajx">
  233. <param name="list" value="observer/files.lst"/>
  234. <param name="example" value="observer"/>
  235. <param name="class" value="${noclass}"/>
  236. <param name="srcDir" value="."/>
  237. <!-- uses gui: param name="class" value="observer.Demo" -->
  238. </antcall>
  239. <antcall target="Ajx">
  240. <param name="list" value="spacewar/debug.lst"/>
  241. <param name="example" value="spacewar-debug"/>
  242. <param name="class" value="${noclass}"/>
  243. <param name="srcDir" value="."/>
  244. </antcall>
  245. <antcall target="Ajx">
  246. <param name="list" value="spacewar/demo.lst"/>
  247. <param name="example" value="spacewar-demo"/>
  248. <param name="class" value="${noclass}"/>
  249. <param name="srcDir" value="."/>
  250. </antcall>
  251. <antcall target="Ajx">
  252. <param name="list" value="telecom/basic.lst"/>
  253. <param name="example" value="telecom-basic"/>
  254. <param name="class" value="telecom.BasicSimulation"/>
  255. <param name="srcDir" value="."/>
  256. </antcall>
  257. <antcall target="Ajx">
  258. <param name="list" value="telecom/billing.lst"/>
  259. <param name="example" value="telecom-billing"/>
  260. <param name="class" value="telecom.BillingSimulation"/>
  261. <param name="srcDir" value="."/>
  262. </antcall>
  263. <antcall target="Ajx">
  264. <param name="list" value="telecom/timing.lst"/>
  265. <param name="example" value="telecom-timing"/>
  266. <param name="class" value="telecom.TimingSimulation"/>
  267. <param name="srcDir" value="."/>
  268. </antcall>
  269. <!-- timeserver not in product - todo check
  270. <antcall target="Ajx">
  271. <param name="list" value="timeserver/abort.lst"/>
  272. <param name="example" value="timeserver-abort"/>
  273. <param name="class" value="${noclass}"/>
  274. <param name="srcDir" value="."/>
  275. </antcall>
  276. <antcall target="Ajx">
  277. <param name="list" value="timeserver/retry.lst"/>
  278. <param name="example" value="timeserver-retry"/>
  279. <param name="class" value="${noclass}"/>
  280. <param name="srcDir" value="."/>
  281. </antcall>
  282. -->
  283. <antcall target="Ajx">
  284. <param name="list" value="tjp/files.lst"/>
  285. <param name="example" value="tjp"/>
  286. <param name="class" value="tjp.Demo"/>
  287. <param name="srcDir" value="."/>
  288. </antcall>
  289. <antcall target="Ajx">
  290. <param name="list" value="tracing/notrace.lst"/>
  291. <param name="example" value="tracing-none"/>
  292. <param name="class" value="tracing.ExampleMain"/>
  293. <param name="srcDir" value="."/>
  294. </antcall>
  295. <antcall target="Ajx">
  296. <param name="list" value="tracing/tracelib.lst"/>
  297. <param name="example" value="tracing-ExampleMain"/>
  298. <param name="class" value="tracing.ExampleMain"/>
  299. <param name="srcDir" value="."/>
  300. </antcall>
  301. <antcall target="Ajx">
  302. <param name="list" value="tracing/tracev1.lst"/>
  303. <param name="example" value="tracing-v1"/>
  304. <param name="class" value="tracing.ExampleMain"/>
  305. <param name="srcDir" value="."/>
  306. </antcall>
  307. <antcall target="Ajx">
  308. <param name="list" value="tracing/tracev2.lst"/>
  309. <param name="example" value="tracing-v2"/>
  310. <param name="class" value="tracing.ExampleMain"/>
  311. <param name="srcDir" value="."/>
  312. </antcall>
  313. <antcall target="Ajx">
  314. <param name="list" value="tracing/tracev3.lst"/>
  315. <param name="example" value="tracing-v3"/>
  316. <param name="class" value="tracing.ExampleMain"/>
  317. <param name="srcDir" value="."/>
  318. </antcall>
  319. </target>
  320. </project>