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-properties.xml 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486
  1. <!-- -*- Mode: SGML; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -->
  2. <!-- ========================================================================= -->
  3. <!-- Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC). -->
  4. <!-- Copyright (c) 2003, 2005 Contributors. -->
  5. <!-- All rights reserved. -->
  6. <!-- This program and the accompanying materials are made available -->
  7. <!-- under the terms of the Eclipse Public License v 2.0 -->
  8. <!-- which accompanies this distribution and is available at -->
  9. <!-- https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt -->
  10. <!-- -->
  11. <!-- Contributors: -->
  12. <!-- Xerox/PARC initial implementation -->
  13. <!-- A Colyer / G Harley eclipse plugin dirs -->
  14. <!-- ========================================================================= -->
  15. <!-- include as common entity for module build scripts -->
  16. <!-- should only need to edit version properties -->
  17. <project name="build-properties" default="init-properties">
  18. <target name="init-properties"
  19. unless="init-properties.done">
  20. <!-- callers should define aspectj.modules.dir -->
  21. <property name="aspectj.modules.dir" location="${basedir}/.."/>
  22. <require-available property="local-properties"
  23. path="${aspectj.modules.dir}/build/local.properties"/>
  24. <property file="${aspectj.modules.dir}/build/local.properties"/>
  25. <!--
  26. Changing version:
  27. - base should always be 1.1 (used for manifests, other version-parsing code)
  28. - Others should be DEVELOPMENT unless testing/doing release builds, when
  29. they should be (e.g.,) 1.1b3 or 1.1beta3
  30. - Changing version here causes org/aspectj/bridge/Version.java to be updated
  31. - also change org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/messages.properties
  32. - build.version.eclipse.plugins should be set to "9.9.9" for "DEVELOPMENT", and
  33. - the same as build.version.long (in major.minor.service form) for releases.
  34. -->
  35. <property name="min.vm" value="13"/>
  36. <property name="max.vm" value="15"/>
  37. <property name="build.verbose" value="false"/>
  38. <property name="build.version" value="DEVELOPMENT"/>
  39. <property name="build.version.base" value="1.2"/>
  40. <property name="build.version.long" value="DEVELOPMENT"/>
  41. <property name="build.version.short" value="DEVELOPMENT"/>
  42. <!-- formats comply with SimpleDateFormat -->
  43. <property name="build.time.format" value="EEEE MMM d, yyyy 'at' HH:mm:ss z"/>
  44. <property name="build.date.format" value="EEEE MMM d, yyyy"/>
  45. <tstamp>
  46. <format property="build.date"
  47. pattern="${build.date.format}"
  48. timezone="GMT"/>
  49. <format property="build.time"
  50. pattern="${build.time.format}"
  51. timezone="GMT"/>
  52. </tstamp>
  53. <property name="company.name" value="aspectj.org"/>
  54. <property name="copyright.allRights.from1998"
  55. value="Copyright (c) 1998-2001 Xerox Corporation, 2002 Palo Alto Research Center, Incorporated, 2003-2008 Contributors. All rights reserved." />
  56. <!-- aj... names are generated, can be mutated/cleaned -->
  57. <!-- these names are known to BuildModule.java and common to all -->
  58. <property name="aj.build.dir"
  59. location="${aspectj.modules.dir}/aj-build"/>
  60. <property name="aj.temp.dir"
  61. location="${aj.build.dir}/temp"/>
  62. <property name="aj.src.dir"
  63. location="${aj.build.dir}/src"/>
  64. <property name="aj.jar.dir"
  65. location="${aj.build.dir}/jars"/>
  66. <property name="aj.dist.dir"
  67. location="${aj.build.dir}/dist"/>
  68. <property name="aj.webDeploy.dir"
  69. location="${aj.build.dir}/webDeploy"/>
  70. <property name="aj.install.dir"
  71. location="${aj.build.dir}/install"/>
  72. <property name="aj.build.allresults.dir"
  73. location="${aj.build.dir}/allresults"/>
  74. <property name="aj.build.allfailures.file"
  75. location="${aj.build.allresults.dir}/allfailures.txt"/>
  76. <property name="aj.build.results.dir"
  77. location="${aj.build.dir}/results"/>
  78. <property name="aj.failure.file"
  79. location="${aj.build.results.dir}/failures.txt"/>
  80. <property name="aj.build-id.file"
  81. location="${aj.build.results.dir}/build-id.txt"/>
  82. <property name="aj.junit.dir"
  83. location="${aj.build.results.dir}/junit"/>
  84. <property name="aj.logs.dir"
  85. location="${aj.build.results.dir}/logs"/>
  86. <!-- aspectj... names are sources, not to be mutated -->
  87. <property name="aspectj.modules.lib.dir"
  88. location="${aspectj.modules.dir}/lib"/>
  89. <property name="aspectj.modules.build.dir"
  90. location="${aspectj.modules.dir}/build"/>
  91. <property name="aspectj.modules.docs.dir"
  92. location="${aspectj.modules.dir}/docs"/>
  93. <property name="aspectj.modules.tests.dir"
  94. location="${aspectj.modules.dir}/tests"/>
  95. <!-- BuildModule.java assumes products are here -->
  96. <property name="aspectj.products.dir"
  97. location="${aspectj.modules.build.dir}/products"/>
  98. <property name="aspectj.modules.tests.dir"
  99. location="${aspectj.modules.dir}/tests"/>
  100. <property file="${aspectj.modules.build.dir}/junit-patterns.properties"/>
  101. <property name="aspectj.tools.modules.13"
  102. value="ajde,ajde.core,ajdoc,asm,bridge,loadtime,org.aspectj.ajdt.core,runtime,taskdefs,util,weaver"/>
  103. <property name="aspectj.tools.modules.15"
  104. value="loadtime5,aspectj5rt,weaver5"/>
  105. <condition property="aspectj.tools.modules"
  106. value="${aspectj.tools.modules.13},${aspectj.tools.modules.15}">
  107. <equals arg1="1.5" arg2="${ant.java.version}"/>
  108. </condition>
  109. <condition property="aspectj.tools.modules"
  110. value="${aspectj.tools.modules.13}">
  111. <not>
  112. <equals arg1="1.5" arg2="${ant.java.version}"/>
  113. </not>
  114. </condition>
  115. <property name="aspectj.test.modules"
  116. value="build,testing,testing-client,testing-drivers,testing-util,tests"/>
  117. <property name="aspectj.compilerTest.modules"
  118. value="tests"/>
  119. <property name="aspectj.other.modules"
  120. value="docs,eclipse.plugin"/>
  121. <jar-property name="junit.jar"
  122. location="${aspectj.modules.lib.dir}/junit/junit.jar"/>
  123. <!-- TODO need version-specific JDK? -->
  124. <guarded-property name="jdk.tools.jar"
  125. location="${java.home}/../lib/tools.jar"/>
  126. <guarded-property name="jdk.tools.jar"
  127. location="${java.home}/lib/tools.jar"/>
  128. <guarded-property name="lib.test.aspectjrt.jar"
  129. location="${aspectj.modules.lib.dir}/test/aspectjrt.jar"/>
  130. <property name="init-properties.done" value="true"/>
  131. </target>
  132. <target name="init-taskdefs"
  133. depends="init-properties"
  134. unless="init-taskdefs.done" >
  135. <jar-property name="aspectj.build.jar"
  136. location="${aspectj.modules.lib.dir}/build/build.jar"/>
  137. <jar-property name="lib.ant.jar"
  138. location="${aspectj.modules.lib.dir}/ant/lib/ant.jar"/>
  139. <taskdef resource="org/aspectj/internal/tools/ant/taskdefs/taskdefs.properties"
  140. classpath="${aspectj.build.jar}"/>
  141. <path id="ant.lib.path">
  142. <fileset dir="${aspectj.modules.lib.dir}/ant/lib">
  143. <include name="**/*.jar"/>
  144. </fileset>
  145. </path>
  146. <taskdef name="junit"
  147. classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"
  148. classpathref="ant.lib.path"/>
  149. <available classname="org.apache.xalan.processor.TransformerFactoryImpl"
  150. property="xalan.available"
  151. value="true">
  152. <classpath refid="ant.lib.path"/>
  153. </available>
  154. <condition property="junitreport.available" value="true">
  155. <istrue value="${xalan.available}"/>
  156. </condition>
  157. <echo message="junitreport.available: ${junitreport.available}"/>
  158. <antcall target="init-junitreport"/>
  159. </target>
  160. <target name="init-junitreport" depends="init-properties"
  161. if="xalan.available">
  162. <taskdef name="junitreport"
  163. classname="org.apache.tools.ant.taskdefs.optional.junit.XMLResultAggregator"
  164. classpathref="ant.lib.path"/>
  165. </target>
  166. <target name="init-directories"
  167. depends="init-properties"
  168. description="ensure dirs, possibly many times in a build">
  169. <mkdir dir="${aj.build.dir}" />
  170. <mkdir dir="${aj.temp.dir}" />
  171. <mkdir dir="${aj.jar.dir}" />
  172. <mkdir dir="${aj.dist.dir}" />
  173. <mkdir dir="${aj.install.dir}" />
  174. <mkdir dir="${aj.logs.dir}" />
  175. </target>
  176. <target name="init-filters"
  177. depends="init-properties"
  178. unless="init-filters.done" >
  179. <!-- build.version and build.date used in filters throughout, and
  180. build.version.base used in filtering manifest, but
  181. others used mainly for installer-resources/properties.txt -->
  182. <filter token="build.version" value="${build.version}"/>
  183. <filter token="build.version.base" value="${build.version.base}"/>
  184. <filter token="build.version.long" value="${build.version.long}"/>
  185. <filter token="build.version.short" value="${build.version.short}"/>
  186. <filter token="build.time.format" value="${build.time.format}"/>
  187. <filter token="build.date.format" value="${build.date.format}"/>
  188. <filter token="build.date" value="${build.date}"/>
  189. <filter token="build.time" value="${build.time}"/>
  190. <filter token="company.name" value="${company.name}"/>
  191. <filter token="copyright.allRights.from1998"
  192. value="${copyright.allRights.from1998}" />
  193. <property name="init-filters.done" value="done"/>
  194. </target>
  195. <target name="clean-directories" depends="init-properties">
  196. <delete quiet="on">
  197. <fileset dir="${aj.build.dir}" includes="*,**/*"/>
  198. </delete>
  199. <antcall target="init-directories"/>
  200. </target>
  201. <target name="clean-jars"
  202. depends="init-directories"
  203. unless="clean-jars.done" >
  204. <delete quiet="on">
  205. <fileset dir="${aj.jar.dir}" includes="*"/>
  206. </delete>
  207. <property name="clean-jars.done" value="done"/>
  208. </target>
  209. <target name="clean-keep-results" depends="init-properties">
  210. <delete>
  211. <fileset dir="${aj.build.dir}">
  212. <exclude name="results/*"/>
  213. <exclude name="results/**"/>
  214. <exclude name="allresults/*"/>
  215. <exclude name="allresults/**"/>
  216. </fileset>
  217. </delete>
  218. </target>
  219. <target name="clean-default-results" depends="init-properties">
  220. <delete>
  221. <fileset dir="${aj.build.results.dir}" includes="*,**/*"/>
  222. </delete>
  223. </target>
  224. <target name="clean-result" depends="init-properties">
  225. <delete quiet="on">
  226. <fileset dir="${aj.build.results.dir}" includes="*,**/*"/>
  227. </delete>
  228. </target>
  229. <macrodef name="save-build-id"
  230. description="save ${id} to ${aj.build-id.file}">
  231. <attribute name="id"/>
  232. <sequential>
  233. <echo message="@{id}" file="${aj.build-id.file}"/>
  234. </sequential>
  235. </macrodef>
  236. <macrodef name="load-build-id">
  237. <attribute name="property"/>
  238. <sequential>
  239. <available property="aj.build-id.file.available"
  240. file="${aj.build-id.file}"/>
  241. <antcall target="ensure-build-id"/>
  242. <loadfile srcfile="${aj.build-id.file}" property="@{property}"/>
  243. </sequential>
  244. </macrodef>
  245. <target name="ensure-build-id" unless="aj.build-id.file.available"
  246. description="create datestamp build id in ${aj.build-id.file} if n/a">
  247. <tstamp>
  248. <format property="build.id.name"
  249. timezone="GMT+10"
  250. pattern="yyyyMMdd-hhmmss"
  251. />
  252. </tstamp>
  253. <echo file="${aj.build-id.file}" message="${build.id.name}"/>
  254. </target>
  255. <target name="save-result" depends="init-properties">
  256. <load-build-id property="build.id"/>
  257. <copy todir="${aj.build.allresults.dir}/${build.id}">
  258. <fileset dir="${aj.build.results.dir}" />
  259. </copy>
  260. </target>
  261. <target name="echo-properties" depends="init-properties">
  262. <echo>
  263. Build Properties
  264. build.date = ${build.date}
  265. build.time = ${build.time}
  266. build.version = ${build.version}
  267. build.version.long = ${build.version.long}
  268. build.version.short = ${build.version.short}
  269. aspectj.modules.dir = ${aspectj.modules.dir}
  270. aj.build.dir = ${aj.build.dir}
  271. ant.home = ${ant.home}
  272. java.home = ${java.home}
  273. java11.home = ${java11.home}
  274. java13.home = ${java13.home}
  275. java14.home = ${java14.home}
  276. java15.home = ${java15.home}
  277. </echo>
  278. </target>
  279. <macrodef name="guarded-property"
  280. description="set property {name} to {location} if unset and {location} exists">
  281. <attribute name="name"/>
  282. <attribute name="location"/>
  283. <sequential>
  284. <property name="@{name}.path"
  285. location="@{location}"/>
  286. <condition property="@{name}"
  287. value="${@{name}.path}">
  288. <and>
  289. <not>
  290. <isset property="@{name}"/>
  291. </not>
  292. <available file="${@{name}.path}"/>
  293. </and>
  294. </condition>
  295. </sequential>
  296. </macrodef>
  297. <macrodef name="clean-dir">
  298. <attribute name="dir"/>
  299. <sequential>
  300. <mkdir dir="@{dir}"/>
  301. <delete>
  302. <fileset dir="@{dir}" includes="*,**/*"/>
  303. </delete>
  304. <mkdir dir="@{dir}"/>
  305. </sequential>
  306. </macrodef>
  307. <!--
  308. Reporting failures
  309. Failure-reports supports running multiple build targets in sequence for a
  310. configuration, saving off those results, doing it over, etc., and then
  311. checking the result (of the current builds or all builds), i.e.,
  312. # first set of builds
  313. - build, report-if-failed ...
  314. - build, report-if-failed ...
  315. ...
  316. - {save-build-id} first-set
  317. - save-result
  318. - clean-keep-results
  319. - clean-default-results
  320. # second set of builds
  321. - build, report-if-failed ...
  322. ...
  323. - save-result
  324. # fail build if anything in either set failed
  325. - fail-if-allresults-allfailures
  326. Clients call
  327. <report-if-failed property="failed" text="JUnit failed"/>
  328. to signal failure. This goes into results/failures.txt, to be read later.
  329. Many clients can call this, across many (current) build invocations, so
  330. results just accumulate. Clients should never call <fail> directly; while
  331. the cruise-control script can handle build failures, they won't be recorded
  332. in a way that supports easy evaluation.
  333. To fail if the current builds fail, do
  334. <antcall target="fail-if-results-failures"/>
  335. You can do a sequence of builds (e.g., in 1.3), save the results off,
  336. and do it again (e.g., in 1.4), save the results, and then compare them.
  337. Use save-result to store the current build results in ../allresults.
  338. Between such builds, you can do a clean-keep-results (to clear out jars
  339. and such), followed by clean-default-results (to clear the current results).
  340. (The normal clean also cleans out any results, so avoid that when saving
  341. results from multiple builds.)
  342. Each build can be named using save-build-id. This name must be a valid
  343. directory name. When the results are saved to ../allresults, the directory
  344. name will use the most recent build-id. If none has been saved, then this
  345. creates a name out of the date (down to the second).
  346. To fail if any of the saved builds has failed, do fail-if-allresults-allfailures.
  347. This target ignores the current builds (if they are unsaved).
  348. -->
  349. <macrodef name="report-if-failed">
  350. <attribute name="property"/>
  351. <attribute name="text"/>
  352. <sequential>
  353. <echo level="debug" message="property: @{property}: ${@{property}}"/>
  354. <echo level="debug" message="text: @{text}: ${@{text}}"/>
  355. <condition property="failed" value="true">
  356. <isset property="@{property}"/>
  357. </condition>
  358. <echo level="debug" message="failed: ${failed}"/>
  359. <antcall target="do-report-fail">
  360. <param name="text" value="@{text}"/>
  361. </antcall>
  362. </sequential>
  363. </macrodef>
  364. <target name="do-report-fail"
  365. if="failed">
  366. <echo append="true" file="${aj.failure.file}">${text}
  367. </echo>
  368. </target>
  369. <target name="fail-if-results-failures" depends="init-properties">
  370. <fail-if-failures failureFile="${aj.failure.file}"/>
  371. </target>
  372. <target name="fail-if-allresults-allfailures" depends="init-properties">
  373. <concat destfile="${aj.build.allfailures.file}">
  374. <fileset dir="${aj.build.allresults.dir}"
  375. includes="*/failures.txt"/>
  376. </concat>
  377. <fail-if-failures failureFile="${aj.build.allfailures.file}"/>
  378. </target>
  379. <macrodef name="fail-if-failures"
  380. description="fail if ${failureFile} exists and is not empty">
  381. <attribute name="failureFile"/>
  382. <sequential>
  383. <loadfile
  384. failonerror="false"
  385. property="failures"
  386. srcfile="@{failureFile}"/>
  387. <fail>
  388. <condition>
  389. <length file="@{failureFile}"
  390. when="greater" length="0"/>
  391. </condition>
  392. # @{failureFile} failures:
  393. ${failures}
  394. </fail>
  395. </sequential>
  396. </macrodef>
  397. <macrodef name="jar-property">
  398. <attribute name="name"/>
  399. <attribute name="location"/>
  400. <sequential>
  401. <property name="@{name}"
  402. location="@{location}"/>
  403. <available file="${@{name}}"
  404. property="@{name}.available"
  405. value="${@{name}}"/>
  406. <fail unless="@{name}.available"
  407. message="unable to find @{name}: ${@{name}}"/>
  408. </sequential>
  409. </macrodef>
  410. <macrodef name="set-available"
  411. description="set property and property.available if path exists">
  412. <attribute name="property"/>
  413. <attribute name="path"/>
  414. <sequential>
  415. <property name="@{property}.location"
  416. location="@{path}"/>
  417. <available property="@{property}"
  418. file="${@{property}.location}"
  419. value="${@{property}.location}"/>
  420. <condition property="@{property}.available">
  421. <equals arg1="${@{property}.location}" arg2="${@{property}}"/>
  422. </condition>
  423. </sequential>
  424. </macrodef>
  425. <macrodef name="require-available">
  426. <attribute name="property"/>
  427. <attribute name="path"/>
  428. <attribute name="message" default=""/>
  429. <sequential>
  430. <set-available property="@{property}" path="@{path}"/>
  431. <fail unless="@{property}.available">
  432. @{message} (property "@{property}" not at "@{path}")
  433. </fail>
  434. </sequential>
  435. </macrodef>
  436. </project>