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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. <project default="dist-lite" name="Mutant">
  2. <!-- source locations -->
  3. <property name="src.dir" value="src"/>
  4. <property name="lib.dir" value="lib"/>
  5. <property name="java.dir" value="${src.dir}/java"/>
  6. <property name="script.dir" value="${src.dir}/script"/>
  7. <property name="conf.dir" value="${src.dir}/conf"/>
  8. <!-- build and distribution locations -->
  9. <property name="bin.dir" value="bin"/>
  10. <property name="dist.dir" value="dist"/>
  11. <property name="dist.bin" value="${dist.dir}/bin"/>
  12. <property name="dist.conf" value="${dist.dir}/conf"/>
  13. <property name="javadocs.dir" value="${dist.dir}/docs/manual/api"/>
  14. <property name="dist.lib.dir" value="${dist.dir}/lib"/>
  15. <property name="dist.core.dir" value="${dist.lib.dir}/core"/>
  16. <property name="dist.frontend.dir" value="${dist.lib.dir}/frontend"/>
  17. <property name="dist.antlibs.dir" value="${dist.lib.dir}/antlibs"/>
  18. <property name="dist.syslibs.dir" value="${dist.core.dir}/syslibs"/>
  19. <!-- control flags -->
  20. <property name="debug" value="true"/>
  21. <property name="chmod.fail" value="true" />
  22. <path id="classpath.parser">
  23. <fileset dir="${lib.dir}/parser" includes="*.jar"/>
  24. </path>
  25. <path id="classpath.common">
  26. <pathelement location="${dist.core.dir}/start/init.jar"/>
  27. </path>
  28. <path id="classpath.antcore">
  29. <path refid="classpath.common"/>
  30. <pathelement location="${dist.core.dir}/common/common.jar"/>
  31. <path refid="classpath.parser"/>
  32. </path>
  33. <path id="classpath.frontend">
  34. <path refid="classpath.antcore"/>
  35. <pathelement location="${dist.core.dir}/antcore/antcore.jar"/>
  36. </path>
  37. <path id="classpath.start">
  38. <pathelement location="${dist.core.dir}/start/init.jar"/>
  39. </path>
  40. <target name="buildsetup">
  41. <available classname="com.puppycrawl.tools.checkstyle.CheckStyleTask"
  42. property="checkstyle.available"/>
  43. <mkdir dir="${bin.dir}"/>
  44. <mkdir dir="${dist.core.dir}"/>
  45. <copy todir="${dist.core.dir}/parser">
  46. <fileset dir="${lib.dir}/parser"/>
  47. </copy>
  48. </target>
  49. <target name="initjar" depends="buildsetup">
  50. <mkdir dir="${bin.dir}/init"/>
  51. <mkdir dir="${dist.core.dir}/start"/>
  52. <depend destdir="${bin.dir}/init" srcdir="${java.dir}/init" closure="yes"/>
  53. <javac destdir="${bin.dir}/init" srcdir="${java.dir}/init" debug="${debug}"/>
  54. <jar basedir="${bin.dir}/init" jarfile="${dist.core.dir}/start/init.jar"/>
  55. </target>
  56. <target name="common" depends="initjar">
  57. <mkdir dir="${bin.dir}/common"/>
  58. <mkdir dir="${dist.core.dir}/common"/>
  59. <depend destdir="${bin.dir}/common" srcdir="${java.dir}/common" closure="yes">
  60. <classpath refid="classpath.common"/>
  61. </depend>
  62. <javac destdir="${bin.dir}/common" srcdir="${java.dir}/common" debug="${debug}">
  63. <classpath refid="classpath.common"/>
  64. </javac>
  65. <jar basedir="${bin.dir}/common" jarfile="${dist.core.dir}/common/common.jar"/>
  66. </target>
  67. <target name="antcore" depends="common">
  68. <mkdir dir="${bin.dir}/antcore"/>
  69. <mkdir dir="${dist.core.dir}/antcore"/>
  70. <depend destdir="${bin.dir}/antcore" srcdir="${java.dir}/antcore" closure="yes">
  71. <classpath refid="classpath.antcore"/>
  72. </depend>
  73. <javac destdir="${bin.dir}/antcore" srcdir="${java.dir}/antcore" debug="${debug}">
  74. <classpath refid="classpath.antcore"/>
  75. </javac>
  76. <jar basedir="${bin.dir}/antcore" jarfile="${dist.core.dir}/antcore/antcore.jar"/>
  77. </target>
  78. <target name="frontend" depends="antcore, startjar">
  79. <mkdir dir="${bin.dir}/frontend"/>
  80. <mkdir dir="${dist.frontend.dir}"/>
  81. <depend destdir="${bin.dir}/frontend" srcdir="${java.dir}/frontend" closure="yes">
  82. <classpath refid="classpath.frontend"/>
  83. </depend>
  84. <javac destdir="${bin.dir}/frontend" srcdir="${java.dir}/frontend" debug="${debug}">
  85. <classpath refid="classpath.frontend"/>
  86. </javac>
  87. <jar basedir="${bin.dir}/frontend" jarfile="${dist.frontend.dir}/cli.jar">
  88. <include name="**/cli/*.class"/>
  89. <manifest>
  90. <attribute name="Main-Class" value="org.apache.ant.cli.Commandline"/>
  91. </manifest>
  92. </jar>
  93. </target>
  94. <target name="startjar" depends="initjar">
  95. <mkdir dir="${bin.dir}/start"/>
  96. <mkdir dir="${dist.core.dir}/start"/>
  97. <depend destdir="${bin.dir}/start" srcdir="${java.dir}/start" closure="yes">
  98. <classpath refid="classpath.start"/>
  99. </depend>
  100. <javac destdir="${bin.dir}/start" srcdir="${java.dir}/start" debug="${debug}">
  101. <classpath refid="classpath.start"/>
  102. </javac>
  103. <jar basedir="${bin.dir}/start" jarfile="${dist.core.dir}/start/start.jar">
  104. <manifest>
  105. <attribute name="Main-Class" value="org.apache.ant.start.Main"/>
  106. <attribute name="Class-Path" value="init.jar"/>
  107. </manifest>
  108. <include name="org/apache/ant/**/*"/>
  109. </jar>
  110. <jar basedir="${bin.dir}/start" jarfile="${dist.core.dir}/start/ant.jar">
  111. <manifest>
  112. <attribute name="Main-Class" value="org.apache.tools.ant.Main"/>
  113. <attribute name="Class-Path" value="start.jar"/>
  114. </manifest>
  115. <include name="org/apache/tools/ant/**/*"/>
  116. </jar>
  117. </target>
  118. <!--
  119. <target name="remote" depends="initjar">
  120. <mkdir dir="${bin.dir}/remote"/>
  121. <depend destdir="${bin.dir}/remote" srcdir="${java.dir}/remote" closure="yes">
  122. <classpath refid="classpath.start"/>
  123. </depend>
  124. <javac destdir="${bin.dir}/remote" srcdir="${java.dir}/remote" debug="${debug}">
  125. <classpath refid="classpath.start"/>
  126. </javac>
  127. <jar basedir="${bin.dir}/remote" jarfile="${distlib.dir}/remote.jar">
  128. <manifest>
  129. <attribute name="Main-Class" value="org.apache.ant.remote.RemoteMain"/>
  130. </manifest>
  131. </jar>
  132. </target>
  133. -->
  134. <target name="antlibs" depends="common">
  135. <!-- <ant antfile="build/script.xml"/> -->
  136. <antcall target="buildlib">
  137. <param name="libname" value="system"/>
  138. <param name="antlibdir" value="${dist.syslibs.dir}"/>
  139. </antcall>
  140. <antcall target="buildlib">
  141. <param name="libname" value="monitor"/>
  142. <param name="antlibdir" value="${dist.syslibs.dir}"/>
  143. </antcall>
  144. <ant antfile="build/ant1compat.xml"/>
  145. </target>
  146. <target name="buildlib">
  147. <property name="antlib.build.dir" value="${bin.dir}/antlibs/${libname}"/>
  148. <property name="antlib.src.dir" value="${java.dir}/antlibs/${libname}"/>
  149. <mkdir dir="${antlib.build.dir}"/>
  150. <mkdir dir="${antlibdir}"/>
  151. <path id="classpath.antlibs">
  152. <path refid="classpath.common"/>
  153. <pathelement location="${dist.core.dir}/common/common.jar"/>
  154. </path>
  155. <depend destdir="${antlib.build.dir}" srcdir="${antlib.src.dir}" closure="yes">
  156. <classpath refid="classpath.antlibs"/>
  157. </depend>
  158. <javac destdir="${antlib.build.dir}" srcdir="${antlib.src.dir}" debug="${debug}">
  159. <classpath refid="classpath.antlibs"/>
  160. </javac>
  161. <jar basedir="${antlib.build.dir}" jarfile="${antlibdir}/${libname}.jar">
  162. <metainf dir="${antlib.src.dir}"
  163. includes="antlib.xml"/>
  164. </jar>
  165. </target>
  166. <target name="setup-bin">
  167. <mkdir dir="${dist.bin}"/>
  168. <copy todir="${dist.bin}">
  169. <fileset dir="${script.dir}/" />
  170. </copy>
  171. <fixcrlf srcdir="${dist.bin}" eol="crlf" includes="*.bat" />
  172. <fixcrlf srcdir="${dist.bin}" eol="lf">
  173. <include name="mutant" />
  174. <include name="antRun" />
  175. <include name="*.pl" />
  176. </fixcrlf>
  177. <chmod perm="ugo+rx" dir="${dist.dir}" type="dir" includes="**"
  178. failonerror="${chmod.fail}" />
  179. <chmod perm="ugo+r" dir="${dist.dir}" type="file" includes="**"
  180. failonerror="${chmod.fail}" />
  181. <chmod perm="ugo+x" type="file" failonerror="${chmod.fail}">
  182. <fileset dir="${dist.bin}">
  183. <include name="**/mutant" />
  184. <include name="**/antRun" />
  185. <include name="**/*.pl" />
  186. <include name="**/*.py" />
  187. </fileset>
  188. </chmod>
  189. </target>
  190. <target name="setup-conf">
  191. <mkdir dir="${dist.conf}"/>
  192. <copy todir="${dist.conf}">
  193. <fileset dir="${conf.dir}/" />
  194. </copy>
  195. </target>
  196. <target name="clean">
  197. <delete dir="${bin.dir}"/>
  198. <delete dir="${dist.dir}"/>
  199. </target>
  200. <target name="checkstyle" depends="buildsetup" if="checkstyle.available">
  201. <taskdef name="checkstyle"
  202. classname="com.puppycrawl.tools.checkstyle.CheckStyleTask"/>
  203. <mkdir dir="${bin.dir}/check"/>
  204. <checkstyle headerFile="../../src/etc/RequiredHeader.txt"
  205. headerIgnoreLine="4">
  206. <fileset dir="${java.dir}">
  207. <include name="**/*.java"/>
  208. <exclude name="**/org/apache/tools/ant/Task.java"/>
  209. <exclude name="**/org/apache/tools/ant/ProjectComponent.java"/>
  210. <exclude name="**/org/apache/tools/ant/types/DataType.java"/>
  211. <exclude name="**/builder/MutantBuilder.java"/>
  212. <exclude name="**/builder/Ant1CompatBuilder.java"/>
  213. </fileset>
  214. </checkstyle>
  215. <checkstyle allowProtected="true"
  216. headerFile="../../src/etc/RequiredHeader.txt"
  217. headerIgnoreLine="4">
  218. <fileset dir="${java.dir}">
  219. <include name="**/org/apache/tools/ant/Task.java"/>
  220. <include name="**/org/apache/tools/ant/ProjectComponent.java"/>
  221. <include name="**/org/apache/tools/ant/types/DataType.java"/>
  222. </fileset>
  223. </checkstyle>
  224. </target>
  225. <target name="javadocs">
  226. <mkdir dir="${javadocs.dir}"/>
  227. <javadoc packagenames="org.apache.*"
  228. useexternalfile="yes"
  229. sourcepath="${java.dir}/antcore:${java.dir}/init:${java.dir}/common:${java.dir}/frontend:${java.dir}/start"
  230. destdir="${javadocs.dir}"
  231. author="true"
  232. private ="true"
  233. version="true"
  234. windowtitle="Mutant API"
  235. doctitle="Mutant">
  236. <group title="Ant Library" packages="org.apache.ant.common.antlib*" />
  237. <group title="Services" packages="org.apache.ant.common.service*" />
  238. <group title="Common Facilities" packages="org.apache.ant.common*" />
  239. <group title="Core" packages="org.apache.ant.antcore*" />
  240. <group title="Initialisation" packages="org.apache.ant.init*,org.apache.ant.start*" />
  241. <group title="Command Line" packages="org.apache.ant.cli*" />
  242. <group title="Ant1 Compatability Layer" packages="org.apache.tools.ant*" />
  243. <tag name="created" description="Date Created:" scope="types"/>
  244. </javadoc>
  245. </target>
  246. <target name="test">
  247. <ant antfile="build/ant1compat.xml" target="test"/>
  248. </target>
  249. <target name="jars" depends="initjar, startjar, antcore, frontend, antlibs"/>
  250. <target name="dist-lite" depends="jars, setup-bin, setup-conf"/>
  251. <target name="dist" depends="dist-lite, javadocs"/>
  252. </project>