blob: 9e5021df7509cf03edc29f9f5eb5e80fa639c18c [file] [log] [blame]
<?xml version="1.0"?>
<!--
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="downloads" default="main" basedir=".">
<property name="FALCON_HOME" location="."/>
<!-- properties -->
<!--<property file="${FALCON_HOME}/build.properties"/>-->
<property name="lib.dir" value="${FALCON_HOME}/lib"/>
<property name="download.dir" value="${FALCON_HOME}/in"/>
<!--
Notes:
For Apache, the JARS must be removed from the repository.
Licenses:
antlr (3) - BSD
commons-cli (1.2) - Apache 2.0
commons-io (2.0.1) - Apache 2.0
guava (15.0) - Apache 2.0
JBurg (1.10.1) - CPL 1.0
lzma-sdk (9.2) - Public Domain
-->
<property name="antlr.name" value="antlr"/>
<property name="commons-cli.name" value="commons-cli-1.2"/>
<property name="commons-io.name" value="commons-io-2.0.1"/>
<property name="guava.name" value="guava-15.0"/>
<property name="jflex.name" value="jflex-1.5.1"/>
<property name="jburg.name" value="jburg-1.10.1"/>
<property name="lzma.name" value="lzma-sdk-9.2"/>
<property name="antlr.src.url" value="http://antlr3.org/download"/>
<property name="antlr.src.file" value="antlr-3.3-complete.jar"/>
<property name="INFO_DOWNLOADING_FILE_FROM" value="Downloading {0} from: {1}" />
<!--
Because the downloads requires a network connection and the JARs don't change very often,
they are each downloaded only if they don't already exist.
-->
<target name="main" depends="prepare, antlr-jar, commons-jars, guava-jar, jflex-jar, jburg-jar, lzma-jar"
description="Downloads all the required thirdparty JARs"/>
<target name="prepare" >
<mkdir dir="${lib.dir}" />
</target>
<!--
Cleanup
-->
<target name="clean"
description="Removes thirdparty downloads.">
<delete includeEmptyDirs="true" failonerror="false">
<fileset dir="${download.dir}">
<include name="antlr*/**"/>
<include name="commons-cli*/**"/>
<include name="commons-io*/**"/>
<include name="guava*/**"/>
<include name="jflex*/**"/>
<include name="jburg*/**"/>
<include name="lzma*/**"/>
</fileset>
</delete>
</target>
<!--
Download thirdparty JARs
-->
<!--
Download a zip or gz file, extracts the jar file, and optionally copies the jar
file to a different location and optinally verifies the checksum.
If the checksum fails, this script fails.
Params are:
srcUrl
zipFile - a .gz file for untar with gzip, else unzip
[md5]
[srcJarPath] - both src and dest required for the copy
[destJarFile]
Note: This is purposely coded without <if><else><then> so that a dependency on
ant-contrib.jar isn't required.
-->
<target name="download-zip"
description="Downloads tar/zip, and optionally verifies checksum and copies extracted jar.">
<mkdir dir="${download.dir}"/>
<get src="${srcUrl}/${zipFile}" dest="${download.dir}/${zipFile}"/>
<condition property="zip.compressed">
<matches string="${zipFile}" pattern="^*.zip$"/>
</condition>
<antcall target="untar-file"/>
<antcall target="unzip-file"/>
<antcall target="check-sum">
<param name="message" value="Checksum mismatch for ${download.dir}/${zipFile}"/>
</antcall>
<condition property="destination.known">
<and>
<isset property="srcJarPath"/>
<isset property="destJarFile"/>
</and>
</condition>
<antcall target="copy-downloaded-jar"/>
</target>
<target name="download-bz2"
description="Downloads bz2, and optionally verifies checksum and copies extracted jar.">
<mkdir dir="${download.dir}"/>
<get src="${srcUrl}/${zipFile}" dest="${download.dir}/${zipFile}"/>
<untar src="${download.dir}/${zipFile}" dest="${download.dir}/temp" compression="bzip2"/>
<antcall target="check-sum">
<param name="message" value="Checksum mismatch for ${download.dir}/${zipFile}"/>
</antcall>
<condition property="destination.known">
<and>
<isset property="srcJarPath"/>
<isset property="destJarFile"/>
</and>
</condition>
<antcall target="copy-downloaded-jar"/>
</target>
<!--
Download a jar file and optionally verify the checksum.
If the checksum fails, this script fails.
Params are:
srcUrl
srcJarFile
destJarFile
[md5]
-->
<target name="download-jar"
description="Downloads jar, and optionally verifies checksum.">
<get src="${srcUrl}/${srcJarFile}" dest="${destJarFile}"/>
<checksum file="${destJarFile}" algorithm="MD5" property="${we.failed}"/>
<antcall target="fail-with-message">
<param name="message" value="Checksum mismatch for ${destJarFile}"/>
</antcall>
</target>
<target name="untar-file" unless="zip.compressed" description="Untars zipFile">
<untar src="${download.dir}/${zipFile}" dest="${download.dir}/temp" compression="gzip"/>
</target>
<target name="unzip-file" if="zip.compressed" description="Unzips zipFile">
<unzip src="${download.dir}/${zipFile}" dest="${download.dir}/temp"/>
</target>
<target name="check-sum" if="md5"
description="Verifies MD5 checksum, and fails if checksum doesn't match">
<checksum file="${download.dir}/${zipFile}" algorithm="MD5" property="${we.failed}"/>
<antcall target="fail-with-message">
<param name="message" value="${message}"/>
</antcall>
</target>
<target name="copy-downloaded-jar" if="destination.known">
<mkdir dir="${lib.dir}"/>
<copy file="${download.dir}/temp/${srcJarPath}" toFile="${destJarFile}" verbose="true"/>
</target>
<target name="fail-with-message" if="we.failed"
description="Conditionally fails with the specified message">
<fail message="${message}"/>
</target>
<!--
antlr
-->
<target name="antlr-jar-check" description="Checks if antlr jar exists.">
<condition property="antlr.jar.exists">
<and>
<available file="${lib.dir}/antlr.jar"/>
</and>
</condition>
</target>
<target name="antlr-jar" depends="antlr-jar-check" unless="antlr.jar.exists"
description="Copies the antlr jar to the lib directory.">
<echo file="${basedir}/antlr.properties">antlr.echo=${INFO_DOWNLOADING_FILE_FROM}</echo>
<replace file="${basedir}/antlr.properties" token="{0}" value="${antlr.src.file}" />
<replace file="${basedir}/antlr.properties" token="{1}" value="${antlr.src.url}" />
<property file="${basedir}/antlr.properties" />
<delete file="${basedir}/antlr.properties" />
<echo>${antlr.echo}</echo>
<antcall target="antlr-download-jar"/>
<echo file="${lib.dir}/antlr-LICENSE.TXT">http://www.antlr.org/license.html</echo>
</target>
<target name="antlr-download-jar" depends="antlr-jar-check" unless="antlr.jar.exists"
description="Downloads the antlr jars.">
<antcall target="download-jar">
<param name="srcUrl" value="${antlr.src.url}"/>
<param name="srcJarFile" value="${antlr.src.file}"/>
<param name="destJarFile" value="${lib.dir}/antlr.jar"/>
<param name="md5" value="238becce7da69f7be5c5b8a65558cf63"/>
</antcall>
</target>
<!--
commons
-->
<target name="commons-jars" depends="commons-cli-jar,commons-io-jar" />
<!--
commons-cli
-->
<target name="commons-cli-jar-check" description="Checks if common-cli.jar has been downloaded.">
<available file="${lib.dir}/commons-cli.jar" property="commons.cli.jar.exists"/>
</target>
<target name="commons-cli-jar" depends="commons-cli-jar-check" unless="commons.cli.jar.exists"
description="Downloads and copies common-cli.jar to the lib directory.">
<echo file="${basedir}/cli.properties">cli.echo=${INFO_DOWNLOADING_FILE_FROM}</echo>
<replace file="${basedir}/cli.properties" token="{0}" value="${commons-cli.name}-bin.tar.gz" />
<replace file="${basedir}/cli.properties" token="{1}" value="http://archive.apache.org/dist/commons/cli/binaries" />
<property file="${basedir}/cli.properties" />
<delete file="${basedir}/cli.properties" />
<echo>${cli.echo}</echo>
<antcall target="download-zip">
<param name="srcUrl" value="http://archive.apache.org/dist/commons/cli/binaries"/>
<param name="zipFile" value="${commons-cli.name}-bin.tar.gz"/>
<param name="md5" value="a05956c9ac8bacdc2b8d07fb2cb331ce"/>
<param name="srcJarPath" value="${commons-cli.name}/${commons-cli.name}.jar"/>
<param name="destJarFile" value="${lib.dir}/commons-cli.jar"/>
</antcall>
<copy todir="${lib.dir}">
<fileset dir="${download.dir}/temp/${commons-cli.name}">
<include name="LICENSE.txt"/>
</fileset>
<globmapper from="*" to="commons-cli-*"/>
</copy>
<delete dir="${download.dir}/temp/${commons-cli.name}"/>
</target>
<!--
commons-io
-->
<target name="commons-io-jar-check" description="Checks if commons-io.jar is in lib directory.">
<available file="${lib.dir}/commons-io.jar" property="commons.io.jar.exists"/>
</target>
<target name="commons-io-jar" depends="commons-io-jar-check"
unless="commons.io.jar.exists"
description="Copies commons-io.jar to the lib directory.">
<echo file="${basedir}/io.properties">io.echo=${INFO_DOWNLOADING_FILE_FROM}</echo>
<replace file="${basedir}/io.properties" token="{0}" value="${commons-io.name}-bin.tar.gz" />
<replace file="${basedir}/io.properties" token="{1}" value="http://archive.apache.org/dist/commons/io/binaries" />
<property file="${basedir}/io.properties" />
<delete file="${basedir}/io.properties" />
<echo>${io.echo}</echo>
<antcall target="download-zip">
<param name="srcUrl" value="http://archive.apache.org/dist/commons/io/binaries"/>
<param name="zipFile" value="${commons-io.name}-bin.tar.gz"/>
<param name="md5" value="4f2c26f9d80f89d15939619cc8524f78"/>
<param name="srcJarPath" value="${commons-io.name}/${commons-io.name}.jar"/>
<param name="destJarFile" value="${lib.dir}/commons-io.jar"/>
</antcall>
<copy todir="${lib.dir}">
<fileset dir="${download.dir}/temp/${commons-io.name}">
<include name="LICENSE.txt"/>
</fileset>
<globmapper from="*" to="commons-io-*"/>
</copy>
<delete dir="${download.dir}/temp/${commons-io.name}"/>
</target>
<!--
guava - collections and other common constructs
-->
<target name="guava-jar-check" description="Checks if guava.jar is in lib directory.">
<available file="${lib.dir}/guava.jar" property="guava.jar.exists"/>
</target>
<target name="guava-jar" depends="guava-jar-check"
unless="guava.jar.exists"
description="Downloads and copies guava.jar to the lib directory.">
<echo file="${basedir}/guava.properties">guava.echo=${INFO_DOWNLOADING_FILE_FROM}</echo>
<replace file="${basedir}/guava.properties" token="{0}" value="guava-15.0.jar" />
<replace file="${basedir}/guava.properties" token="{1}" value="http://search.maven.org/remotecontent?filepath=com/google/guava/guava/15.0" />
<property file="${basedir}/guava.properties" />
<delete file="${basedir}/guava.properties" />
<echo>${guava.echo}</echo>
<antcall target="download-jar">
<param name="srcUrl" value="http://search.maven.org/remotecontent?filepath=com/google/guava/guava/15.0"/>
<param name="srcJarFile" value="guava-15.0.jar"/>
<param name="destJarFile" value="${lib.dir}/guava.jar"/>
</antcall>
<get src="http://www.apache.org/licenses/LICENSE-2.0" dest="${lib.dir}/guava-LICENSE.txt"/>
</target>
<!--
jflex
-->
<target name="jflex-jar-check" description="Checks if jflex.jar has been downloaded.">
<available file="${lib.dir}/jflex.jar" property="jflex.jar.exists"/>
</target>
<target name="jflex-jar" depends="jflex-jar-check" unless="jflex.jar.exists"
description="Downloads and copies jflex.jar to the lib directory.">
<echo file="${basedir}/jflex.properties">jflex.echo=${INFO_DOWNLOADING_FILE_FROM}</echo>
<replace file="${basedir}/jflex.properties" token="{0}" value="${jflex.name}.tar.gz" />
<replace file="${basedir}/jflex.properties" token="{1}" value="http://jflex.de" />
<property file="${basedir}/jflex.properties" />
<delete file="${basedir}/jflex.properties" />
<echo>${cli.echo}</echo>
<antcall target="download-zip">
<param name="srcUrl" value="http://jflex.de"/>
<param name="zipFile" value="${jflex.name}.tar.gz"/>
<param name="md5" value="a05956c9ac8bacdc2b8d07fb2cb331ce"/>
<param name="srcJarPath" value="${jflex.name}/lib/${jflex.name}.jar"/>
<param name="destJarFile" value="${lib.dir}/JFlex.jar"/>
</antcall>
<copy todir="${lib.dir}">
<fileset dir="${download.dir}/temp/${jflex.name}">
<include name="LICENSE.txt"/>
</fileset>
<globmapper from="*" to="JFlex-*"/>
</copy>
<delete dir="${download.dir}/temp/${jflex.name}"/>
</target>
<!--
jburg - for codegen of certain java source files
-->
<target name="jburg-jar-check" description="Checks if jburg.jar is in lib directory.">
<available file="${lib.dir}/jburg.jar" property="jburg.jar.exists"/>
</target>
<target name="jburg-jar" depends="jburg-jar-check" unless="jburg.jar.exists"
description="Copies jburg.jar to the lib directory.">
<echo file="${basedir}/jburg.properties">jburg.echo=${INFO_DOWNLOADING_FILE_FROM}</echo>
<replace file="${basedir}/jburg.properties" token="{0}" value="${jburg.name}.tar.gz" />
<replace file="${basedir}/jburg.properties" token="{1}" value="http://downloads.sourceforge.net/project/jburg" />
<property file="${basedir}/jburg.properties" />
<delete file="${basedir}/jburg.properties" />
<echo>${jburg.echo}</echo>
<antcall target="download-zip">
<param name="srcUrl" value="http://downloads.sourceforge.net/project/jburg"/>
<param name="zipFile" value="${jburg.name}.tar.gz"/>
<param name="md5" value="76830ee877cac40b981779325b3fa89f"/>
<param name="srcJarPath" value="lib/jburg.jar"/>
<param name="destJarFile" value="${lib.dir}/jburg.jar"/>
</antcall>
<copy todir="${lib.dir}">
<fileset dir="${download.dir}/temp">
<include name="LICENSE"/>
</fileset>
<globmapper from="*" to="jburg-*"/>
</copy>
<delete includeemptydirs="true">
<fileset dir="${download.dir}/temp" includes="**/*"/>
</delete>
</target>
<!--
lzma - compression
-->
<target name="lzma-jar-check" description="Checks if lzma jar exists.">
<available file="${lib.dir}/lzma-sdk.jar" property="lzma.jar.exists" />
</target>
<target name="lzma-jar" depends="lzma-jar-check" unless="lzma.jar.exists"
description="Copies the lzma build jars.">
<echo file="${basedir}/lzma.properties">lzma.echo=${INFO_DOWNLOADING_FILE_FROM}</echo>
<replace file="${basedir}/lzma.properties" token="{0}" value="lzma-9.20.jar.zip" />
<replace file="${basedir}/lzma.properties" token="{1}" value="http://www.java2s.com/Code/JarDownload/lzma" />
<property file="${basedir}/lzma.properties" />
<delete file="${basedir}/lzma.properties" />
<echo>${lzma.echo}</echo>
<antcall target="download-zip">
<param name="srcUrl" value="http://www.java2s.com/Code/JarDownload/lzma"/>
<param name="zipFile" value="lzma-9.20.jar.zip"/>
<param name="md5" value="d5f7343bbd03bf1c4a4806b372cc5354"/>
<param name="srcJarPath" value="lzma-9.20.jar"/>
<param name="destJarFile" value="${lib.dir}/lzma-sdk.jar"/>
</antcall>
<echo file="${lib.dir}/lzma-sdk-LICENSE.TXT">http://www.7-zip.org/sdk.html</echo>
<delete includeemptydirs="true">
<fileset dir="${download.dir}/temp" includes="**/*"/>
</delete>
</target>
</project>