FlexUnit4Test/downloads.xml (213 lines of code) (raw):

<?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="."> <pathconvert property="compiler.tests" dirsep="/"> <path location="${basedir}"/> </pathconvert> <property name="lib.dir" value="${compiler.tests}/libs"/> <property name="download.dir" value="${compiler.tests}/in"/> <!-- Notes: For Apache, the SWCs must be removed from the repository. Licenses: fluint (1.2) - MIT flexunit1lib () - BSD hamcrest (1.1.3) - BSD mockolate (0.9.5) - MIT mock-as - BSD saxon9he - MPL 1.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, flexunit1lib-swc, hamcrest-swc, fluint-swc, mockolate-swc, mock-as-swc, saxon9he-jar" description="Downloads all the required thirdparty SWCs"/> <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}"/> <fileset dir="${lib.dir}"/> </delete> </target> <!-- Download thirdparty SWCs --> <!-- Download a swc file and optionally verify the checksum. If the checksum fails, this script fails. Params are: srcUrl srcSwcFile destSwcFile [md5] --> <target name="download-swc" description="Downloads swc, and optionally verifies checksum."> <get src="${srcUrl}/${srcSwcFile}" dest="${destSwcFile}"/> <checksum file="${destSwcFile}" algorithm="MD5" property="${we.failed}"/> <antcall target="fail-with-message"> <param name="message" value="Checksum mismatch for ${destSwcFile}"/> </antcall> </target> <!-- Download a zip or gz file, extracts the jar/swc file, and optionally copies the jar/swc 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 swc."> <mkdir dir="${download.dir}"/> <antcall target="copy-before-get" /> <get src="${srcUrl}/${zipFile}" dest="${download.dir}/${zipFile}" skipexisting="true"/> <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-swc"/> </target> <target name="copy-before-get" depends="copy-exists" if="have-copy"> <copy file="${basedir}/../FlexUnit4/in/hamcrest-as3-flex-1.1.3.zip" tofile="${basedir}/in/hamcrest-as3-flex-1.1.3.zip" /> </target> <target name="copy-exists" > <condition property="have-copy"> <available file="${basedir}/../FlexUnit4/in/hamcrest-as3-flex-1.1.3.zip" /> </condition> </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-swc" 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> <!-- flexunit1lib --> <target name="flexunit1lib-swc-check" description="Checks if flexunit1lib swc exists."> <condition property="flexunit1lib.swc.exists"> <and> <available file="${lib.dir}/FlexUnit1Lib.swc"/> </and> </condition> </target> <target name="flexunit1lib-swc" depends="flexunit1lib-swc-check" unless="flexunit1lib.swc.exists" description="Copies the flexunit1lib swc to the lib directory."> <echo message="Obtaining libs/FlexUnit1Lib.swc"/> <antcall target="flexunit1lib-download-swc"/> </target> <target name="flexunit1lib-download-swc" depends="flexunit1lib-swc-check" unless="flexunit1lib.swc.exists" description="Downloads the flexunit1lib swc."> <antcall target="download-swc"> <param name="srcUrl" value="https://github.com/flexunit/flexunit/raw/master/FlexUnit4Test/libs"/> <param name="srcSwcFile" value="FlexUnit1Lib.swc"/> <param name="destSwcFile" value="${lib.dir}/FlexUnit1Lib.swc"/> </antcall> <!-- Get license file --> <!--get src="" dest="${lib.dir}/flexunit1lib-LICENSE"/--> </target> <!-- hamcrest-as3 --> <target name="hamcrest-swc" depends="hamcrest-swc-check" unless="hamcrest.swc.exists" description="Downloads and copies hamcrest to the lib directory."> <echo message="Obtaining lib/hamcrest-as3-flex-1.1.3.swc"/> <antcall target="download-zip"> <param name="srcUrl" value="https://github.com/downloads/drewbourne/hamcrest-as3"/> <param name="zipFile" value="hamcrest-as3-flex-1.1.3.zip"/> <param name="srcJarPath" value="hamcrest-as3-flex-1.1.3/hamcrest-as3-flex-1.1.3.swc"/> <param name="md5" value="b73fe1bb5f443993adcf8b274f6a48b2"/> <param name="destJarFile" value="${lib.dir}/hamcrest-as3-flex-1.1.3.swc"/> </antcall> <delete dir="${download.dir}/temp/hamcrest-as3-flex-1.1.3"/> <!-- Get license file --> <get src="https://raw.github.com/drewbourne/hamcrest-as3/master/hamcrest/LICENSE" dest="${lib.dir}/hamcrest-LICENSE"/> </target> <target name="hamcrest-swc-check" description="Checks if hamcrest swc exists."> <condition property="hamcrest.swc.exists"> <and> <available file="${lib.dir}/hamcrest-as3-flex-1.1.3.swc"/> </and> </condition> </target> <!-- fluint --> <target name="fluint-swc-check" description="Checks if fluint swc exists."> <condition property="fluint.swc.exists"> <and> <available file="${lib.dir}/fluint-1_2.swc"/> </and> </condition> </target> <target name="fluint-swc" depends="fluint-swc-check" unless="fluint.swc.exists" description="Copies the fluint swc to the lib directory."> <echo message="Obtaining libs/fluint-1_2.swc"/> <antcall target="fluint-download-swc"/> </target> <target name="fluint-download-swc" depends="fluint-swc-check" unless="fluint.swc.exists" description="Downloads the fluint swc."> <antcall target="download-swc"> <param name="srcUrl" value="https://github.com/flexunit/flexunit/raw/master/FlexUnit4Test/libs"/> <param name="srcSwcFile" value="fluint-1_2.swc"/> <param name="destSwcFile" value="${lib.dir}/fluint-1_2.swc"/> </antcall> <!-- Get license file --> <!--get src="" dest="${lib.dir}/fluint-LICENSE"/--> </target> <!-- mockolate --> <target name="mockolate-swc-check" description="Checks if mockolate swc exists."> <condition property="mockolate.swc.exists"> <and> <available file="${lib.dir}/mockolate-0.9.5.swc"/> </and> </condition> </target> <target name="mockolate-swc" depends="mockolate-swc-check" unless="mockolate.swc.exists" description="Downloads and copies mockolate to the lib directory."> <echo message="Obtaining lib/mockolate-0.9.5.swc"/> <antcall target="download-zip"> <param name="srcUrl" value="https://github.com/downloads/drewbourne/mockolate"/> <param name="zipFile" value="mockolate-0.9.5.zip"/> <param name="srcJarPath" value="mockolate-0.9.5/mockolate-0.9.5.swc"/> <param name="md5" value="b73fe1bb5f443993adcf8b274f6a48b2"/> <param name="destJarFile" value="${lib.dir}/mockolate-0.9.5.swc"/> </antcall> <delete dir="${download.dir}/temp/mockolate-0.9.5"/> <!-- Get license file --> <get src="https://raw.github.com/drewbourne/mockolate/master/LICENSE" dest="${lib.dir}/mockolate-LICENSE"/> </target> <!-- mock-as --> <target name="mock-as-swc-check" description="Checks if mock-as swc exists."> <condition property="mock-as.swc.exists"> <and> <available file="${lib.dir}/mock-as3.swc"/> </and> </condition> </target> <target name="mock-as-swc" depends="mock-as-swc-check" unless="mock-as.swc.exists" description="Downloads and copies mock-as to the lib directory."> <echo message="Obtaining lib/mock-as3.swc"/> <antcall target="download-swc"> <param name="srcUrl" value="https://github.com/flexunit/flexunit/raw/master/FlexUnit4Test/libs"/> <param name="srcSwcFile" value="mock-as3.swc"/> <param name="destSwcFile" value="${lib.dir}/mock-as3.swc"/> </antcall> <!-- Get license file --> <get src="https://raw.github.com/drewbourne/mock-as3/master/core/license.txt" dest="${lib.dir}/mock-as3-LICENSE"/> </target> <!-- saxon9he --> <!-- MPL 1.1 Licesense Notification See http://www.apache.org/legal/3party.html#labeling-reciprocity Section "Category B: Reciprocal Licenses" --> <target name="echo-mpl1.1-license" unless="build.noprompt"> <input message="Mozilla Public License Version 1.1: ${line.separator} ${line.separator}The contents of the file(s) are subject to the Mozilla Public License Version 1.1. ${line.separator}You may not use the file(s) except in compliance with the License. ${line.separator}You may obtain a copy of the License here: ${line.separator} http://www.mozilla.org/MPL/. ${line.separator}By downloading, modifying, distributing, using and/or accessing the file(s), ${line.separator}you agree to the terms and conditions of the applicable license agreement. ${line.separator} ${line.separator}I have read the MPL1.1 license information above?" validargs="y" defaultvalue="y"/> </target> <target name="saxon9he-jar-check" description="Checks if saxon9he jar exists."> <condition property="saxon9he.jar.exists"> <and> <available file="${lib.dir}/build/saxon9he.jar"/> </and> </condition> </target> <target name="saxon9he-jar" depends="saxon9he-jar-check" unless="saxon9he.jar.exists" description="Downloads and copies saxon9he.jar to the lib/build directory."> <echo message="Obtaining lib/build/saxon9he.jar"/> <mkdir dir="${lib.dir}/build" /> <antcall target="echo-mpl1.1-license"/> <antcall target="download-swc"> <param name="srcUrl" value="http://search.maven.org/remotecontent?filepath=net/sf/saxon/Saxon-HE/9.4"/> <param name="srcSwcFile" value="Saxon-HE-9.4.jar"/> <param name="destSwcFile" value="${lib.dir}/build/saxon9he.jar"/> </antcall> </target> </project>