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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <project name="bcel-builder" default="packageAndPush" basedir=".">
  2. <path id="bcel-builder.test.src.path">
  3. <fileset dir="${basedir}/../lib">
  4. <include name="junit/*.jar"/>
  5. </fileset>
  6. <path refid="bcel-builder.src.path"/>
  7. </path>
  8. <path id="bcel-builder.src.path">
  9. <fileset dir="${basedir}/../lib">
  10. <include name="regexp/*.jar"/>
  11. </fileset>
  12. </path>
  13. <target name="cleanall" depends="clean">
  14. <delete dir="bin"/>
  15. <delete dir="bintest"/>
  16. <mkdir dir="bin"/>
  17. </target>
  18. <target name="init"/>
  19. <target name="compile" depends="init">
  20. <srccompile project="bcel-builder" path="bcel-builder.src.path"/>
  21. </target>
  22. <target name="test:compile" depends="compile">
  23. <testcompile project="bcel-builder" path="bcel-builder.test.src.path"/>
  24. </target>
  25. <target name="test" depends="test:compile">
  26. <testrun project="bcel-builder" path="bcel-builder.test.src.path" suite="org.aspectj.apache.bcel.classfile.tests.AllTests"/>
  27. </target>
  28. <!-- *********************************************************************** -->
  29. <!-- top-level -->
  30. <target name="extractAndPatchAndJar" depends="extractAndPatch,jar,srcjar" />
  31. <target name="extractAndPatch" depends="unzipSource,createPatchedSource" />
  32. <target name="packageAndPush" depends="buildTheJars,push"/>
  33. <target name="jar" depends="pack">
  34. <!-- FIXME AV: someone fix this target since it is broken... looks for bcel/build.xml that does not exist -->
  35. <!-- <copy file="../lib/regexp/jakarta-regexp-1.2.jar"-->
  36. <!-- tofile="bcel/lib/Regex.jar" />-->
  37. <!-- <ant dir="bcel" target="jar" />-->
  38. <!-- <copy file="bcel/bin/bcel.jar" toDir="." />-->
  39. </target>
  40. <target name="srcjar" depends="pack">
  41. <zip basedir="bcel" destfile="bcel-src.zip" includes="*/**" excludes="bin/**,lib/**"/>
  42. </target>
  43. <target name="push">
  44. <copy file="bcel.jar" todir="../lib/bcel" />
  45. <copy file="bcel-verifier.jar" todir="../lib/bcel" />
  46. <copy file="bcel-src.zip" todir="../lib/bcel" />
  47. <copy file="bcel-verifier-src.zip" todir="../lib/bcel" />
  48. <delete file="bcel.jar"/>
  49. <delete file="bcel-verifier.jar"/>
  50. <delete file="bcel-src.zip"/>
  51. <delete file="bcel-verifier-src.zip"/>
  52. </target>
  53. <target name="buildTheJars">
  54. <zip file="bcel.jar" basedir="bin" includes="**/*" excludes="**/tests/*,**/verifier/**/*,**/tests"/>
  55. <zip file="bcel-verifier.jar" basedir="bin" includes="**/verifier/**/*" excludes="**/tests,**/tests/*"/>
  56. <zip file="bcel-src.zip" basedir="src" includes="**/*" excludes="**/tests/*.java,**/verifier/**/*"/>
  57. <zip file="bcel-verifier-src.zip" basedir="verifier-src" includes="**/verifier/**/*" excludes="**/tests,**/tests/*"/>
  58. </target>
  59. <target name="diff" depends="transformFromAJ,pack">
  60. <!-- Wipe out some of the rubbish that can arise due to doing a 'ant jar' before doing the diff -->
  61. <delete dir="bcel/bin"/>
  62. <delete dir="bcel/lib"/>
  63. <exec dir="." executable="diff.exe" output="patch.txt">
  64. <arg line="-N"/> <!-- Treat absent files as empty -->
  65. <arg line="-a"/> <!-- Treat all files as text -->
  66. <arg line="-u"/> <!-- Output (default 3) lines of unified context -->
  67. <arg line="-r"/> <!-- Recursively compare any subdirectories found -->
  68. <arg line="-b"/> <!-- Ignore changes in the amount of white space -->
  69. <arg line="bcel-5.1" />
  70. <arg line="bcel" />
  71. </exec>
  72. </target>
  73. <target name="clean">
  74. <delete dir="bcel-5.1" />
  75. <delete dir="bcel" />
  76. <delete file="bcel.jar" />
  77. <delete file="bcel-src.zip" />
  78. <!--delete dir="src" /-->
  79. <mkdir dir="src" /> <!-- empty src dir -->
  80. </target>
  81. <!-- internals -->
  82. <target name="unzipSource">
  83. <delete dir="bcel-5.1" />
  84. <unzip src="bcel-5.1-src.zip" dest="." />
  85. </target>
  86. <target name="createPatchedSource" depends="patch,unpack,transformToAJ" />
  87. <target name="patch">
  88. <delete dir="bcel" />
  89. <copy todir="bcel">
  90. <fileset dir="bcel-5.1" />
  91. </copy>
  92. <patch patchfile="patch.txt" strip="1" dir="bcel" />
  93. </target>
  94. <target name="pack">
  95. <delete dir="bcel/src/java" />
  96. <copy toDir="bcel/src/java">
  97. <fileset dir="src" />
  98. </copy>
  99. </target>
  100. <target name="unpack">
  101. <delete dir="src" />
  102. <copy toDir="src">
  103. <fileset dir="bcel/src/java" >
  104. </fileset>
  105. </copy>
  106. </target>
  107. <target name="transformFromAJ">
  108. <delete dir="src-temp" />
  109. <echo message="Copying 'src' to 'src-temp' and modifying file names to remove aspectj"/>
  110. <copy toDir="src-temp">
  111. <fileset dir="src"/>
  112. <mapper type="regexp" from="^(.*)aspectj\\apache(.*)$" to="\1apache\2"/>
  113. </copy>
  114. <delete dir="src"/>
  115. <echo message="Modifying file contents to change refs from 'org.aspectj.apache.bcel' to 'org.apache.bcel'"/>
  116. <replaceregexp byline="true" flags="g">
  117. <regexp pattern="org.aspectj.apache.bcel"/>
  118. <substitution expression="org.apache.bcel"/>
  119. <fileset dir="src-temp">
  120. <include name="**/*"/>
  121. </fileset>
  122. </replaceregexp>
  123. <echo message="Copying from 'src-temp' back to 'src'"/>
  124. <copy toDir="src">
  125. <fileset dir="src-temp"/>
  126. </copy>
  127. <delete dir="src-temp"/>
  128. </target>
  129. <target name="transformToAJ">
  130. <delete dir="src-temp" />
  131. <echo message="Copying 'src' to 'src-temp' and modifying file names to include aspectj"/>
  132. <copy toDir="src-temp">
  133. <fileset dir="src"/>
  134. <mapper type="regexp" from="^(.*)apache(.*)$" to="\1aspectj\\apache\2"/>
  135. </copy>
  136. <delete dir="src"/>
  137. <echo message="Modifying file contents to change refs from 'org.apache.bcel' to 'org.aspectj.apache.bcel'"/>
  138. <replaceregexp byline="true" flags="g">
  139. <regexp pattern="org.apache.bcel"/>
  140. <substitution expression="org.aspectj.apache.bcel"/>
  141. <fileset dir="src-temp">
  142. <include name="**/*"/>
  143. </fileset>
  144. </replaceregexp>
  145. <echo message="Copying from 'src-temp' back to 'src'"/>
  146. <copy toDir="src">
  147. <fileset dir="src-temp"/>
  148. </copy>
  149. <delete dir="src-temp"/>
  150. </target>
  151. </project>