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

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