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 4.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <project default="build-test" basedir=".">
  2. <target name="info">
  3. <echo>
  4. This script verifies that the example build script in the
  5. Ant section of the development environment guide works.
  6. The target "build-test" should be exactly what's copied from
  7. the development environment guide, as rendered.
  8. To setup for a given version of AspectJ, either build the
  9. tools distribution or define the variable aspectj.home.
  10. This should build the two input jars and then run the
  11. test, which builds and runs an application. It should
  12. request incremental input (press "q{enter}" to quit)
  13. and emit the text:
  14. [java] called Util.utility("persistMe shouting!")
  15. [java] set persistMe to PERSISTME SHOUTING!
  16. Use the "clean" target to remove generated files.
  17. When running from eclipse, set fork.iajc="true" and
  18. change build-test iajc call to avoid incremental mode.
  19. </echo>
  20. </target>
  21. <target name="init">
  22. <property name="fork.iajc"
  23. value="false"/>
  24. <property name="home.dir"
  25. location="${basedir}"/>
  26. <property name="aspectj.modules.dir"
  27. location="../../.."/>
  28. <property name="aspectj.home"
  29. location="${aspectj.modules.dir}/aj-build/dist/tools"/>
  30. <available property="aspectj.home.available"
  31. file="${aspectj.home}/lib/aspectjtools.jar"/>
  32. <available property="aspectjtools.jar.available"
  33. file="${home.dir}/tools/aspectj/lib/aspectjrt.jar"/>
  34. <available property="aspectjrt.jar.available"
  35. file="${home.dir}/tools/aspectj/lib/aspectjrt.jar"/>
  36. <available property="persist.jar.available"
  37. file="${home.dir}/ec/int/persist.jar"/>
  38. <available property="module.jar.available"
  39. file="${home.dir}/build/module.jar"/>
  40. </target>
  41. <target name="taskdef" depends="init,local.aspectj.setup">
  42. <taskdef resource="org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties">
  43. <classpath>
  44. <path location="${home.dir}/tools/aspectj/lib/aspectjtools.jar"/>
  45. </classpath>
  46. </taskdef>
  47. </target>
  48. <target name="clean" depends="init">
  49. <delete quiet="on">
  50. <fileset dir="${home.dir}/build/binary-input"
  51. excludes="ignore.txt"/>
  52. <fileset dir="${home.dir}"
  53. includes="ec/int/persist.jar,
  54. build/module.jar,
  55. output/application.jar,
  56. tools/aspectj/lib/aspectj*.jar"/>
  57. </delete>
  58. </target>
  59. <target name="local.aspectj.setup" depends="init"
  60. unless="aspectjtools.jar.available,aspectjrt.jar.available">
  61. <fail unless="aspectj.home.available"
  62. message="define or build aspectj.home: ${aspectj.home}"/>
  63. <mkdir dir="${home.dir}/tools/aspectj/lib/"/>
  64. <copy todir="${home.dir}/tools/aspectj/lib"
  65. filtering="off">
  66. <fileset dir="${aspectj.home}/lib" includes="aspectj*.jar"/>
  67. </copy>
  68. <available property="aspectjtools.jar.available"
  69. file="${home.dir}/tools/aspectj/lib/aspectjrt.jar"/>
  70. <available property="aspectjrt.jar.available"
  71. file="${home.dir}/tools/aspectj/lib/aspectjrt.jar"/>
  72. </target>
  73. <target name="setup" depends="init,taskdef,local.aspectj.setup"
  74. unless="module.jar.available,persist.jar.available">
  75. <iajc outJar="${home.dir}/ec/int/persist.jar"
  76. failonerror="true"
  77. fork="${fork.iajc}"
  78. sourceroots="${home.dir}/ec/int/src"
  79. classpath="${home.dir}/tools/aspectj/lib/aspectjrt.jar"/>
  80. <iajc outJar="${home.dir}/build/module.jar"
  81. failonerror="true"
  82. fork="${fork.iajc}"
  83. sourceroots="${home.dir}/ec/module/src"
  84. classpath="${home.dir}/tools/aspectj/lib/aspectjrt.jar"/>
  85. <mkdir dir="${home.dir}/build/binary-input"/>
  86. <iajc destdir="${home.dir}/build/binary-input"
  87. failonerror="true"
  88. fork="${fork.iajc}"
  89. sourceroots="${home.dir}/ec/inpathDirSrc"
  90. classpath="${home.dir}/tools/aspectj/lib/aspectjrt.jar"/>
  91. </target>
  92. <target name="build-test" depends="init,taskdef,setup"
  93. description="test Ant script from the devguide">
  94. <!-- copy below from the Ant section of the rendered devguide -->
  95. <!-- in eclipse, must run forked and not incremental -->
  96. <iajc outjar="${home.dir}/output/application.jar"
  97. sourceRootCopyFilter="**/CVS/*,**/*.java"
  98. inpathDirCopyFilter="**/CVS/*,**/*.java,**/*.class"
  99. incremental="true" >
  100. <sourceroots>
  101. <pathelement location="${home.dir}/ec/project/src"/>
  102. <pathelement location="${home.dir}/ec/project/testsrc"/>
  103. </sourceroots>
  104. <inpath>
  105. <pathelement location="${home.dir}/build/module.jar"/>
  106. <pathelement location="${home.dir}/build/binary-input"/>
  107. </inpath>
  108. <aspectpath>
  109. <pathelement location="${home.dir}/ec/int/persist.jar"/>
  110. </aspectpath>
  111. <classpath>
  112. <pathelement location="${home.dir}/tools/aspectj/lib/aspectjrt.jar"/>
  113. </classpath>
  114. </iajc>
  115. <java classname="org.smart.app.Main">
  116. <classpath>
  117. <pathelement location="${home.dir}/tools/aspectj/lib/aspectjrt.jar"/>
  118. <pathelement location="${home.dir}/ec/int/persist.jar"/>
  119. <pathelement location="${home.dir}/output/application.jar"/>
  120. </classpath>
  121. </java>
  122. </target>
  123. </project>