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.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <project default="packageAndPush" basedir=".">
  2. <!-- top-level -->
  3. <target name="extractAndPatchAndJar" depends="extractAndPatch,jar,srcjar" />
  4. <target name="extractAndPatch" depends="unzipSource,createPatchedSource" />
  5. <target name="packageAndPush" depends="buildTheJars,push"/>
  6. <target name="jar" depends="pack">
  7. <copy file="../lib/regexp/jakarta-regexp-1.2.jar"
  8. tofile="bcel/lib/Regex.jar" />
  9. <ant dir="bcel" target="jar" />
  10. <copy file="bcel/bin/bcel.jar" toDir="." />
  11. </target>
  12. <target name="srcjar" depends="pack">
  13. <zip basedir="bcel" destfile="bcel-src.zip" includes="*/**" excludes="bin/**,lib/**"/>
  14. </target>
  15. <target name="push">
  16. <copy file="bcel.jar" todir="../lib/bcel" />
  17. <copy file="bcel-src.zip" todir="../lib/bcel" />
  18. </target>
  19. <target name="buildTheJars">
  20. <zip file="bcel.jar" basedir="bin" includes="**/*" excludes="**/tests/*.class"/>
  21. <zip file="bcel-src.zip" basedir="src" includes="**/*"/>
  22. </target>
  23. <target name="diff" depends="transformFromAJ,pack">
  24. <!-- Wipe out some of the rubbish that can arise due to doing a 'ant jar' before doing the diff -->
  25. <delete dir="bcel/bin"/>
  26. <delete dir="bcel/lib"/>
  27. <exec dir="." executable="diff.exe" output="patch.txt">
  28. <arg line="-N"/> <!-- Treat absent files as empty -->
  29. <arg line="-a"/> <!-- Treat all files as text -->
  30. <arg line="-u"/> <!-- Output (default 3) lines of unified context -->
  31. <arg line="-r"/> <!-- Recursively compare any subdirectories found -->
  32. <arg line="-b"/> <!-- Ignore changes in the amount of white space -->
  33. <arg line="bcel-5.1" />
  34. <arg line="bcel" />
  35. </exec>
  36. </target>
  37. <target name="clean">
  38. <delete dir="bcel-5.1" />
  39. <delete dir="bcel" />
  40. <delete file="bcel.jar" />
  41. <delete file="bcel-src.zip" />
  42. <!--delete dir="src" /-->
  43. <mkdir dir="src" /> <!-- empty src dir -->
  44. </target>
  45. <!-- internals -->
  46. <target name="unzipSource">
  47. <delete dir="bcel-5.1" />
  48. <unzip src="bcel-5.1-src.zip" dest="." />
  49. </target>
  50. <target name="createPatchedSource" depends="patch,unpack,transformToAJ" />
  51. <target name="patch">
  52. <delete dir="bcel" />
  53. <copy todir="bcel">
  54. <fileset dir="bcel-5.1" />
  55. </copy>
  56. <patch patchfile="patch.txt" strip="1" dir="bcel" />
  57. </target>
  58. <target name="pack">
  59. <delete dir="bcel/src/java" />
  60. <copy toDir="bcel/src/java">
  61. <fileset dir="src" />
  62. </copy>
  63. </target>
  64. <target name="unpack">
  65. <delete dir="src" />
  66. <copy toDir="src">
  67. <fileset dir="bcel/src/java" >
  68. </fileset>
  69. </copy>
  70. </target>
  71. <target name="transformFromAJ">
  72. <delete dir="src-temp" />
  73. <echo message="Copying 'src' to 'src-temp' and modifying file names to remove aspectj"/>
  74. <copy toDir="src-temp">
  75. <fileset dir="src"/>
  76. <mapper type="regexp" from="^(.*)aspectj\\apache(.*)$" to="\1apache\2"/>
  77. </copy>
  78. <delete dir="src"/>
  79. <echo message="Modifying file contents to change refs from 'org.aspectj.apache.bcel' to 'org.apache.bcel'"/>
  80. <replaceregexp byline="true" flags="g">
  81. <regexp pattern="org.aspectj.apache.bcel"/>
  82. <substitution expression="org.apache.bcel"/>
  83. <fileset dir="src-temp">
  84. <include name="**/*"/>
  85. </fileset>
  86. </replaceregexp>
  87. <echo message="Copying from 'src-temp' back to 'src'"/>
  88. <copy toDir="src">
  89. <fileset dir="src-temp"/>
  90. </copy>
  91. <delete dir="src-temp"/>
  92. </target>
  93. <target name="transformToAJ">
  94. <delete dir="src-temp" />
  95. <echo message="Copying 'src' to 'src-temp' and modifying file names to include aspectj"/>
  96. <copy toDir="src-temp">
  97. <fileset dir="src"/>
  98. <mapper type="regexp" from="^(.*)apache(.*)$" to="\1aspectj\\apache\2"/>
  99. </copy>
  100. <delete dir="src"/>
  101. <echo message="Modifying file contents to change refs from 'org.apache.bcel' to 'org.aspectj.apache.bcel'"/>
  102. <replaceregexp byline="true" flags="g">
  103. <regexp pattern="org.apache.bcel"/>
  104. <substitution expression="org.aspectj.apache.bcel"/>
  105. <fileset dir="src-temp">
  106. <include name="**/*"/>
  107. </fileset>
  108. </replaceregexp>
  109. <echo message="Copying from 'src-temp' back to 'src'"/>
  110. <copy toDir="src">
  111. <fileset dir="src-temp"/>
  112. </copy>
  113. <delete dir="src-temp"/>
  114. </target>
  115. </project>