david_williams | 42f9b24 | 2006-11-27 18:45:14 +0000 | [diff] [blame] | 1 | <?xml version="1.0" encoding="UTF-8"?> |
ndai | b8cedc8 | 2005-09-13 18:00:32 +0000 | [diff] [blame] | 2 | <!-- |
david_williams | 1cff0e9 | 2006-11-23 00:40:29 +0000 | [diff] [blame] | 3 | |
| 4 | |
| 5 | dependency |
| 6 | This script get a library from a remote repository and stores it in a local cache. |
| 7 | |
| 8 | The following properties are used by this script: |
| 9 | |
| 10 | local.cache.dir - the absolute path to the local repository for the libraries |
| 11 | dependency.url : Url to a remote repository that will be used to download the library |
| 12 | dependency.file: Name of the library that is used. If the library is platform dependent |
| 13 | it must have suffixes such as: file.linux.gtk.x86 |
david_williams | 42f9b24 | 2006-11-27 18:45:14 +0000 | [diff] [blame] | 14 | These suffixes are the same as those used by releng baseos,basews,base arch |
david_williams | 1cff0e9 | 2006-11-23 00:40:29 +0000 | [diff] [blame] | 15 | baseos= linux or win32 |
| 16 | basews= gtk or win32 |
david_williams | 42f9b24 | 2006-11-27 18:45:14 +0000 | [diff] [blame] | 17 | base arch=x86 or ppc |
david_williams | 1cff0e9 | 2006-11-23 00:40:29 +0000 | [diff] [blame] | 18 | dependency.name: A short user readable name for the library. |
| 19 | dependency.description: One line description for the library. |
| 20 | dependency.autodownload: [optional] default true. Set this to false if the file cannot be |
| 21 | downloaded automatically (i.e. requies license accept click through). |
| 22 | If autodownload is false, and the library is not avaialbe in the local |
| 23 | repository (cache). User must download the library and copy it into |
| 24 | the local repository. |
| 25 | dependency.releng.url: [optional] A mirror of the original repository. Useful for libraries |
| 26 | that can get deleted from their original URLs. Releng will use |
| 27 | the local cache, original url, releng.url in that order to get the |
| 28 | the dependency. If a releng.url is not provided, the library will |
| 29 | always be requested from itrs original site. |
ndai | b8cedc8 | 2005-09-13 18:00:32 +0000 | [diff] [blame] | 30 | --> |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 31 | <project |
| 32 | name="dependency" |
| 33 | default="default"> |
david_williams | 1cff0e9 | 2006-11-23 00:40:29 +0000 | [diff] [blame] | 34 | <description> |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 35 | This script get a library from a remote repository and stores it |
| 36 | in a local cache. |
ndai | b8cedc8 | 2005-09-13 18:00:32 +0000 | [diff] [blame] | 37 | </description> |
| 38 | |
| 39 | |
david_williams | 1cff0e9 | 2006-11-23 00:40:29 +0000 | [diff] [blame] | 40 | <!-- ================================= |
| 41 | target: default |
| 42 | ================================= --> |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 43 | <target |
| 44 | name="default" |
| 45 | description="This script get a library from a remote repository and stores it in a local cache."> |
david_williams | 1cff0e9 | 2006-11-23 00:40:29 +0000 | [diff] [blame] | 46 | <condition property="dependency.download.file"> |
| 47 | <or> |
| 48 | <not> |
| 49 | <isset property="dependency.autodownload" /> |
| 50 | </not> |
| 51 | <and> |
| 52 | <isset property="dependency.autodownload" /> |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 53 | <equals |
| 54 | arg1="${dependency.autodownload}" |
| 55 | arg2="true" /> |
david_williams | 1cff0e9 | 2006-11-23 00:40:29 +0000 | [diff] [blame] | 56 | </and> |
| 57 | </or> |
| 58 | </condition> |
| 59 | <antcall target="get" /> |
| 60 | <antcall target="checkAutoDownload" /> |
| 61 | </target> |
ndai | b8cedc8 | 2005-09-13 18:00:32 +0000 | [diff] [blame] | 62 | |
david_williams | 1cff0e9 | 2006-11-23 00:40:29 +0000 | [diff] [blame] | 63 | <!-- - - - - - - - - - - - - - - - - - |
| 64 | target: sub tasks |
| 65 | - - - - - - - - - - - - - - - - - --> |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 66 | <target |
| 67 | name="get" |
| 68 | if="dependency.download.file"> |
david_williams | 1cff0e9 | 2006-11-23 00:40:29 +0000 | [diff] [blame] | 69 | <mkdir dir="${local.cache.dir}" /> |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 70 | <available |
| 71 | file="${local.cache.dir}/${dependency.file}" |
| 72 | property="local.cache.file.exists" /> |
david_williams | 1cff0e9 | 2006-11-23 00:40:29 +0000 | [diff] [blame] | 73 | <antcall target="download" /> |
| 74 | </target> |
ndai | b8cedc8 | 2005-09-13 18:00:32 +0000 | [diff] [blame] | 75 | |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 76 | <target |
| 77 | name="checkAutoDownload" |
| 78 | unless="dependency.download.file"> |
| 79 | <fail |
| 80 | unless="local.cache.file.exists" |
| 81 | message="The dependent file ${dependency.name}, must be manually downloaded and placed in ${local.cache.dir}." /> |
david_williams | 1cff0e9 | 2006-11-23 00:40:29 +0000 | [diff] [blame] | 82 | </target> |
ndai | b8cedc8 | 2005-09-13 18:00:32 +0000 | [diff] [blame] | 83 | |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 84 | <target |
| 85 | name="download" |
| 86 | unless="local.cache.file.exists"> |
| 87 | <get |
| 88 | verbose="true" |
| 89 | src="${dependency.url}/${dependency.file}" |
| 90 | dest="${local.cache.dir}/${dependency.file}" |
| 91 | ignoreerrors="true" /> |
ndai | b8cedc8 | 2005-09-13 18:00:32 +0000 | [diff] [blame] | 92 | |
david_williams | 1cff0e9 | 2006-11-23 00:40:29 +0000 | [diff] [blame] | 93 | <condition property="download.from.mirror"> |
| 94 | <and> |
| 95 | <isset property="dependency.releng.url" /> |
| 96 | <not> |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 97 | <available |
| 98 | file="${local.cache.dir}/${dependency.file}" /> |
david_williams | 1cff0e9 | 2006-11-23 00:40:29 +0000 | [diff] [blame] | 99 | </not> |
| 100 | </and> |
| 101 | </condition> |
| 102 | <antcall target="downloadMirror" /> |
| 103 | </target> |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 104 | <target |
| 105 | name="downloadMirror" |
| 106 | if="download.from.mirror"> |
| 107 | <echo |
| 108 | message="Using mirror repository: ${main.url.file.exists}" /> |
| 109 | <echo |
| 110 | message="Using mirror repository: ${dependency.releng.url}" /> |
| 111 | <get |
| 112 | verbose="true" |
| 113 | src="${dependency.releng.url}/${dependency.file}" |
| 114 | dest="${local.cache.dir}/${dependency.file}" /> |
david_williams | 1cff0e9 | 2006-11-23 00:40:29 +0000 | [diff] [blame] | 115 | </target> |
ndai | b8cedc8 | 2005-09-13 18:00:32 +0000 | [diff] [blame] | 116 | |
| 117 | |
david_williams | 1cff0e9 | 2006-11-23 00:40:29 +0000 | [diff] [blame] | 118 | <!-- ================================= |
| 119 | target: install |
| 120 | ================================= --> |
| 121 | <target name="install"> |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 122 | <condition |
| 123 | property="file.type" |
| 124 | value="zip"> |
david_williams | 1cff0e9 | 2006-11-23 00:40:29 +0000 | [diff] [blame] | 125 | <isfileselected file="${dependency.file}"> |
| 126 | <selector> |
| 127 | <filename name="**/*.zip" /> |
| 128 | </selector> |
| 129 | </isfileselected> |
| 130 | </condition> |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 131 | <condition |
| 132 | property="file.type" |
| 133 | value="tgz"> |
david_williams | 1cff0e9 | 2006-11-23 00:40:29 +0000 | [diff] [blame] | 134 | <isfileselected file="${dependency.file}"> |
| 135 | <selector> |
| 136 | <filename name="**/*.tar.gz" /> |
| 137 | </selector> |
| 138 | </isfileselected> |
| 139 | </condition> |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 140 | <condition |
| 141 | property="file.type" |
| 142 | value="tgz"> |
david_williams | 1cff0e9 | 2006-11-23 00:40:29 +0000 | [diff] [blame] | 143 | <isfileselected file="${dependency.file}"> |
| 144 | <selector> |
| 145 | <filename name="**/*.tgz" /> |
| 146 | </selector> |
| 147 | </isfileselected> |
| 148 | </condition> |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 149 | <condition |
| 150 | property="file.type" |
| 151 | value="tar"> |
david_williams | 1cff0e9 | 2006-11-23 00:40:29 +0000 | [diff] [blame] | 152 | <isfileselected file="${dependency.file}"> |
| 153 | <selector> |
| 154 | <filename name="**/*.tar" /> |
| 155 | </selector> |
| 156 | </isfileselected> |
| 157 | </condition> |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 158 | <condition |
| 159 | property="file.type" |
| 160 | value="map"> |
david_williams | df8c92e | 2007-02-17 04:55:27 +0000 | [diff] [blame] | 161 | <isfileselected file="${dependency.file}"> |
| 162 | <selector> |
| 163 | <filename name="**/*.map" /> |
| 164 | </selector> |
| 165 | </isfileselected> |
| 166 | </condition> |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 167 | <condition |
| 168 | property="file.type" |
| 169 | value="jar"> |
david_williams | 948bf55 | 2007-02-26 05:17:22 +0000 | [diff] [blame] | 170 | <isfileselected file="${dependency.file}"> |
| 171 | <selector> |
| 172 | <filename name="**/*.jar" /> |
| 173 | </selector> |
| 174 | </isfileselected> |
| 175 | </condition> |
ndai | b8cedc8 | 2005-09-13 18:00:32 +0000 | [diff] [blame] | 176 | |
david_williams | 1cff0e9 | 2006-11-23 00:40:29 +0000 | [diff] [blame] | 177 | <antcall target="install-${file.type}" /> |
| 178 | </target> |
ndai | b8cedc8 | 2005-09-13 18:00:32 +0000 | [diff] [blame] | 179 | |
david_williams | 1cff0e9 | 2006-11-23 00:40:29 +0000 | [diff] [blame] | 180 | <target name="install-tar"> |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 181 | <untar |
| 182 | dest="${install.destination}" |
| 183 | src="${local.cache.dir}/${dependency.file}" |
| 184 | overwrite="true" /> |
david_williams | 1cff0e9 | 2006-11-23 00:40:29 +0000 | [diff] [blame] | 185 | </target> |
| 186 | <target name="install-tgz"> |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 187 | <untar |
| 188 | dest="${install.destination}" |
| 189 | src="${local.cache.dir}/${dependency.file}" |
| 190 | compression="gzip" |
| 191 | overwrite="true" /> |
david_williams | 1cff0e9 | 2006-11-23 00:40:29 +0000 | [diff] [blame] | 192 | </target> |
| 193 | <target name="install-zip"> |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 194 | <unzip |
| 195 | dest="${install.destination}" |
| 196 | src="${local.cache.dir}/${dependency.file}" |
| 197 | overwrite="true" /> |
david_williams | 1cff0e9 | 2006-11-23 00:40:29 +0000 | [diff] [blame] | 198 | </target> |
david_williams | df8c92e | 2007-02-17 04:55:27 +0000 | [diff] [blame] | 199 | <target name="install-map"> |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 200 | <copy |
| 201 | todir="${install.destination}" |
| 202 | file="${local.cache.dir}/${dependency.file}" |
| 203 | overwrite="true" /> |
david_williams | df8c92e | 2007-02-17 04:55:27 +0000 | [diff] [blame] | 204 | </target> |
david_williams | 948bf55 | 2007-02-26 05:17:22 +0000 | [diff] [blame] | 205 | <target name="install-jar"> |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 206 | <copy |
| 207 | todir="${install.destination}" |
| 208 | file="${local.cache.dir}/${dependency.file}" |
| 209 | overwrite="true" /> |
david_williams | 948bf55 | 2007-02-26 05:17:22 +0000 | [diff] [blame] | 210 | </target> |
ndai | b8cedc8 | 2005-09-13 18:00:32 +0000 | [diff] [blame] | 211 | |
david_williams | 1cff0e9 | 2006-11-23 00:40:29 +0000 | [diff] [blame] | 212 | <target name="checkDependency"> |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 213 | <dirname |
| 214 | file="${ant.file}" |
| 215 | property="dependency.dir" /> |
ndai | b8cedc8 | 2005-09-13 18:00:32 +0000 | [diff] [blame] | 216 | |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 217 | <copy |
| 218 | tofile="${buildDirectory}/dependency.${groupId}.xml" |
| 219 | overwrite="true"> |
david_williams | 1cff0e9 | 2006-11-23 00:40:29 +0000 | [diff] [blame] | 220 | <fileset dir="${dependency.dir}"> |
| 221 | <include name="template.xml" /> |
| 222 | </fileset> |
| 223 | </copy> |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 224 | <echo |
| 225 | message="Creating dependency script: ${buildDirectory}/dependency.${groupId}.xml " /> |
| 226 | <replace |
| 227 | file="${buildDirectory}/dependency.${groupId}.xml" |
| 228 | value="${groupId}."> |
david_williams | 1cff0e9 | 2006-11-23 00:40:29 +0000 | [diff] [blame] | 229 | <replacetoken>@dependencyGroupId@</replacetoken> |
| 230 | </replace> |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 231 | <replace |
| 232 | file="${buildDirectory}/dependency.${groupId}.xml" |
| 233 | value="${dependency.dir}"> |
david_williams | 1cff0e9 | 2006-11-23 00:40:29 +0000 | [diff] [blame] | 234 | <replacetoken>@dependencyDir@</replacetoken> |
| 235 | </replace> |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 236 | <replace |
| 237 | file="${buildDirectory}/dependency.${groupId}.xml" |
| 238 | value="${dependency.properties}"> |
david_williams | 1cff0e9 | 2006-11-23 00:40:29 +0000 | [diff] [blame] | 239 | <replacetoken>@dependencyProperties@</replacetoken> |
| 240 | </replace> |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 241 | <ant |
| 242 | antfile="${buildDirectory}/dependency.${groupId}.xml" |
| 243 | target="get" /> |
ndai | b8cedc8 | 2005-09-13 18:00:32 +0000 | [diff] [blame] | 244 | |
david_williams | 1cff0e9 | 2006-11-23 00:40:29 +0000 | [diff] [blame] | 245 | <!-- |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 246 | <delete failonerror="false"> |
david_williams | 1cff0e9 | 2006-11-23 00:40:29 +0000 | [diff] [blame] | 247 | <fileset dir="."> |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 248 | <include name="${buildDirectory}/dependency.${groupId}.xml" /> |
david_williams | 1cff0e9 | 2006-11-23 00:40:29 +0000 | [diff] [blame] | 249 | </fileset> |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 250 | </delete> |
| 251 | --> |
ndai | b8cedc8 | 2005-09-13 18:00:32 +0000 | [diff] [blame] | 252 | |
| 253 | |
david_williams | 1cff0e9 | 2006-11-23 00:40:29 +0000 | [diff] [blame] | 254 | </target> |
ndai | b8cedc8 | 2005-09-13 18:00:32 +0000 | [diff] [blame] | 255 | |
david_williams | 1cff0e9 | 2006-11-23 00:40:29 +0000 | [diff] [blame] | 256 | <target name="installDependency"> |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 257 | <dirname |
| 258 | file="${ant.file}" |
| 259 | property="dependency.dir" /> |
ndai | b8cedc8 | 2005-09-13 18:00:32 +0000 | [diff] [blame] | 260 | |
david_williams | 1cff0e9 | 2006-11-23 00:40:29 +0000 | [diff] [blame] | 261 | <copy tofile="${buildDirectory}/dependency.${groupId}.xml"> |
| 262 | <fileset dir="${dependency.dir}"> |
| 263 | <include name="template.xml" /> |
| 264 | </fileset> |
| 265 | </copy> |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 266 | <replace |
| 267 | file="${buildDirectory}/dependency.${groupId}.xml" |
| 268 | value="${groupId}."> |
david_williams | 1cff0e9 | 2006-11-23 00:40:29 +0000 | [diff] [blame] | 269 | <replacetoken>@dependencyGroupId@</replacetoken> |
| 270 | </replace> |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 271 | <replace |
| 272 | file="${buildDirectory}/dependency.${groupId}.xml" |
| 273 | value="${dependency.dir}"> |
david_williams | 1cff0e9 | 2006-11-23 00:40:29 +0000 | [diff] [blame] | 274 | <replacetoken>@dependencyDir@</replacetoken> |
| 275 | </replace> |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 276 | <replace |
| 277 | file="${buildDirectory}/dependency.${groupId}.xml" |
| 278 | value="${dependency.properties}"> |
david_williams | 1cff0e9 | 2006-11-23 00:40:29 +0000 | [diff] [blame] | 279 | <replacetoken>@dependencyProperties@</replacetoken> |
| 280 | </replace> |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 281 | <ant |
| 282 | antfile="${buildDirectory}/dependency.${groupId}.xml" |
| 283 | target="install"> |
| 284 | <property |
| 285 | name="install.destination" |
| 286 | value="${install.destination}" /> |
david_williams | 1cff0e9 | 2006-11-23 00:40:29 +0000 | [diff] [blame] | 287 | </ant> |
ndai | b8cedc8 | 2005-09-13 18:00:32 +0000 | [diff] [blame] | 288 | |
david_williams | 1cff0e9 | 2006-11-23 00:40:29 +0000 | [diff] [blame] | 289 | <!-- |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 290 | <delete failonerror="false"> |
david_williams | 1cff0e9 | 2006-11-23 00:40:29 +0000 | [diff] [blame] | 291 | <fileset dir="."> |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 292 | <include name="${buildDirectory}/dependency.${groupId}.xml" /> |
david_williams | 1cff0e9 | 2006-11-23 00:40:29 +0000 | [diff] [blame] | 293 | </fileset> |
david_williams | 403beae | 2007-12-09 02:10:40 +0000 | [diff] [blame] | 294 | </delete> |
david_williams | 1cff0e9 | 2006-11-23 00:40:29 +0000 | [diff] [blame] | 295 | --> |
| 296 | </target> |
ndai | b8cedc8 | 2005-09-13 18:00:32 +0000 | [diff] [blame] | 297 | |
| 298 | |
| 299 | </project> |
| 300 | |