| <?xml version="1.0" encoding="utf-8" ?> |
| <!-- |
| * Licensed to the Apache Software Foundation (ASF) under one * |
| * or more contributor license agreements. See the NOTICE file * |
| * distributed with this work for additional information * |
| * regarding copyright ownership. The ASF licenses this file * |
| * to you under the Apache License, Version 2.0 (the * |
| * "License"); you may not use this file except in compliance * |
| * with the License. You may obtain a copy of the License at * |
| * * |
| * http://www.apache.org/licenses/LICENSE-2.0 * |
| * * |
| * Unless required by applicable law or agreed to in writing, * |
| * software distributed under the License is distributed on an * |
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * |
| * KIND, either express or implied. See the License for the * |
| * specific language governing permissions and limitations * |
| * under the License. * |
| --> |
| <project name="download_depends" default="download" basedir="."> |
| |
| |
| <!-- check parameters --> |
| <condition property="params.available"> |
| <and> |
| <isset property="download-url"/> |
| <isset property="download-dirname"/> |
| <isset property="download-filename"/> |
| <isset property="dest-dirname"/> |
| </and> |
| </condition> |
| |
| <!-- check externals folder --> |
| <condition property="externals.available"> |
| <available file="${unzip-dest}"/> |
| </condition> |
| |
| <!-- check for os family --> |
| <condition property="do-download-windows"> |
| <and> |
| <not><isset property="externals.available"/></not> |
| <os family="windows"/> |
| </and> |
| </condition> |
| <condition property="do-download-linux"> |
| <and> |
| <not><isset property="externals.available"/></not> |
| <os family="unix"/> |
| </and> |
| </condition> |
| |
| <target name="check-params" unless="params.available"> |
| <fail message="missing parameters."/> |
| </target> |
| |
| <target name="info" if="externals.available"> |
| <echo message="${unzip-dest} already available, doing nothing"/> |
| </target> |
| |
| <target name="download" depends="check-params, info, download-windows, download-linux"> |
| </target> |
| |
| <target name="download-windows" if="do-download-windows"> |
| <echo message="downloading externals for windows"/> |
| <mkdir dir="${download-dirname}" /> |
| <get src="${download-url}" dest="${download-dirname}${file.separator}${download-filename}"/> |
| <unzip src="${download-dirname}${file.separator}${download-filename}" dest="${dest-dirname}"/> |
| </target> |
| <target name="download-linux" if="do-download-linux"> |
| <echo message="downloading externals for linux"/> |
| <mkdir dir="${download-dirname}" /> |
| <get src="${download-url}" dest="${download-dirname}${file.separator}${download-filename}"/> |
| <mkdir dir="${dest-dirname}"/> |
| <exec executable="pwd"></exec> |
| <exec executable="tar" output="info.txt"> |
| <arg value="-xvpzf" /> |
| <arg value="${download-dirname}${file.separator}${download-filename}" /> |
| <arg value="-C" /> |
| <arg value="${dest-dirname}" /> |
| </exec> |
| </target> |
| |
| <target name="clean" depends="check-params"> |
| <delete dir="${dest-dirname}" failonerror="true"/> |
| </target> |
| |
| </project> |