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.

build.xml 9.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. <!-- ========================================================================= -->
  2. <!-- Copyright (c) 2003-2005 Contributors. -->
  3. <!-- All rights reserved. -->
  4. <!-- This program and the accompanying materials are made available -->
  5. <!-- under the terms of the Eclipse Public License v 2.0 -->
  6. <!-- which accompanies this distribution and is available at -->
  7. <!-- https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt -->
  8. <!-- -->
  9. <!-- Contributors: -->
  10. <!-- Wes Isberg initial implementation -->
  11. <!-- ========================================================================= -->
  12. <project name="build" default="all" basedir="..">
  13. <property name="aspectj.modules.dir" location="${basedir}/.."/>
  14. <import file="${aspectj.modules.dir}/build/build-properties.xml"/>
  15. <import file="${aspectj.modules.dir}/build/release/release-tests.xml"/>
  16. <target name="info">
  17. <echo message="see build.readme.txt and readme.txt"/>
  18. </target>
  19. <target name="init" depends="init-release-properties">
  20. </target>
  21. <target name="init-release-properties" depends="init-properties,init-directories">
  22. <property name="do.cvs" value="false"/>
  23. <property name="run.${min.vm}" value="true"/>
  24. <property name="run.14" value="false"/>
  25. <property name="run.${max.vm}" value="true"/>
  26. <property name="aspectj.build.props" value=""/>
  27. <property name="ant.verbose" value=""/>
  28. <property name="failonerror" value="false"/>
  29. <property name="harness.jvmline" value="-Dignore=me"/>
  30. <property name="aspectj.ant.home"
  31. location="${aspectj.modules.lib.dir}/ant"/>
  32. <property name="aspectj.ant.lib.dir"
  33. location="${aspectj.ant.home}/lib"/>
  34. <property name="harness.jar"
  35. location="${aj.jar.dir}/testing-drivers-test-all.jar"/>
  36. <property name="java.home.file"
  37. location="${aj.build.dir}/javahome.props.tmp"/>
  38. <property name="java13.command"
  39. location="${java13.home}/bin/java"/>
  40. <property name="java14.command"
  41. location="${java14.home}/bin/java"/>
  42. <property name="java15.command"
  43. location="${java15.home}/bin/java"/>
  44. <mkdir dir="${aj.logs.dir}"/>
  45. </target>
  46. <target name="all" depends="init">
  47. <build-aspectj vm="${min.vm}" target="clean"/>
  48. <save-build-id id="min-vm-${min.vm}"/>
  49. <build-aspectj vm="${min.vm}" target="echo-properties"/>
  50. <build-aspectj vm="${min.vm}" target="all"/>
  51. <!-- ANDY removed... build-aspectj vm="${min.vm}" target="test-each-module"/-->
  52. <build-aspectj vm="${max.vm}" target="junitreport"/>
  53. <build-aspectj vm="${max.vm}" target="save-result"/>
  54. <build-aspectj vm="${max.vm}" target="clean-keep-results"/>
  55. <!-- can't use safety of build-aspectj since deleting output file -->
  56. <antcall target="clean-default-results"/>
  57. <save-build-id id="max-vm-${max.vm}"/>
  58. <build-aspectj vm="${max.vm}" target="echo-properties"/>
  59. <build-aspectj vm="${max.vm}" target="all"/>
  60. <build-aspectj vm="${max.vm}" target="test-each-module"/>
  61. <build-aspectj vm="${max.vm}" target="junitreport"/>
  62. <antcall target="install"/>
  63. <antcall target="product-tests"/>
  64. <!-- TODO re-enable antcall target="harness-tests"/ -->
  65. <!-- Temporary removal to see if build will work... -->
  66. <!--build-aspectj vm="13" target="compile-runtime-11"/-->
  67. <build-aspectj vm="${max.vm}" target="save-result"/>
  68. <antcall target="fail-if-allresults-allfailures"/>
  69. </target>
  70. <target name="install" depends="init-release-properties"
  71. description="install AspectJ distribution using Java min.vm=${min.vm}">
  72. <antcall target="init-postBuild-properties"/>
  73. <require-available property="aspectj.jar"
  74. path="${aj.dist.dir}/aspectj-${build.version}.jar"/>
  75. <clean-dir dir="${aj.install.dir}"/>
  76. <setup-vm vm="${min.vm}"/>
  77. <property file="${java.home.file}"/>
  78. <fail unless="build.java.command"
  79. message="failed to read ${build.java.command} from ${java.home.file}"/>
  80. <java
  81. fork="true"
  82. jvm="${build.java.command}"
  83. jar="${aspectj.jar}"
  84. failonerror="true">
  85. <arg line="-to ${aj.install.dir}"/>
  86. </java>
  87. </target>
  88. <macrodef name="build-aspectj">
  89. <attribute name="target"/>
  90. <attribute name="vm"/>
  91. <sequential>
  92. <setup-vm vm="@{vm}"/>
  93. <condition property="do.ant.props" value=" ">
  94. <not><isset property="do.ant.props"/></not>
  95. </condition>
  96. <antcall target="do-run-ant">
  97. <param name="verbose" value="true"/>
  98. <param name="ant.dir" location="${aspectj.modules.build.dir}"/>
  99. <param name="run.ant.file" value="build.xml"/>
  100. <param name="ant.target" value="@{target}"/>
  101. <param name="ant.output"
  102. location="${aj.logs.dir}/build-@{target}"/>
  103. <param name="ant.properties"
  104. value="${do.ant.props} ${aspectj.build.props}"/>
  105. </antcall>
  106. </sequential>
  107. </macrodef>
  108. <target name="do-run-ant" depends="init-release-properties"
  109. description="the ant we use to build">
  110. <!-- we could use normal ant, but we enforce using
  111. our ant libraries and the specified java runtime
  112. -->
  113. <fail unless="ant.target" message="define ant.target"/>
  114. <fail unless="run.ant.file" message="define run.ant.file"/>
  115. <!-- don't fail - set if not defined -->
  116. <property name="ant.properties" value=""/>
  117. <property file="${java.home.file}"/>
  118. <fail unless="build.java.home"
  119. message="failed to read ${build.java.home} from ${java.home.file}"/>
  120. <fail unless="build.java.version"
  121. message="failed to read ${build.java.version} from ${java.home.file}"/>
  122. <available property="aspectjrt.path"
  123. value="${aj.install.dir}/lib/aspectjrt.jar"
  124. file="${aj.install.dir}/lib/aspectjrt.jar"/>
  125. <available property="aspectjrt.path"
  126. value="${lib.test.aspectjrt.jar}"
  127. file="${lib.test.aspectjrt.jar}"/>
  128. <property name="ant.output.file"
  129. location="${ant.output}-${build.java.version}.txt"/>
  130. <echo>
  131. do-run-ant dir ${ant.dir}
  132. file/target -f ${run.ant.file} ${ant.target}
  133. options ${ant.verbose} ${ant.properties}
  134. output ${ant.output.file}
  135. failonerror ${failonerror}
  136. aspectjrt.path ${aspectjrt.path}
  137. </echo>
  138. <java
  139. fork="true"
  140. resultproperty="do-run-ant.result"
  141. failonerror="${failonerror}"
  142. dir="${ant.dir}"
  143. jvm="${build.java.command}"
  144. classname="org.apache.tools.ant.Main"
  145. maxmemory="350m"
  146. newenvironment="true"
  147. output="${ant.output.file}">
  148. <classpath>
  149. <!-- TODO use lib/ant-launcher.jar only? use jdk.tools.jar (version) -->
  150. <fileset dir="${aspectj.ant.lib.dir}">
  151. <include name="*.jar"/>
  152. </fileset>
  153. <pathelement location="${junit.jar}"/>
  154. <pathelement location="${build.java.home}/lib/tools.jar"/>
  155. </classpath>
  156. <!-- urk - all properties for any client -->
  157. <!-- for any build -->
  158. <sysproperty key="JAVA_HOME" path="${build.java.home}"/>
  159. <sysproperty key="ANT_HOME"
  160. path="${aspectj.ant.home}"/>
  161. <!-- for ajde -->
  162. <sysproperty key="aspectjrt.path" file="${aspectjrt.path}"/>
  163. <!-- for tests/product/build-aspectj/build.xml -->
  164. <sysproperty key="ASPECTJ_MODULES"
  165. file="${aspectj.modules.dir}"/>
  166. <sysproperty key="ASPECTJ_HOME"
  167. file="${aj.install.dir}"/>
  168. <arg line="-f ${run.ant.file} ${ant.target} ${ant.verbose} ${ant.properties}"/>
  169. </java>
  170. <condition property="do-run-ant.failed" value="true">
  171. <not><equals arg1="0" arg2="${do-run-ant.result}"/></not>
  172. </condition>
  173. <echo message="dra: do-run-ant.failed=${do-run-ant.failed} do-run-ant.result=${do-run-ant.result}"/>
  174. <report-if-failed property="do-run-ant.failed"
  175. text="Build failed: ${ant.output.file}"/>
  176. </target>
  177. <macrodef name="do-vm-targets">
  178. <attribute name="target"/>
  179. <sequential>
  180. <do-vm-target target="@{target}" vm="min" />
  181. <do-vm-target target="@{target}" vm="14" />
  182. <do-vm-target target="@{target}" vm="max" />
  183. </sequential>
  184. </macrodef>
  185. <macrodef name="do-vm-target">
  186. <attribute name="vm"/>
  187. <attribute name="target"/>
  188. <sequential>
  189. <antcall target="do-@{vm}-target">
  190. <param name="do.target" value="@{target}"/>
  191. </antcall>
  192. </sequential>
  193. </macrodef>
  194. <target name="do-13-target" if="run.13">
  195. <setup-vm vm="13"/>
  196. <antcall target="${do.target}"/>
  197. </target>
  198. <target name="do-14-target" if="run.14">
  199. <setup-vm vm="14"/>
  200. <antcall target="${do.target}"/>
  201. </target>
  202. <target name="do-15-target" if="run.15">
  203. <setup-vm vm="15"/>
  204. <antcall target="${do.target}"/>
  205. </target>
  206. <target name="do-min-target" if="run.${min.vm}">
  207. <setup-vm vm="${min.vm}"/>
  208. <antcall target="${do.target}"/>
  209. </target>
  210. <target name="do-max-target" if="run.${max.vm}">
  211. <setup-vm vm="${max.vm}"/>
  212. <antcall target="${do.target}"/>
  213. </target>
  214. <macrodef name="setup-vm">
  215. <attribute name="vm"/>
  216. <sequential>
  217. <property name="wjf@{vm}.bjh" location="${java@{vm}.home}"/>
  218. <property name="wjf@{vm}.cmd" location="${wjf@{vm}.bjh}/bin/java"/>
  219. <delete file="${java.home.file}"/>
  220. <propertyfile file="${java.home.file}">
  221. <entry key="build.java.version" value="@{vm}"/>
  222. <entry key="build.java.home" value="${wjf@{vm}.bjh}"/>
  223. <entry key="build.java.command" value="${wjf@{vm}.cmd}"/>
  224. </propertyfile>
  225. </sequential>
  226. </macrodef>
  227. </project>