You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

build.xml 25 kB

Replaced usage of Avalon Context with Myrmidon specific Context: * Moved read-only property and resolve methods from TaskContext to new Context interface. TaskContext now extends the new Context interface. * Changed the Configurer methods to use the new Context. Both implementations use the supplied Context to do property resolution. * Renamed TaskContext.getPropertys() -> getProperties(). * Moved PropertyUtil from configurer to workspace package, as that is now the only place it is used. * Changed PropertyUtil to work with the new Context. RoleManager: * A default implementation for a role can now be specified. Currently can only do this programatically. DefaultMasterConverter: * Removed MasterConverter interface. It is now identified by the Converter role. * Now caches the converter instances. * Changed the converter search algorithm to traverse the *source* class hierarchy, including all interfaces. Chooses the most specialised conversion, and fails if there is more than one such choice. DefaultConfigurer: * Attempts to convert references, if the type does not match the expected type. * Changed handling of nested elements, for named adders/setters: * If the method type can be mapped to a role, and that role has a default implementation, then use that default implementation. * Otherwise, if the method type is an interface, fail. * Otherwise, create an instance using no-args constructor. * Changed handling of nested elements, for typed adders/setters: * If the method type can be mapped to a role, and the element name is a type of that role, then use that role to create the instance. * Otherwise, use the type factory for the generic data-type role. * Attempt to convert the instance if it is not of the expected type. * Added a bunch of test cases for new functionality. * Renamed all the ConfigTest classes to have descriptive names. Misc: * Renamed package framework.factorys -> framework.factories. * Made tests work when fork = false. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271539 13f79535-47bb-0310-9956-ffa450edef68
24 years ago
Replaced usage of Avalon Context with Myrmidon specific Context: * Moved read-only property and resolve methods from TaskContext to new Context interface. TaskContext now extends the new Context interface. * Changed the Configurer methods to use the new Context. Both implementations use the supplied Context to do property resolution. * Renamed TaskContext.getPropertys() -> getProperties(). * Moved PropertyUtil from configurer to workspace package, as that is now the only place it is used. * Changed PropertyUtil to work with the new Context. RoleManager: * A default implementation for a role can now be specified. Currently can only do this programatically. DefaultMasterConverter: * Removed MasterConverter interface. It is now identified by the Converter role. * Now caches the converter instances. * Changed the converter search algorithm to traverse the *source* class hierarchy, including all interfaces. Chooses the most specialised conversion, and fails if there is more than one such choice. DefaultConfigurer: * Attempts to convert references, if the type does not match the expected type. * Changed handling of nested elements, for named adders/setters: * If the method type can be mapped to a role, and that role has a default implementation, then use that default implementation. * Otherwise, if the method type is an interface, fail. * Otherwise, create an instance using no-args constructor. * Changed handling of nested elements, for typed adders/setters: * If the method type can be mapped to a role, and the element name is a type of that role, then use that role to create the instance. * Otherwise, use the type factory for the generic data-type role. * Attempt to convert the instance if it is not of the expected type. * Added a bunch of test cases for new functionality. * Renamed all the ConfigTest classes to have descriptive names. Misc: * Renamed package framework.factorys -> framework.factories. * Made tests work when fork = false. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271539 13f79535-47bb-0310-9956-ffa450edef68
24 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612
  1. <?xml version="1.0"?>
  2. <!--
  3. ==============================================================================
  4. Ant build file
  5. Authors:
  6. Peter Donald <peter@apache.org>
  7. Legal:
  8. Copyright (c) 2000 The Apache Software Foundation. All Rights Reserved.
  9. ==============================================================================
  10. -->
  11. <project name="myrmidon" default="main" basedir=".">
  12. <!--
  13. Give user a chance to override without editing this file
  14. (and without typing -D each time he compiles it)
  15. -->
  16. <property file=".ant.properties"/>
  17. <property file="${user.home}/.ant.properties"/>
  18. <property name="name" value="myrmidon"/>
  19. <property name="Name" value="Myrmidon"/>
  20. <property name="version" value="0.01"/>
  21. <property name="year" value="2000-2001"/>
  22. <!--
  23. these are here only for those who use jikes compiler. For other
  24. developers this part makes no difference.
  25. -->
  26. <property name="build.compiler" value="jikes"/>
  27. <property name="build.compiler.emacs" value="on"/>
  28. <property name="build.compiler.pedantic" value="true"/>
  29. <property name="build.compiler.depend" value="true"/>
  30. <property name="build.compiler.fulldepend" value="true"/>
  31. <property name="debug" value="on"/>
  32. <property name="optimize" value="off"/>
  33. <property name="deprecation" value="on"/>
  34. <property name="build.dir" value="build"/>
  35. <property name="build.lib" value="${build.dir}/lib"/>
  36. <property name="build.src" value="${build.dir}/src"/>
  37. <property name="build.classes" value="${build.dir}/classes"/>
  38. <property name="src.base" value="src"/>
  39. <property name="manifest.dir" value="${src.base}/manifest"/>
  40. <property name="java.dir" value="${src.base}/java"/>
  41. <property name="script.dir" value="${src.base}/script"/>
  42. <property name="lib.dir" value="lib"/>
  43. <property name="dist.name" value="${Name}-${version}"/>
  44. <property name="dist.dir" value="dist"/>
  45. <property name="dist.bin" value="${dist.dir}/bin"/>
  46. <property name="dist.lib" value="${dist.dir}/lib"/>
  47. <property name="dist.ext" value="${dist.dir}/ext"/>
  48. <property name="gen.dir" value="${build.dir}/gen"/>
  49. <property name="test.dir" value="${build.dir}/test"/>
  50. <property name="test.working.dir" value="${test.dir}/testcases"/>
  51. <property name="test.classes" value="${test.dir}/classes"/>
  52. <property name="constants.file" value="org/apache/myrmidon/Constants.java"/>
  53. <path id="project.class.path">
  54. <pathelement path="${java.class.path}" />
  55. <fileset dir="${lib.dir}">
  56. <include name="*.jar" />
  57. </fileset>
  58. <pathelement path="${build.classes}" />
  59. </path>
  60. <!-- Main target -->
  61. <target name="main" depends="dist-lite" description="Builds the distribution"/>
  62. <!-- lets see what is available -->
  63. <target name="check_for_optional_packages">
  64. <available property="jdk1.2+" classname="java.lang.ThreadLocal" />
  65. <available property="jdk1.3+" classname="java.lang.StrictMath" />
  66. <available property="jdk1.4+" classname="java.lang.CharSequence" />
  67. <available property="bsf.present"
  68. classname="com.ibm.bsf.BSFManager"
  69. classpathref="project.class.path" />
  70. <available property="netrexx.present"
  71. classname="netrexx.lang.Rexx"
  72. classpathref="project.class.path" />
  73. <available property="trax.present"
  74. classname="javax.xml.transform.Transformer"
  75. classpathref="project.class.path" />
  76. <available property="xslp.present"
  77. classname="com.kvisco.xsl.XSLProcessor"
  78. classpathref="project.class.path" />
  79. <available property="xalan.present"
  80. classname="org.apache.xalan.xslt.XSLTProcessorFactory"
  81. classpathref="project.class.path" />
  82. <available property="xalan2.present"
  83. classname="org.apache.xalan.transformer.TransformerImpl"
  84. classpathref="project.class.path" />
  85. <available property="ejb.ejbc.present"
  86. classname="weblogic.ejbc"
  87. classpathref="project.class.path" />
  88. <available property="ejb.DDCreator.present"
  89. classname="weblogic.ejb.utils.DDCreator"
  90. classpathref="project.class.path" />
  91. <available property="ejb.wls.present"
  92. classname="weblogic.Server"
  93. classpathref="project.class.path" />
  94. <available property="junit.present"
  95. classname="junit.framework.TestCase"
  96. classpathref="project.class.path" />
  97. <available property="netcomp.present"
  98. classname="com.oroinc.net.ftp.FTPClient"
  99. classpathref="project.class.path" />
  100. <available property="jcifs.present"
  101. classname="jcifs.smb.SmbFile"
  102. classpathref="project.class.path" />
  103. <available property="starteam.present"
  104. classname="com.starbase.util.Platform"
  105. classpathref="project.class.path" />
  106. <available property="antlr.present"
  107. classname="antlr.Tool"
  108. classpathref="project.class.path"/>
  109. <available property="vaj.present"
  110. classname="com.ibm.ivj.util.base.Workspace"
  111. classpathref="project.class.path"/>
  112. <available property="stylebook.present"
  113. classname="org.apache.stylebook.Engine"
  114. classpathref="project.class.path"/>
  115. <available property="jakarta.regexp.present"
  116. classname="org.apache.regexp.RE"
  117. classpathref="project.class.path"/>
  118. <available property="jakarta.oro.present"
  119. classname="org.apache.oro.text.regex.Perl5Matcher"
  120. classpathref="project.class.path" />
  121. <available property="jmf.present"
  122. classname="javax.sound.sampled.Clip"
  123. classpathref="project.class.path"/>
  124. <available property="icontract.present"
  125. classname="com.reliablesystems.iContract.IContracted"
  126. classpathref="project.class.path"/>
  127. <available property="jdepend.present"
  128. classname="jdepend.framework.JDepend"
  129. classpathref="project.class.path"/>
  130. <available property="log4j.present"
  131. classname="org.apache.log4j.Category"
  132. classpathref="project.class.path"/>
  133. <!-- this is just a way to check for a TraX implementation -->
  134. <available property="trax.impl.present"
  135. resource="META-INF/services/javax.xml.transform.TransformerFactory"
  136. classpathref="project.class.path"/>
  137. <available property="xalan.envcheck"
  138. classname="org.apache.xalan.xslt.EnvironmentCheck"
  139. classpathref="project.class.path" />
  140. <available property="servlet.present"
  141. classname="javax.servlet.Servlet"
  142. classpathref="project.class.path"/>
  143. <available property="adaptx.present"
  144. classname="org.exolab.adaptx.xslt.XSLTProcessor"
  145. classpathref="project.class.path" />
  146. <available property="xerces.present"
  147. classname="org.apache.xerces.parsers.SAXParser"
  148. classpathref="project.class.path" />
  149. <available property="bcel.present"
  150. classname="org.apache.bcel.Constants"
  151. classpathref="project.class.path" />
  152. <condition property="javamail.complete">
  153. <and>
  154. <available classname="javax.activation.DataHandler"
  155. classpathref="project.class.path"/>
  156. <available classname="javax.mail.Transport"
  157. classpathref="project.class.path"/>
  158. </and>
  159. </condition>
  160. </target>
  161. <!-- Compiles and installs the custom build tasks -->
  162. <target name="custom-tasks">
  163. <property name="custom-tasks-dir" value="${build.dir}/tasks"/>
  164. <mkdir dir="${custom-tasks-dir}"/>
  165. <javac srcdir="src/make" destdir="${custom-tasks-dir}">
  166. <classpath refid="project.class.path"/>
  167. </javac>
  168. <copy file="${manifest.dir}/ant-descriptor.template" todir="${build.dir}/tasks"/>
  169. <copy file="${manifest.dir}/ant-roles.template" todir="${build.dir}/tasks"/>
  170. <taskdef name="antlib-jar" classname="org.apache.myrmidon.build.AntlibJarTask">
  171. <classpath location="${custom-tasks-dir}"/>
  172. </taskdef>
  173. <taskdef name="antlib-descriptor" classname="org.apache.myrmidon.build.AntlibDescriptorTask">
  174. <classpath>
  175. <pathelement location="${custom-tasks-dir}"/>
  176. <path refid="project.class.path"/>
  177. </classpath>
  178. </taskdef>
  179. </target>
  180. <!-- Compiles the source code -->
  181. <target name="compile" depends="check_for_optional_packages">
  182. <tstamp/>
  183. <mkdir dir="${build.src}"/>
  184. <copy file="${java.dir}/${constants.file}" tofile="${build.src}/${constants.file}"/>
  185. <replace file="${build.src}/${constants.file}" token="@@VERSION@@" value="${version}" />
  186. <replace file="${build.src}/${constants.file}" token="@@DATE@@" value="${TODAY}" />
  187. <property name="ant.package" value="org/apache/tools/ant"/>
  188. <property name="antlib.package" value="org/apache/antlib"/>
  189. <property name="vfs.package" value="org/apache/aut/vfs"/>
  190. <property name="optional.package" value="${ant.package}/taskdefs/optional"/>
  191. <property name="optional.type.package" value="${ant.package}/types/optional"/>
  192. <property name="util.package" value="${ant.package}/util"/>
  193. <property name="regexp.package" value="${util.package}/regexp"/>
  194. <mkdir dir="${build.classes}"/>
  195. <javac srcdir="src/main"
  196. destdir="${build.classes}"
  197. debug="${debug}"
  198. optimize="${optimize}"
  199. deprecation="${deprecation}">
  200. <classpath refid="project.class.path"/>
  201. <!--
  202. <exclude name="${constants.file}"/>
  203. <src path="${build.src}" />
  204. -->
  205. <src path="${java.dir}" />
  206. <include name="**/*.java"/>
  207. <exclude name="${regexp.package}/JakartaRegexp*.java"
  208. unless="jakarta.regexp.present" />
  209. <exclude name="${regexp.package}/JakartaOro*.java"
  210. unless="jakarta.oro.present" />
  211. <exclude name="${regexp.package}/Jdk14Regexp*.java"
  212. unless="jdk1.4+" />
  213. <exclude name="${ant.package}/AntSecurityManager.java"
  214. unless="jdk1.2+" />
  215. <exclude name="${ant.package}/listener/Log4jListener.java"
  216. unless="log4j.present" />
  217. <exclude name="${vfs.package}/provider/ftp/**" unless="netcomp.present"/>
  218. <exclude name="${vfs.package}/provider/smb/**" unless="jcifs.present"/>
  219. <exclude name="${optional.package}/IContract.java" unless="icontract.present" />
  220. <exclude name="${optional.package}/Script.java" unless="bsf.present" />
  221. <exclude name="${optional.package}/StyleBook.java" unless="stylebook.present" />
  222. <exclude name="${optional.package}/NetRexxC.java" unless="netrexx.present" />
  223. <exclude name="${antlib.package}/xml/TraXLiaison.java" unless="trax.present" />
  224. <exclude name="${antlib.package}/xml/XalanLiaison.java" unless="xalan.present" />
  225. <exclude name="${optional.package}/ejb/Ejbc*.java" unless="ejb.ejbc.present" />
  226. <exclude name="${optional.package}/ejb/DDCreator*.java" unless="ejb.DDCreator.present" />
  227. <exclude name="${optional.package}/ejb/WLRun.java" unless="ejb.wls.present" />
  228. <exclude name="${optional.package}/ejb/WLStop.java" unless="ejb.wls.present" />
  229. <exclude name="${optional.package}/ejb/EjbJar.java" unless="ejbjar.support" />
  230. <exclude name="${optional.package}/ejb/*DeploymentTool.java" unless="ejbjar.support" />
  231. <exclude name="${optional.package}/ejb/IPlanet*.java" unless="ejbjar.support" />
  232. <exclude name="${optional.package}/Javah.java" unless="jdk1.2+" />
  233. <exclude name="${optional.package}/junit/*" unless="junit.present" />
  234. <exclude name="${optional.package}/net/**.java" unless="netcomp.present" />
  235. <exclude name="${optional.package}/net/MimeMail.java" unless="javamail.complete" />
  236. <exclude name="${optional.package}/scm/AntStarTeam*.java" unless="starteam.present" />
  237. <exclude name="${optional.package}/ANTLR.java" unless="antlr.present" />
  238. <exclude name="${optional.package}/ide/VAJ*.java" unless="vaj.present" />
  239. <exclude name="${optional.package}/ide/VAJ*Servlet.java"
  240. unless="servlet.present" />
  241. <exclude name="${optional.package}/perforce/*.java" unless="jakarta.oro.present" />
  242. <exclude name="${optional.package}/sound/*.java" unless="jmf.present" />
  243. <exclude name="${optional.package}/junit/XMLResultAggregator.java"
  244. unless="trax.present" />
  245. <exclude name="${optional.package}/junit/AggregateTransformer.java"
  246. unless="trax.present" />
  247. <exclude name="${optional.package}/junit/XMLResultAggregator.java"
  248. unless="xalan2.present" />
  249. <exclude name="${optional.package}/junit/AggregateTransformer.java"
  250. unless="xalan2.present" />
  251. <exclude name="${optional.package}/junit/XalanExecutor.java"
  252. unless="xalan2.present" />
  253. <exclude name="${optional.package}/junit/Xalan2Executor.java"
  254. unless="xalan2.present" />
  255. <exclude name="${optional.package}/junit/Xalan1Executor.java"
  256. unless="xalan.present" />
  257. <exclude name="${optional.package}/jdepend/*" unless="jdepend.present" />
  258. <exclude name="${optional.package}/sitraka/**" unless="some.regexp.support"/>
  259. <exclude name="${optional.package}/metamata/MAudit*" unless="jakarta.oro.present"/>
  260. <exclude name="${optional.package}/metamata/MMetrics*"
  261. unless="trax.present"/>
  262. <exclude name="${optional.package}/metamata/**" unless="jdk1.2+" />
  263. <exclude name="${optional.package}/ManifestFile.java"
  264. unless="jdk1.2+" />
  265. <exclude name="${optional.type.package}/depend/*.java"
  266. unless="bcel.present" />
  267. <exclude name="${util.package}/depend/*.java"
  268. unless="bcel.present" />
  269. <exclude name="${optional.type.package}/depend/*.java"
  270. unless="jdk1.2+" />
  271. <exclude name="${util.package}/depend/*.java"
  272. unless="jdk1.2+" />
  273. </javac>
  274. <copy todir="${build.classes}">
  275. <fileset dir="${java.dir}">
  276. <exclude name="**/*.java"/>
  277. </fileset>
  278. </copy>
  279. </target>
  280. <target name="jar-prepare" depends="custom-tasks, compile">
  281. <mkdir dir="${build.lib}"/>
  282. <!-- Define the packaging for the various jars -->
  283. <patternset id="myrmidon-launcher.include">
  284. <include name="org/apache/myrmidon/launcher/*" />
  285. </patternset>
  286. <patternset id="myrmidon-api.include">
  287. <include name="org/apache/myrmidon/api/*" />
  288. <include name="org/apache/myrmidon/aspects/*" />
  289. <include name="org/apache/myrmidon/converter/*" />
  290. <include name="org/apache/myrmidon/interfaces/**" />
  291. <include name="org/apache/myrmidon/listeners/*" />
  292. <include name="org/apache/myrmidon/framework/**" />
  293. <include name="org/apache/aut/**" />
  294. <include name="org/apache/tools/**" />
  295. </patternset>
  296. <patternset id="myrmidon-container.include">
  297. <include name="org/apache/myrmidon/components/**" />
  298. <include name="org/apache/myrmidon/frontends/*" />
  299. <include name="org/apache/myrmidon/*" />
  300. </patternset>
  301. <patternset id="selftest.include">
  302. <include name="org/apache/antlib/selftest/**" />
  303. <exclude name="org/apache/antlib/selftest/extension1/**" />
  304. </patternset>
  305. <patternset id="selftest-extension1.include">
  306. <include name="org/apache/antlib/selftest/extension1/**" />
  307. </patternset>
  308. </target>
  309. <!-- The generation of the descriptor is kept separated from the packaging
  310. of the jars, since jarring is fast and XDoclet is pretty slow.-->
  311. <target name="antlib-descriptors"
  312. depends="jar-prepare"
  313. unless="antlib-descriptors.omit"
  314. description="Generates Antlib descriptors using XDoclet.">
  315. <!-- The "builtin" descriptors include metainfo for both
  316. myrmidon-api and myrmidon-container jars.
  317. (Packaged with myrmidon-api.jar). -->
  318. <antlib-descriptor libName="builtin"
  319. destdir="${gen.dir}"
  320. classpathref="project.class.path">
  321. <fileset dir="${java.dir}">
  322. <patternset refid="myrmidon-api.include"/>
  323. <patternset refid="myrmidon-container.include"/>
  324. </fileset>
  325. </antlib-descriptor>
  326. <antlib-descriptor libName="selftest"
  327. destdir="${gen.dir}"
  328. classpathref="project.class.path">
  329. <fileset dir="${java.dir}">
  330. <patternset refid="selftest.include"/>
  331. </fileset>
  332. </antlib-descriptor>
  333. </target>
  334. <!-- Package the jar files -->
  335. <target name="jars" depends="antlib-descriptors">
  336. <jar jarfile="${build.lib}/myrmidon-launcher.jar"
  337. basedir="${build.classes}"
  338. manifest="${manifest.dir}/myrmidon-launcher.mf">
  339. <patternset refid="myrmidon-launcher.include"/>
  340. </jar>
  341. <jar jarfile="${build.lib}/myrmidon-container.jar"
  342. basedir="${build.classes}"
  343. manifest="${manifest.dir}/myrmidon-container.mf">
  344. <patternset refid="myrmidon-container.include"/>
  345. </jar>
  346. <antlib-jar jarfile="${build.lib}/myrmidon-api.jar"
  347. basedir="${build.classes}"
  348. manifest="${manifest.dir}/myrmidon-api.mf"
  349. rolesDescriptor="${gen.dir}/builtin-ant-roles.xml"
  350. descriptor="${gen.dir}/builtin-ant-descriptor.xml"
  351. servicesDescriptor="${manifest.dir}/core-services.xml" >
  352. <patternset refid="myrmidon-api.include"/>
  353. </antlib-jar>
  354. <antlib-jar jarfile="${build.lib}/selftest.atl"
  355. basedir="${build.classes}"
  356. manifest="${manifest.dir}/selftest.mf"
  357. descriptor="${gen.dir}/selftest-ant-descriptor.xml"
  358. rolesDescriptor="${gen.dir}/selftest-ant-roles.xml">
  359. <patternset refid="selftest.include"/>
  360. </antlib-jar>
  361. <jar jarfile="${build.lib}/selftest-extension1.jar"
  362. basedir="${build.classes}"
  363. manifest="${manifest.dir}/selftest-extension1.mf">
  364. <patternset refid="selftest-extension1.include" />
  365. </jar>
  366. <!-- Simple cases handled by antlib.xml -->
  367. <ant antfile="antlib.xml">
  368. <property name="antlib.name" value="core"/>
  369. </ant>
  370. <ant antfile="antlib.xml">
  371. <property name="antlib.name" value="file"/>
  372. </ant>
  373. <ant antfile="antlib.xml">
  374. <property name="antlib.name" value="archive"/>
  375. </ant>
  376. <ant antfile="antlib.xml">
  377. <property name="antlib.name" value="cvslib"/>
  378. </ant>
  379. <ant antfile="antlib.xml">
  380. <property name="antlib.name" value="nativelib"/>
  381. </ant>
  382. <ant antfile="antlib.xml">
  383. <property name="antlib.name" value="security"/>
  384. </ant>
  385. <ant antfile="antlib.xml">
  386. <property name="antlib.name" value="runtime"/>
  387. </ant>
  388. <ant antfile="antlib.xml">
  389. <property name="antlib.name" value="sound"/>
  390. </ant>
  391. <ant antfile="antlib.xml">
  392. <property name="antlib.name" value="vfile"/>
  393. </ant>
  394. </target>
  395. <!-- Compiles and runs the unit tests -->
  396. <target name="test" depends="dist-lite" if="junit.present" description="Runs the unit tests">
  397. <!-- Compile the unit tests -->
  398. <mkdir dir="${test.classes}"/>
  399. <javac srcdir="src/testcases"
  400. destdir="${test.classes}"
  401. debug="${debug}"
  402. optimize="${optimize}"
  403. deprecation="${deprecation}">
  404. <classpath refid="project.class.path"/>
  405. </javac>
  406. <!-- Prepare test files -->
  407. <delete dir="${test.working.dir}"/>
  408. <copy todir="${test.working.dir}">
  409. <fileset dir="etc/testcases"/>
  410. </copy>
  411. <!-- Prepare a dummy installation -->
  412. <copy todir="${test.working.dir}/dist">
  413. <fileset dir="${dist.dir}"/>
  414. </copy>
  415. <!-- Prepare the VFS tests -->
  416. <property name="test.vfs.dir" location="${test.working.dir}/org/apache/aut/vfs"/>
  417. <mkdir dir="${test.vfs.dir}/write-tests"/>
  418. <mkdir dir="${test.vfs.dir}/basedir/emptydir"/>
  419. <zip zipfile="${test.vfs.dir}/test.zip">
  420. <fileset dir="${test.vfs.dir}" includes="basedir/**"/>
  421. </zip>
  422. <!-- Prepare deployer tests -->
  423. <property name="test.deployer.dir"
  424. value="${test.working.dir}/org/apache/myrmidon/components/deployer"/>
  425. <mkdir dir="${test.deployer.dir}"/>
  426. <jar jarfile="${test.deployer.dir}/test.atl">
  427. <zipfileset dir="etc/testcases/org/apache/myrmidon/components/deployer"
  428. prefix="META-INF"
  429. includes="*.xml"/>
  430. </jar>
  431. <!-- Prepare type factory tests -->
  432. <mkdir dir="${test.working.dir}/org/apache/myrmidon/interfaces/type"/>
  433. <jar jarfile="${test.working.dir}/org/apache/myrmidon/interfaces/type/types.jar">
  434. <fileset dir="${test.classes}" includes="org/apache/myrmidon/interfaces/type/MyType1.class"/>
  435. </jar>
  436. <!-- Prepare the project tests -->
  437. <copy file="src/manifest/testcases-ant-descriptor.xml" tofile="${test.classes}/META-INF/ant-descriptor.xml"/>
  438. <!-- Run all the tests -->
  439. <junit printsummary="on"
  440. fork="false">
  441. <formatter type="brief" usefile="false"/>
  442. <classpath>
  443. <fileset dir="${test.working.dir}/dist/bin/lib" includes="**/*.jar"/>
  444. <fileset dir="${test.working.dir}/dist/lib" includes="**/*.jar, **/*.atl" excludes="crimson.jar"/>
  445. </classpath>
  446. <classpath location="${test.classes}"/>
  447. <!-- Pass config to the tests -->
  448. <sysproperty key="test.basedir" value="${test.working.dir}"/>
  449. <sysproperty key="test.smb.uri" value="smb://${vfs.user}:${vfs.password}@${vfs.host}/${vfs.user}/vfs"/>
  450. <sysproperty key="test.ftp.uri" value="ftp://${vfs.user}:${vfs.password}@${vfs.host}/home/${vfs.user}/vfs"/>
  451. <batchtest>
  452. <fileset dir="${test.classes}">
  453. <include name="**/*Test.class" unless="single.test"/>
  454. <exclude name="**/Abstract*Test.class"/>
  455. <include name="**/${single.test}Test.class" if="single.test"/>
  456. <exclude name="**/BzipTest.class" unless="test.bzip"/>
  457. <exclude name="**/SmbFileSystemTest.class" unless="test.smb"/>
  458. <exclude name="**/FtpFileSystemTest.class" unless="test.ftp"/>
  459. </fileset>
  460. </batchtest>
  461. </junit>
  462. </target>
  463. <!-- Creates the distribution -->
  464. <target name="dist-lite"
  465. depends="jars"
  466. description="Generates a minimal working distribution.">
  467. <mkdir dir="${dist.bin}"/>
  468. <mkdir dir="${dist.lib}"/>
  469. <mkdir dir="${dist.ext}"/>
  470. <copy file="${build.lib}/myrmidon-launcher.jar" tofile="${dist.bin}/myrmidon-launcher.jar" />
  471. <copy file="${build.lib}/myrmidon-container.jar" tofile="${dist.bin}/lib/myrmidon-container.jar" />
  472. <copy todir="${dist.lib}">
  473. <fileset dir="${build.lib}">
  474. <exclude name="selftest.atl"/>
  475. <exclude name="myrmidon-container.jar"/>
  476. <exclude name="myrmidon-launcher.jar"/>
  477. </fileset>
  478. </copy>
  479. <copy todir="${dist.ext}">
  480. <fileset dir="${build.lib}">
  481. <include name="selftest.atl"/>
  482. <include name="selftest-extension1.jar"/>
  483. </fileset>
  484. </copy>
  485. <copy todir="${dist.lib}">
  486. <fileset dir="${lib.dir}">
  487. <exclude name="ant.jar"/>
  488. </fileset>
  489. </copy>
  490. <copy todir="${dist.bin}">
  491. <fileset dir="${script.dir}"/>
  492. </copy>
  493. <chmod dir="${dist.dir}" perm="go-rwx" />
  494. <chmod file="${dist.bin}/ant" perm="u+x"/>
  495. <fixcrlf srcdir="${dist.bin}" eol="crlf" includes="**/*.bat" />
  496. <fixcrlf srcdir="${dist.bin}" eol="lf" includes="**/*.sh" />
  497. <fixcrlf srcdir="${dist.bin}" eol="lf" includes="ant" />
  498. </target>
  499. <target name="dist-extralite"
  500. description="A faster version of dist-lite (no XDoclet).">
  501. <property name="antlib-descriptors.omit" value="true"/>
  502. <antcall target="dist-lite"/>
  503. </target>
  504. <!-- Creates the distribution -->
  505. <target name="dist" depends="dist-lite,test" description="Builds the distribution"/>
  506. <!-- Cleans up build and distribution directories -->
  507. <target name="clean" description="Deletes all built files">
  508. <delete dir="${build.dir}"/>
  509. <delete dir="${dist.dir}" failonerror="false"/>
  510. <delete>
  511. <fileset dir="." includes="**/*~" defaultexcludes="no"/>
  512. </delete>
  513. </target>
  514. <!-- Cleans up the compiled classes -->
  515. <target name="clean-classes">
  516. <delete dir="${build.classes}"/>
  517. </target>
  518. <!-- Rebuilds the distribution -->
  519. <target name="rebuild" description="Rebuilds the distribution">
  520. <antcall target="clean"/>
  521. <antcall target="main"/>
  522. </target>
  523. <!-- Recompiles the classes, and builds the distribution -->
  524. <target name="recompile" description="Recompiles and builds the the distribution">
  525. <antcall target="clean-classes"/>
  526. <antcall target="main"/>
  527. </target>
  528. </project>