You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

fetch.xml 7.2 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. <?xml version="1.0"?>
  2. <!--
  3. =======================================================================
  4. Build file to fetch optional libraries for Apache Ant
  5. Copyright (c) 2005-2006 The Apache Software Foundation. All rights
  6. reserved.
  7. =======================================================================
  8. -->
  9. <project name="fetch" default="all" basedir=".">
  10. <description>
  11. This build file downloads JAR files that optional Ant tasks use,
  12. and installs them in a location that is accessible the next time Ant runs.
  13. You can choose three locations, by going -Ddest=LOCATION on the command line
  14. -Ddest=user user lib dir ${user.home}/.ant/lib
  15. -Ddest=system ant lib dir ${ant.home}/lib --Default--
  16. -Ddest=optional optional dir ${ant.home}/lib/optional (for Ant developers)
  17. You may also need to set proxy settings. On Java1.5, Ant tries to get
  18. this from the OS, unless you use the -noproxy option.
  19. Proxies can be configured manually setting the JVM proxy values in the
  20. ANT_OPTS environment variable.
  21. For example, to set the proxy up in the tcsh shell, the command would be
  22. something like:
  23. For csh/tcsh:
  24. setenv ANT_OPTS "-Dhttp.proxyHost=proxy -Dhttp.proxyPort=8080"
  25. For bash:
  26. export ANT_OPTS="-Dhttp.proxyHost=proxy -Dhttp.proxyPort=8080"
  27. For Windows, set the environment variable in the appropriate dialog box
  28. and open a new console. or, by hand
  29. set ANT_OPTS = -Dhttp.proxyHost=proxy -Dhttp.proxyPort=8080
  30. </description>
  31. <!-- Give user a chance to override without editing this file
  32. (and without typing -D each time it compiles it) -->
  33. <property file="${user.home}/.ant/ant.properties"/>
  34. <property name="lib.dir" location="lib" />
  35. <property name="optional.dir" location="${lib.dir}/optional" />
  36. <property name="userlib.dir" location="${user.home}/.ant/lib" />
  37. <!-- load in our properties table -->
  38. <property file="${lib.dir}/libraries.properties"/>
  39. <target name="pick-dest">
  40. <condition property="dest.dir"
  41. value="${lib.dir}">
  42. <or>
  43. <equals arg1="${dest}" arg2="system" />
  44. <not><isset property="dest"/></not>
  45. </or>
  46. </condition>
  47. <condition property="dest.dir"
  48. value="${optional.dir}">
  49. <equals arg1="${dest}" arg2="optional" />
  50. </condition>
  51. <condition property="dest.dir"
  52. value="${userlib.dir}">
  53. <equals arg1="${dest}" arg2="user" />
  54. </condition>
  55. <fail>
  56. Unknown destination : ${dest}
  57. <condition>
  58. <not><isset property="dest.dir" /></not>
  59. </condition>
  60. </fail>
  61. <echo>Downloading to ${dest.dir}</echo>
  62. </target>
  63. <target name="probe-m2" depends="pick-dest">
  64. <!-- Look for M2 ant tasks in our classpath-->
  65. <property name="m2.artifact" location="${dest.dir}/${m2.jar.name}"/>
  66. <available property="m2.antlib.found"
  67. resource="org/apache/maven/artifact/ant/antlib.xml" />
  68. <condition property="m2.antlib.typefound">
  69. <typefound name="antlib:org.apache.maven.artifact.ant:artifact" />
  70. </condition>
  71. </target>
  72. <target name="download-m2" depends="probe-m2,pick-dest" unless="m2.antlib.found">
  73. <!-- fetch M2 ant tasks into our repository, if it is not there-->
  74. <get src="${m2.antlib.url}"
  75. dest="${m2.artifact}"
  76. verbose="true"
  77. usetimestamp="false"/>
  78. </target>
  79. <target name="dont-validate-m2-checksum" depends="probe-m2"
  80. if="m2.antlib.found">
  81. <property name="checksum.equal" value="true" />
  82. </target>
  83. <target name="validate-m2-checksum"
  84. depends="download-m2,dont-validate-m2-checksum"
  85. if="m2.sha1.checksum" unless="m2.antlib.found">
  86. <checksum file="${m2.artifact}"
  87. algorithm="SHA"
  88. property="${m2.sha1.checksum}"
  89. verifyProperty="checksum.equal"/>
  90. </target>
  91. <target name="checksum-mismatch" depends="validate-m2-checksum"
  92. unless="checksum.equal" if="m2.sha1.checksum">
  93. <delete file="${m2.artifact}"/>
  94. <fail >
  95. Failed to verify the downloaded file ${m2.antlib.url}" against the checksum
  96. coded into libraries.properties.
  97. The local copy has been deleted, for security reasons
  98. </fail>
  99. </target>
  100. <target name="checksum-match" depends="checksum-mismatch"
  101. unless="checksum.equal">
  102. <fail status="0">
  103. The Maven2 JAR has been installed; rerun Ant to load it.
  104. </fail>
  105. </target>
  106. <target name="get-m2" depends="checksum-match"
  107. description="Download the Maven2 Ant tasks"/>
  108. <target name="macros" depends="get-m2"
  109. xmlns:artifact="antlib:org.apache.maven.artifact.ant">
  110. <macrodef name="f2">
  111. <attribute name="project" />
  112. <attribute name="archive" default="@{project}"/>
  113. <sequential>
  114. <fail>
  115. Unknown archive @{archive}
  116. <condition>
  117. <not>
  118. <isset property="@{archive}.version"/>
  119. </not>
  120. </condition>
  121. </fail>
  122. <artifact:dependencies pathID="@{archive}.path">
  123. <dependency groupID="@{project}"
  124. artifactID="@{archive}"
  125. version="${@{archive}.version}"/>
  126. </artifact:dependencies>
  127. <!-- now we are left with the problem of getting the files
  128. into our directory -->
  129. <copypath destdir="${dest.dir}" pathref="@{archive}.path">
  130. <flattenmapper/>
  131. </copypath>
  132. </sequential>
  133. </macrodef>
  134. </target>
  135. <!-- any init stuff -->
  136. <target name="init" depends="pick-dest,macros" >
  137. </target>
  138. <target name="diag" depends="init">
  139. <echoproperties />
  140. </target>
  141. <target name="logging"
  142. description="load logging libraries"
  143. depends="init">
  144. <f2 project="log4j" />
  145. <f2 project="commons-logging" archive="commons-logging-api" />
  146. </target>
  147. <target name="junit"
  148. description="load junit libraries"
  149. depends="init">
  150. <f2 project="junit" />
  151. </target>
  152. <target name="xml"
  153. description="load full XML libraries (xalan, resolver)"
  154. depends="init">
  155. <f2 project="xalan" />
  156. <f2 project="xml-resolver" />
  157. </target>
  158. <target name="networking"
  159. description="load networking libraries (commons-net; jsch)"
  160. depends="init">
  161. <f2 project="commons-net" />
  162. <f2 project="jsch" />
  163. </target>
  164. <target name="regexp"
  165. description="load regexp libraries"
  166. depends="init">
  167. <f2 project="regexp" />
  168. <f2 project="oro" />
  169. </target>
  170. <target name="antlr"
  171. description="load antlr libraries"
  172. depends="init">
  173. <f2 project="antlr" />
  174. </target>
  175. <target name="bcel"
  176. description="load bcel libraries"
  177. depends="init">
  178. <f2 project="bcel" />
  179. </target>
  180. <target name="jdepend"
  181. description="load jdepend libraries"
  182. depends="init">
  183. <f2 project="jdepend" />
  184. </target>
  185. <target name="bsf"
  186. description="load bsf libraries"
  187. depends="init">
  188. <f2 project="bsf" />
  189. </target>
  190. <target name="debugging"
  191. description="internal ant debugging"
  192. depends="init">
  193. <f2 project="which" />
  194. </target>
  195. <target name="all"
  196. description="load all the libraries"
  197. depends="logging,junit,xml,networking,regexp,antlr,bcel,jdepend,bsf,debugging" />
  198. </project>