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 33 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797
  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.bin" value="${build.dir}/bin"/>
  37. <property name="build.ext" value="${build.dir}/ext"/>
  38. <property name="build.src" value="${build.dir}/src"/>
  39. <property name="build.classes" value="${build.dir}/classes"/>
  40. <property name="build.custom-tasks" value="${build.dir}/tasks"/>
  41. <property name="src.base" value="src"/>
  42. <property name="manifest.dir" value="${src.base}/manifest"/>
  43. <property name="java.dir" value="${src.base}/java"/>
  44. <property name="script.dir" value="${src.base}/script"/>
  45. <property name="lib.dir" value="lib"/>
  46. <property name="dist.name" value="${Name}-${version}"/>
  47. <property name="dist.dir" value="dist"/>
  48. <property name="dist.bin" value="${dist.dir}/bin"/>
  49. <property name="dist.lib" value="${dist.dir}/lib"/>
  50. <property name="dist.ext" value="${dist.dir}/ext"/>
  51. <property name="gen.dir" value="${build.dir}/gen"/>
  52. <property name="test.dir" value="${build.dir}/test"/>
  53. <property name="test.working.dir" value="${test.dir}/test"/>
  54. <property name="test.classes" value="${test.dir}/classes"/>
  55. <property name="test.fork" value="true"/>
  56. <property name="constants.file" value="org/apache/myrmidon/Constants.java"/>
  57. <path id="tools.class.path">
  58. <fileset dir="tools/lib" includes="**/*.jar"/>
  59. <fileset dir="../xdocs/lib" includes="*.jar" />
  60. </path>
  61. <path id="project.class.path">
  62. <pathelement location="../../lib/optional/junit.jar" />
  63. <fileset dir="${lib.dir}" includes="**/*.jar"/>
  64. <pathelement location="${build.classes}"/>
  65. <!-- Need this to get tools.jar in the classpath -->
  66. <pathelement path="${java.class.path}"/>
  67. <path refid="tools.class.path"/>
  68. </path>
  69. <!-- Main target -->
  70. <target name="main" depends="dist-lite" description="Builds the distribution"/>
  71. <!-- lets see what is available -->
  72. <target name="check_for_optional_packages">
  73. <available property="jdk1.2+" classname="java.lang.ThreadLocal" />
  74. <available property="jdk1.3+" classname="java.lang.StrictMath" />
  75. <available property="jdk1.4+" classname="java.lang.CharSequence" />
  76. <available property="bsf.present"
  77. classname="com.ibm.bsf.BSFManager"
  78. classpathref="project.class.path" />
  79. <available property="netrexx.present"
  80. classname="netrexx.lang.Rexx"
  81. classpathref="project.class.path" />
  82. <available property="trax.present"
  83. classname="javax.xml.transform.Transformer"
  84. classpathref="project.class.path" />
  85. <available property="xslp.present"
  86. classname="com.kvisco.xsl.XSLProcessor"
  87. classpathref="project.class.path" />
  88. <available property="xalan.present"
  89. classname="org.apache.xalan.xslt.XSLTProcessorFactory"
  90. classpathref="project.class.path" />
  91. <available property="xalan2.present"
  92. classname="org.apache.xalan.transformer.TransformerImpl"
  93. classpathref="project.class.path" />
  94. <available property="ejb.ejbc.present"
  95. classname="weblogic.ejbc"
  96. classpathref="project.class.path" />
  97. <available property="ejb.DDCreator.present"
  98. classname="weblogic.ejb.utils.DDCreator"
  99. classpathref="project.class.path" />
  100. <available property="ejb.wls.present"
  101. classname="weblogic.Server"
  102. classpathref="project.class.path" />
  103. <available property="junit.present"
  104. classname="junit.framework.TestCase"
  105. classpathref="project.class.path" />
  106. <available property="netcomp.present"
  107. classname="com.oroinc.net.ftp.FTPClient"
  108. classpathref="project.class.path" />
  109. <available property="jcifs.present"
  110. classname="jcifs.smb.SmbFile"
  111. classpathref="project.class.path" />
  112. <available property="starteam.present"
  113. classname="com.starbase.util.Platform"
  114. classpathref="project.class.path" />
  115. <available property="antlr.present"
  116. classname="antlr.Tool"
  117. classpathref="project.class.path"/>
  118. <available property="vaj.present"
  119. classname="com.ibm.ivj.util.base.Workspace"
  120. classpathref="project.class.path"/>
  121. <available property="stylebook.present"
  122. classname="org.apache.stylebook.Engine"
  123. classpathref="project.class.path"/>
  124. <available property="jakarta.regexp.present"
  125. classname="org.apache.regexp.RE"
  126. classpathref="project.class.path"/>
  127. <available property="jakarta.oro.present"
  128. classname="org.apache.oro.text.regex.Perl5Matcher"
  129. classpathref="project.class.path" />
  130. <available property="jmf.present"
  131. classname="javax.sound.sampled.Clip"
  132. classpathref="project.class.path"/>
  133. <available property="icontract.present"
  134. classname="com.reliablesystems.iContract.IContracted"
  135. classpathref="project.class.path"/>
  136. <available property="jdepend.present"
  137. classname="jdepend.framework.JDepend"
  138. classpathref="project.class.path"/>
  139. <available property="log4j.present"
  140. classname="org.apache.log4j.Category"
  141. classpathref="project.class.path"/>
  142. <!-- this is just a way to check for a TraX implementation -->
  143. <available property="trax.impl.present"
  144. resource="META-INF/services/javax.xml.transform.TransformerFactory"
  145. classpathref="project.class.path"/>
  146. <available property="xalan.envcheck"
  147. classname="org.apache.xalan.xslt.EnvironmentCheck"
  148. classpathref="project.class.path" />
  149. <available property="servlet.present"
  150. classname="javax.servlet.Servlet"
  151. classpathref="project.class.path"/>
  152. <available property="adaptx.present"
  153. classname="org.exolab.adaptx.xslt.XSLTProcessor"
  154. classpathref="project.class.path" />
  155. <available property="xerces.present"
  156. classname="org.apache.xerces.parsers.SAXParser"
  157. classpathref="project.class.path" />
  158. <available property="bcel.present"
  159. classname="org.apache.bcel.Constants"
  160. classpathref="project.class.path" />
  161. <condition property="javamail.complete">
  162. <and>
  163. <available classname="javax.activation.DataHandler"
  164. classpathref="project.class.path"/>
  165. <available classname="javax.mail.Transport"
  166. classpathref="project.class.path"/>
  167. </and>
  168. </condition>
  169. <!-- Check for Ant version 1.5 -->
  170. <property resource="org/apache/tools/ant/version.txt"
  171. classpath="${java.class.path}"/>
  172. <condition property="ant1.5">
  173. <or>
  174. <equals arg1="${VERSION}" arg2="1.5alpha"/>
  175. <equals arg1="${VERSION}" arg2="1.5"/>
  176. </or>
  177. </condition>
  178. </target>
  179. <!-- Compiles and installs the custom build tasks -->
  180. <target name="custom-tasks">
  181. <property name="custom-package-dir" value="${build.custom-tasks}/org/apache/myrmidon/build"/>
  182. <mkdir dir="${build.custom-tasks}"/>
  183. <javac srcdir="src/make" destdir="${build.custom-tasks}">
  184. <classpath refid="tools.class.path"/>
  185. </javac>
  186. <copy file="${manifest.dir}/ant-descriptor.j" todir="${custom-package-dir}"/>
  187. <copy file="${manifest.dir}/ant-roles.j" todir="${custom-package-dir}"/>
  188. <!-- <copy file="${manifest.dir}/type.j" todir="${custom-package-dir}"/> -->
  189. <taskdef name="antlib-jar" classname="org.apache.myrmidon.build.AntlibJarTask">
  190. <classpath location="${build.custom-tasks}"/>
  191. </taskdef>
  192. <taskdef name="antlib-descriptor"
  193. classname="org.apache.myrmidon.build.AntlibDescriptorTask">
  194. <classpath>
  195. <pathelement location="${build.custom-tasks}"/>
  196. <path refid="tools.class.path"/>
  197. </classpath>
  198. </taskdef>
  199. </target>
  200. <!-- Compiles the source code -->
  201. <target name="compile" depends="check_for_optional_packages, setup-patterns">
  202. <tstamp/>
  203. <mkdir dir="${build.src}"/>
  204. <copy file="${java.dir}/${constants.file}" tofile="${build.src}/${constants.file}"/>
  205. <replace file="${build.src}/${constants.file}" token="@@VERSION@@" value="${version}" />
  206. <replace file="${build.src}/${constants.file}" token="@@DATE@@" value="${TODAY}" />
  207. <mkdir dir="${build.classes}"/>
  208. <javac
  209. destdir="${build.classes}"
  210. debug="${debug}"
  211. deprecation="${deprecation}"
  212. includeAntRuntime="false"
  213. includeJavaRuntime="false">
  214. <classpath refid="project.class.path"/>
  215. <src location="src/todo"/>
  216. <src path="${java.dir}" />
  217. <!--
  218. <exclude name="${constants.file}"/>
  219. <src path="${build.src}" />
  220. -->
  221. <patternset refid="myrmidon-framework.include"/>
  222. <patternset refid="ant1.todo.include"/>
  223. <patternset refid="selftest.include"/>
  224. <patternset refid="selftest-extension1.include"/>
  225. <include name="org/apache/antlib/**"/>
  226. </javac>
  227. <copy todir="${build.classes}">
  228. <fileset dir="${java.dir}">
  229. <exclude name="**/*.java"/>
  230. </fileset>
  231. </copy>
  232. </target>
  233. <target name="setup-patterns" depends="check_for_optional_packages">
  234. <patternset id="myrmidon-framework.include">
  235. <include name="org/apache/myrmidon/interfaces/**" />
  236. <include name="org/apache/myrmidon/framework/**" />
  237. </patternset>
  238. <property name="ant.package" value="org/apache/tools/todo"/>
  239. <property name="taskdefs.package" value="${ant.package}/taskdefs"/>
  240. <property name="antlib.package" value="org/apache/antlib"/>
  241. <property name="optional.type.package" value="${ant.package}/types/optional"/>
  242. <property name="util.package" value="${ant.package}/util"/>
  243. <property name="regexp.package" value="${util.package}/regexp"/>
  244. <patternset id="ant1.todo.include">
  245. <include name="org/apache/tools/todo/**" />
  246. <exclude name="${regexp.package}/JakartaRegexp*.java"
  247. unless="jakarta.regexp.present" />
  248. <exclude name="${regexp.package}/JakartaOro*.java"
  249. unless="jakarta.oro.present" />
  250. <exclude name="${regexp.package}/Jdk14Regexp*.java"
  251. unless="jdk1.4+" />
  252. <exclude name="${ant.package}/AntSecurityManager.java"
  253. unless="jdk1.2+" />
  254. <exclude name="${ant.package}/listener/Log4jListener.java"
  255. unless="log4j.present" />
  256. <exclude name="${taskdefs.package}/IContract.java"
  257. unless="icontract.present" />
  258. <exclude name="${taskdefs.package}/Script.java"
  259. unless="bsf.present" />
  260. <exclude name="${taskdefs.package}/stylebook/StyleBook.java"
  261. unless="stylebook.present" />
  262. <exclude name="${taskdefs.package}/NetRexxC.java"
  263. unless="netrexx.present" />
  264. <exclude name="${antlib.package}/xml/TraXLiaison.java"
  265. unless="trax.present" />
  266. <exclude name="${antlib.package}/xml/XalanLiaison.java"
  267. unless="xalan.present" />
  268. <exclude name="${taskdefs.package}/Javah.java"
  269. unless="jdk1.2+" />
  270. <exclude name="${taskdefs.package}/junit/*"
  271. unless="junit.present" />
  272. <exclude name="${taskdefs.package}/net/**.java"
  273. unless="netcomp.present" />
  274. <exclude name="${taskdefs.package}/net/MimeMail.java"
  275. unless="javamail.complete" />
  276. <exclude name="${taskdefs.package}/scm/AntStarTeam*.java"
  277. unless="starteam.present" />
  278. <exclude name="${taskdefs.package}/ANTLR.java"
  279. unless="antlr.present" />
  280. <exclude name="${taskdefs.package}/perforce/*.java"
  281. unless="jakarta.oro.present" />
  282. <exclude name="${taskdefs.package}/junit/XMLResultAggregator.java"
  283. unless="trax.present" />
  284. <exclude name="${taskdefs.package}/junit/AggregateTransformer.java"
  285. unless="trax.present" />
  286. <exclude name="${taskdefs.package}/junit/XMLResultAggregator.java"
  287. unless="xalan2.present" />
  288. <exclude name="${taskdefs.package}/junit/AggregateTransformer.java"
  289. unless="xalan2.present" />
  290. <exclude name="${taskdefs.package}/junit/XalanExecutor.java"
  291. unless="xalan2.present" />
  292. <exclude name="${taskdefs.package}/junit/Xalan2Executor.java"
  293. unless="xalan2.present" />
  294. <exclude name="${taskdefs.package}/junit/Xalan1Executor.java"
  295. unless="xalan.present" />
  296. <exclude name="${taskdefs.package}/jdepend/*"
  297. unless="jdepend.present" />
  298. <exclude name="${taskdefs.package}/sitraka/**"
  299. unless="some.regexp.support"/>
  300. <exclude name="${taskdefs.package}/metamata/MAudit*"
  301. unless="jakarta.oro.present"/>
  302. <exclude name="${taskdefs.package}/metamata/MMetrics*"
  303. unless="trax.present"/>
  304. <exclude name="${taskdefs.package}/metamata/**"
  305. unless="jdk1.2+" />
  306. <exclude name="${optional.type.package}/depend/*.java"
  307. unless="bcel.present" />
  308. <exclude name="${util.package}/depend/*.java"
  309. unless="bcel.present" />
  310. <exclude name="${optional.type.package}/depend/*.java"
  311. unless="jdk1.2+" />
  312. <exclude name="${util.package}/depend/*.java"
  313. unless="jdk1.2+" />
  314. </patternset>
  315. <patternset id="selftest.include">
  316. <include name="org/apache/antlib/selftest/**" />
  317. <exclude name="org/apache/antlib/selftest/extension1/**" />
  318. </patternset>
  319. <patternset id="selftest-extension1.include">
  320. <include name="org/apache/antlib/selftest/extension1/**" />
  321. </patternset>
  322. </target>
  323. <!-- The generation of the descriptor is kept separated from the packaging
  324. of the jars, since jarring is fast and XDoclet is really slow.-->
  325. <target name="antlib-descriptors"
  326. depends="setup-patterns, custom-tasks"
  327. unless="antlib-descriptors.omit"
  328. description="Generates Antlib descriptors using XDoclet.">
  329. <antlib-descriptor libName="builtin"
  330. destdir="${gen.dir}"
  331. classpathref="project.class.path">
  332. <fileset dir="${java.dir}">
  333. <patternset refid="myrmidon-framework.include"/>
  334. </fileset>
  335. </antlib-descriptor>
  336. <antlib-descriptor libName="selftest"
  337. destdir="${gen.dir}"
  338. classpathref="project.class.path">
  339. <fileset dir="${java.dir}">
  340. <patternset refid="selftest.include"/>
  341. </fileset>
  342. </antlib-descriptor>
  343. </target>
  344. <target name="test-xdocs" depends="antlib-descriptors" description="Generate documentation for antlibs">
  345. <!-- start to test xdocs generation -->
  346. <ant antfile="antlib.xml" target="antlib-docs">
  347. <property name="antlib.name" value="core"/>
  348. </ant>
  349. </target>
  350. <!-- Package the jar files -->
  351. <target name="jars" depends="custom-tasks, compile, antlib-descriptors">
  352. <mkdir dir="${build.bin}"/>
  353. <mkdir dir="${build.bin}/lib"/>
  354. <mkdir dir="${build.lib}"/>
  355. <mkdir dir="${build.ext}"/>
  356. <antlib-jar jarfile="${build.lib}/myrmidon-framework.jar"
  357. basedir="${build.classes}"
  358. manifest="${manifest.dir}/myrmidon-api.mf"
  359. rolesDescriptor="${gen.dir}/builtin-ant-roles.xml"
  360. descriptor="${gen.dir}/builtin-ant-descriptor.xml"
  361. servicesDescriptor="${manifest.dir}/core-services.xml" >
  362. <patternset refid="myrmidon-framework.include"/>
  363. </antlib-jar>
  364. <antlib-jar jarfile="${build.lib}/ant1_todo.jar"
  365. basedir="${build.classes}"
  366. descriptor="${manifest.dir}/ant1-ant-descriptor.xml" >
  367. <patternset refid="ant1.todo.include"/>
  368. </antlib-jar>
  369. <antlib-jar jarfile="${build.ext}/selftest.atl"
  370. basedir="${build.classes}"
  371. manifest="${manifest.dir}/selftest.mf"
  372. descriptor="${gen.dir}/selftest-ant-descriptor.xml"
  373. rolesDescriptor="${gen.dir}/selftest-ant-roles.xml">
  374. <patternset refid="selftest.include"/>
  375. </antlib-jar>
  376. <jar jarfile="${build.ext}/selftest-extension1.jar"
  377. basedir="${build.classes}"
  378. manifest="${manifest.dir}/selftest-extension1.mf">
  379. <patternset refid="selftest-extension1.include" />
  380. </jar>
  381. <!-- Simple cases handled by antlib.xml -->
  382. <ant antfile="antlib.xml">
  383. <property name="antlib.name" value="core"/>
  384. </ant>
  385. <ant antfile="antlib.xml">
  386. <property name="antlib.name" value="extensions"/>
  387. </ant>
  388. <ant antfile="antlib.xml">
  389. <property name="antlib.name" value="file"/>
  390. </ant>
  391. <ant antfile="antlib.xml">
  392. <property name="antlib.name" value="archive"/>
  393. </ant>
  394. <ant antfile="antlib.xml">
  395. <property name="antlib.name" value="cvslib"/>
  396. </ant>
  397. <ant antfile="antlib.xml">
  398. <property name="antlib.name" value="nativelib"/>
  399. </ant>
  400. <ant antfile="antlib.xml">
  401. <property name="antlib.name" value="security"/>
  402. </ant>
  403. <ant antfile="antlib.xml">
  404. <property name="antlib.name" value="runtime"/>
  405. </ant>
  406. <ant antfile="antlib.xml">
  407. <property name="antlib.name" value="sound"/>
  408. </ant>
  409. <ant antfile="antlib.xml">
  410. <property name="antlib.name" value="vfile"/>
  411. </ant>
  412. <ant antfile="antlib.xml">
  413. <property name="antlib.name" value="java"/>
  414. </ant>
  415. <ant antfile="antlib.xml">
  416. <property name="antlib.name" value="build"/>
  417. </ant>
  418. <!-- Create the Ant1 compatibility layer -->
  419. <ant antfile="ant1compat.xml"/>
  420. </target>
  421. <!-- Compiles and runs the unit tests -->
  422. <target name="run-tests" depends="dist-lite" if="junit.present">
  423. <property name="test.classloader.pkg" value="org/apache/myrmidon/components/classloader/test/libs"/>
  424. <!-- Compile the unit tests -->
  425. <mkdir dir="${test.classes}"/>
  426. <javac srcdir="src/test"
  427. destdir="${test.classes}"
  428. debug="${debug}"
  429. deprecation="${deprecation}">
  430. <classpath>
  431. <pathelement location="${build.classes}"/>
  432. <path refid="project.class.path"/>
  433. <path refid="tools.class.path"/>
  434. </classpath>
  435. <exclude name="${test.classloader.pkg}/**"/>
  436. </javac>
  437. <!-- Prepare test files -->
  438. <delete dir="${test.working.dir}"/>
  439. <!-- Prepare a dummy installation -->
  440. <copy todir="${test.working.dir}/dist">
  441. <fileset dir="${dist.dir}"/>
  442. </copy>
  443. <!-- Copy the resources from source tree into working test dir -->
  444. <copy todir="${test.working.dir}">
  445. <fileset dir="src/test">
  446. <exclude name="**/*.java"/>
  447. </fileset>
  448. </copy>
  449. <!-- Prepare deployer tests -->
  450. <property name="test.deployer.dir"
  451. value="${test.working.dir}/org/apache/myrmidon/components/deployer/test"/>
  452. <mkdir dir="${test.deployer.dir}"/>
  453. <jar jarfile="${test.deployer.dir}/test.atl">
  454. <zipfileset dir="${test.deployer.dir}" prefix="META-INF" includes="*.xml"/>
  455. </jar>
  456. <!-- Prepare type factory tests -->
  457. <property name="test.type.dir"
  458. value="${test.working.dir}/org/apache/myrmidon/interfaces/type/test"/>
  459. <mkdir dir="${test.type.dir}"/>
  460. <jar jarfile="${test.type.dir}/types.jar">
  461. <fileset dir="${test.classes}" includes="org/apache/myrmidon/interfaces/type/test/MyType1.class"/>
  462. </jar>
  463. <!-- Prepare the class loader manager tests -->
  464. <property name="test.classloader.dir" value="${test.working.dir}/${test.classloader.pkg}/.."/>
  465. <property name="test.classloader.classes" value="${test.dir}/classloader"/>
  466. <mkdir dir="${test.classloader.dir}"/>
  467. <mkdir dir="${test.classloader.dir}/ext"/>
  468. <mkdir dir="${test.classloader.classes}"/>
  469. <javac srcdir="src/test"
  470. destdir="${test.classloader.classes}"
  471. debug="${debug}"
  472. deprecation="${deprecation}">
  473. <include name="${test.classloader.pkg}/**"/>
  474. </javac>
  475. <copy todir="${test.classloader.classes}">
  476. <fileset dir="src/test">
  477. <include name="${test.classloader.pkg}/**"/>
  478. <exclude name="**/*.java"/>
  479. </fileset>
  480. </copy>
  481. <jar jarfile="${test.classloader.dir}/common.jar">
  482. <fileset dir="${test.classloader.classes}">
  483. <include name="**/shared/**"/>
  484. </fileset>
  485. </jar>
  486. <jar jarfile="${test.classloader.dir}/no-dependencies.jar">
  487. <fileset dir="${test.classloader.classes}">
  488. <include name="**/shared/**"/>
  489. <include name="**/unshared/**"/>
  490. </fileset>
  491. </jar>
  492. <jar jarfile="${test.classloader.dir}/one-dependency.jar"
  493. manifest="src/test/${test.classloader.pkg}/one-dependency.mf">
  494. <fileset dir="${test.classloader.classes}">
  495. <include name="**/shared/**"/>
  496. <include name="**/unshared/**"/>
  497. </fileset>
  498. </jar>
  499. <copy file="${test.classloader.dir}/one-dependency.jar"
  500. tofile="${test.classloader.dir}/one-dependency-2.jar"/>
  501. <jar jarfile="${test.classloader.dir}/ext/simple-extension.jar"
  502. manifest="src/test/${test.classloader.pkg}/simple-extension.mf" >
  503. <fileset dir="${test.classloader.classes}">
  504. <include name="**/shared/**"/>
  505. <include name="**/extn/**"/>
  506. </fileset>
  507. </jar>
  508. <jar jarfile="${test.classloader.dir}/ext/cycle-extension-1.jar"
  509. manifest="src/test/${test.classloader.pkg}/cycle-extension-1.mf" />
  510. <jar jarfile="${test.classloader.dir}/ext/cycle-extension-2.jar"
  511. manifest="src/test/${test.classloader.pkg}/cycle-extension-2.mf" />
  512. <!-- Prepare the project tests -->
  513. <antlib-descriptor libName="unittests"
  514. destdir="${gen.dir}">
  515. <classpath refid="project.class.path"/>
  516. <classpath refid="tools.class.path"/>
  517. <fileset dir="src/test">
  518. <include name="org/apache/antlib/**"/>
  519. <include name="org/apache/myrmidon/framework/**"/>
  520. </fileset>
  521. </antlib-descriptor>
  522. <copy file="${gen.dir}/unittests-ant-descriptor.xml"
  523. tofile="${test.classes}/META-INF/ant-descriptor.xml"/>
  524. <!-- Run all the tests -->
  525. <junit printsummary="on"
  526. fork="${test.fork}" failureProperty="test.failed">
  527. <formatter type="brief" usefile="false"/>
  528. <classpath>
  529. <fileset dir="${test.working.dir}/dist/bin/lib" includes="**/*.jar"/>
  530. <fileset dir="${test.working.dir}/dist/lib" includes="**/*.jar, **/*.atl"/>
  531. </classpath>
  532. <classpath refid="tools.class.path"/>
  533. <classpath location="${test.classes}"/>
  534. <!-- Pass config to the tests -->
  535. <sysproperty key="test.basedir" value="${test.working.dir}"/>
  536. <sysproperty key="test.smb.uri" value="smb://${vfs.user}:${vfs.password}@${vfs.host}/${vfs.user}/vfs"/>
  537. <sysproperty key="test.ftp.uri" value="ftp://${vfs.user}:${vfs.password}@${vfs.host}/vfs"/>
  538. <batchtest>
  539. <fileset dir="${test.classes}">
  540. <include name="**/*TestCase.class" unless="single.test"/>
  541. <exclude name="**/Abstract*TestCase.class"/>
  542. <include name="**/${single.test}TestCase.class" if="single.test"/>
  543. <exclude name="**/BzipTestCase.class" unless="test.bzip"/>
  544. <exclude name="**/SmbFileSystemTestCase.class" unless="test.smb"/>
  545. <exclude name="**/FtpFileSystemTestCase.class" unless="test.ftp"/>
  546. <!-- Need Ant1.5+ to run Ant1Compat tests, because of classpath
  547. problems in Ant1.4 JUnit Task (prepends ant.jar to classpath) -->
  548. <exclude name="**/Ant1CompatTestCase.class" unless="ant1.5"/>
  549. <!-- This test fails, as it has no test methods -->
  550. <exclude name="**/SimpleConvertersTestCase.class" unless="single.test"/>
  551. </fileset>
  552. </batchtest>
  553. </junit>
  554. </target>
  555. <target name="test" if="test.failed" depends="run-tests" description="Runs the unit tests">
  556. <fail> - One or more tests failed.</fail>
  557. </target>
  558. <target name="checkstyle" description="Checkstyle">
  559. <property name="checkstyle.dir" value="${java.dir}"/>
  560. <!-- this invocation of checkstyle requires that checkstyle be downloaded and setup -->
  561. <!-- thats why you are required to define do.checkstyle property to generate the report -->
  562. <taskdef name="checkstyle"
  563. classname="com.puppycrawl.tools.checkstyle.CheckStyleTask">
  564. <classpath refid="tools.class.path"/>
  565. </taskdef>
  566. <checkstyle
  567. lcurlyType="nl"
  568. lcurlyMethod="nl"
  569. lcurlyOther="nl"
  570. rcurly="ignore"
  571. allowProtected="false"
  572. allowPackage="false"
  573. allowNoAuthor="false"
  574. maxLineLen="100"
  575. maxMethodLen="100"
  576. maxConstructorLen="100"
  577. memberPattern="^m_[a-z][a-zA-Z0-9]*$"
  578. staticPattern="^c_[a-z][a-zA-Z0-9]*$"
  579. constPattern="(^c_[a-z][a-zA-Z0-9]*$)|([A-Z_]*$)"
  580. ignoreImportLen="true"
  581. allowTabs="false"
  582. javadocScope="protected"
  583. ignoreWhitespace="true"
  584. cacheFile="checkstyle.cache"
  585. failOnViolation="false"
  586. ignoreCastWhitespace="true">
  587. <fileset dir="${checkstyle.dir}">
  588. <include name="**/*.java"/>
  589. </fileset>
  590. <formatter type="plain"/>
  591. <formatter type="xml" toFile="build/checkstyle-results.xml"/>
  592. </checkstyle>
  593. </target>
  594. <target name="checkstyle-report"
  595. depends="checkstyle"
  596. if="do.checkstyle"
  597. description="Generate Checkstyle Report">
  598. <mkdir dir="${build.reports}/checkstyle"/>
  599. <style style="../../src/etc/checkstyle-frames.xsl" in="build/checkstyle-results.xml"
  600. out="${build.reports}/checkstyle/delete-me.html"/>
  601. </target>
  602. <target name="jdepend" description="Generate Dependency Analysis Report">
  603. <path id="java.src">
  604. <pathelement location="src/test"/>
  605. <pathelement location="src/java"/>
  606. </path>
  607. <!-- this invocation of jdepend requires the CVS version of ant for the xml format -->
  608. <jdepend outputfile="${build.dir}/jdepend-results.xml" format="xml" fork="yes">
  609. <classpath refid="tools.class.path"/>
  610. <sourcespath>
  611. <path refid="java.src" />
  612. </sourcespath>
  613. </jdepend>
  614. <property name="build.reports" value="${build.dir}/reports"/>
  615. <mkdir dir="${build.reports}/jdepend"/>
  616. <style in="${build.dir}/jdepend-results.xml"
  617. processor="trax"
  618. out="${build.reports}/jdepend/delete-me.txt"
  619. style="${ant.home}/etc/jdepend-frames.xsl"/>
  620. </target>
  621. <target name="javadoc" description="Generates the API docs.">
  622. <property name="build.apidocs" value="${build.dir}/apidocs"/>
  623. <mkdir dir="${build.apidocs}"/>
  624. <javadoc destdir="${build.apidocs}" packagenames="org.apache.*">
  625. <sourcepath>
  626. <pathelement location="${java.dir}"/>
  627. </sourcepath>
  628. <classpath refid="project.class.path"/>
  629. </javadoc>
  630. </target>
  631. <!-- Creates the distribution -->
  632. <target name="dist-lite"
  633. depends="jars"
  634. description="Generates a minimal working distribution.">
  635. <mkdir dir="${dist.bin}"/>
  636. <mkdir dir="${dist.lib}"/>
  637. <mkdir dir="${dist.ext}"/>
  638. <copy todir="${dist.bin}">
  639. <fileset dir="${build.bin}"/>
  640. <fileset dir="${lib.dir}/bin"/>
  641. </copy>
  642. <copy todir="${dist.lib}">
  643. <fileset dir="${build.lib}"/>
  644. <fileset dir="${lib.dir}" includes="*.jar, *.zip"/>
  645. <fileset dir="../../lib/optional" includes="junit.jar" />
  646. </copy>
  647. <copy todir="${dist.ext}">
  648. <fileset dir="${build.ext}"/>
  649. <fileset dir="${lib.dir}/ext"/>
  650. </copy>
  651. <copy todir="${dist.bin}">
  652. <fileset dir="${script.dir}"/>
  653. </copy>
  654. <chmod dir="${dist.dir}" perm="go-rwx" />
  655. <chmod file="${dist.bin}/ant" perm="u+x"/>
  656. <fixcrlf srcdir="${dist.bin}" eol="crlf" includes="**/*.bat" />
  657. <fixcrlf srcdir="${dist.bin}" eol="lf" includes="**/*.sh" />
  658. <fixcrlf srcdir="${dist.bin}" eol="lf" includes="ant" />
  659. </target>
  660. <target name="dist-extralite"
  661. description="A faster version of dist-lite (no XDoclet).">
  662. <property name="antlib-descriptors.omit" value="true"/>
  663. <antcall target="dist-lite"/>
  664. </target>
  665. <!-- Creates the distribution -->
  666. <target name="dist" depends="dist-lite, test" description="Builds the distribution"/>
  667. <!-- Cleans up build and distribution directories -->
  668. <target name="clean" description="Deletes all built files">
  669. <delete dir="${build.dir}"/>
  670. <delete dir="${dist.dir}" failonerror="false"/>
  671. </target>
  672. <!-- Cleans up the compiled classes -->
  673. <target name="clean-classes">
  674. <delete dir="${build.classes}"/>
  675. <delete dir="${test.classes}"/>
  676. <delete dir="${build.custom-tasks}"/>
  677. </target>
  678. <!-- Rebuilds the distribution -->
  679. <target name="rebuild" description="Rebuilds the distribution">
  680. <antcall target="clean"/>
  681. <antcall target="main"/>
  682. </target>
  683. <!-- Recompiles the classes, and builds the distribution -->
  684. <target name="recompile" description="Recompiles and builds the the distribution">
  685. <antcall target="clean-classes"/>
  686. <antcall target="main"/>
  687. </target>
  688. </project>