You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2016/04/22 19:25:03 UTC
[16/35] git commit: [flex-falcon]
[refs/heads/feature/maven-migration-test] - get Ant tests to work
get Ant tests to work
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/2e17ca46
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/2e17ca46
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/2e17ca46
Branch: refs/heads/feature/maven-migration-test
Commit: 2e17ca46a14724806f09dc6dd27f05a4047593da
Parents: 598ed9d
Author: Alex Harui <ah...@apache.org>
Authored: Thu Apr 21 08:20:29 2016 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Fri Apr 22 09:02:57 2016 -0700
----------------------------------------------------------------------
compiler/build.xml | 8 +-
compiler/src/test/as/Hello.as | 32 +++
compiler/src/test/build.xml | 373 +++++++++++++++++++++++++++++++++++
compiler/src/test/downloads.xml | 179 +++++++++++++++++
4 files changed, 590 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/2e17ca46/compiler/build.xml
----------------------------------------------------------------------
diff --git a/compiler/build.xml b/compiler/build.xml
index 9b8fa70..f42ea38 100644
--- a/compiler/build.xml
+++ b/compiler/build.xml
@@ -184,7 +184,7 @@
<attribute name="file"/>
<attribute name="annotation"/>
<sequential>
- <java classname="org.apache.flex.compiler.tools.annotate.AnnotateClass" output="@{file}" fork="false">
+ <java classname="org.apache.flex.compiler.tools.annotate.AnnotateClass" fork="false">
<classpath>
<path refid="classpath"/>
<pathelement location="${compiler}/../compiler-build-tools/target/classes"/>
@@ -492,7 +492,7 @@
<compilerarg value="-Xlint:all,-path,-fallthrough,-cast"/>
</javac>
<copy todir="${compiler}/target/classes">
- <fileset dir="${compiler}/src/main/java" includes="**/*.properties"/>
+ <fileset dir="${compiler}/src/main/resources" includes="**/*.properties"/>
</copy>
<!-- Copy the config file for the flex-tool-api. -->
<copy todir="${compiler}/target/classes/META-INF/services"
@@ -733,6 +733,10 @@
<echo>compiler main completed on ${build.datetime}</echo>
</target>
+ <target name="test" depends="sdk" description="Runs JUnit tests">
+ <ant dir="src/test" />
+ </target>
+
<!--
CLEANUP
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/2e17ca46/compiler/src/test/as/Hello.as
----------------------------------------------------------------------
diff --git a/compiler/src/test/as/Hello.as b/compiler/src/test/as/Hello.as
new file mode 100644
index 0000000..487dac4
--- /dev/null
+++ b/compiler/src/test/as/Hello.as
@@ -0,0 +1,32 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.
+//
+////////////////////////////////////////////////////////////////////////////////
+package
+{
+import flash.display.Sprite;
+
+public class Hello extends Sprite
+{
+ public function Hello()
+ {
+ super();
+ trace("Hello");
+ }
+}
+
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/2e17ca46/compiler/src/test/build.xml
----------------------------------------------------------------------
diff --git a/compiler/src/test/build.xml b/compiler/src/test/build.xml
new file mode 100644
index 0000000..e0481c3
--- /dev/null
+++ b/compiler/src/test/build.xml
@@ -0,0 +1,373 @@
+<?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="compiler.tests" default="main" basedir=".">
+
+ <pathconvert property="compiler.tests" dirsep="/">
+ <path location="${basedir}"/>
+ </pathconvert>
+
+
+ <property environment="env"/>
+ <property file="unittest.properties" />
+ <property name="test.timeout" value="3000000" />
+ <property name="maxmem" value="512" />
+
+ <condition property="sdk" value="${FLEX_HOME}" else="${env.FLEX_HOME}">
+ <isset property="FLEX_HOME" />
+ </condition>
+
+ <condition property="fpdbg" value="${FLASHPLAYER_DEBUGGER}" else="${env.FLASHPLAYER_DEBUGGER}">
+ <isset property="FLASHPLAYER_DEBUGGER" />
+ </condition>
+
+ <condition property="playerglobal.version" value="${env.PLAYERGLOBAL_VERSION}">
+ <isset property="env.PLAYERGLOBAL_VERSION" />
+ </condition>
+ <property name="playerglobal.version" value="11.1" />
+
+ <property name="compiler" value="${compiler.tests}/../.."/>
+ <property name="falcon" value="${compiler}"/>
+
+ <target name="download" description="Downloads third-party JARs">
+ <ant antfile="${compiler.tests}/downloads.xml" dir="${compiler.tests}"/>
+ <delete dir="${compiler.tests}/in"/>
+ </target>
+
+ <target name="eclipse">
+ <copy file="${fpdbg}" tofile="${compiler.tests}/temp/FlashPlayer.exe"/>
+ </target>
+
+ <target name="jar.tests">
+ <java jar="${falcon}/lib/falcon-mxmlc.jar" fork="true"/>
+ <java jar="${falcon}/lib/falcon-compc.jar" fork="true"/>
+ <java jar="${falcon}/lib/falcon-asc.jar" fork="true"/>
+ <java jar="${falcon}/lib/falcon-optimizer.jar" fork="true"/>
+ <java jar="${falcon}/lib/falcon-swfdump.jar" fork="true"/>
+ </target>
+
+ <target name="ant.tests">
+ <property name="FLEX_HOME" value="${sdk}"/>
+ <property name="FALCON_HOME" value="${falcon}"/>
+ <taskdef resource="flexTasks.tasks" classpath="${falcon}/lib/falcon-flexTasks.jar"/>
+ <mxmlc file="${compiler.tests}/as/Hello.as"
+ output="${compiler}/target/junit/Hello.swf"
+ target-player="${playerglobal.version}">
+ <arg value="+env.PLAYERGLOBAL_HOME=${env.PLAYERGLOBAL_HOME}" />
+ </mxmlc>
+ <delete file="${compiler}/target/junit/Hello.swf"/>
+ <compc output="${compiler}/target/junit/Hello.swc" include-classes="Hello" target-player="${playerglobal.version}">
+ <source-path path-element="${compiler.tests}/as"/>
+ <arg value="+env.PLAYERGLOBAL_HOME=${env.PLAYERGLOBAL_HOME}" />
+ </compc>
+ <delete file="${compiler}/target/junit/Hello.swc"/>
+ </target>
+
+ <!-- tests used to be divided up like this
+
+ <target name="compile.unit.tests">
+ <delete dir="${compiler}/target/test-classes"/>
+ <mkdir dir="${compiler}/target/test-classes"/>
+ <javac debug="${javac.debug}" deprecation="${javac.deprecation}" destdir="${compiler}/target/test-classes" includeAntRuntime="true">
+ <src path="${compiler.tests}/src/java"/>
+ <compilerarg value="-Xlint:all,-path"/>
+ <classpath>
+ <fileset dir="${compiler}/lib" includes="**/*.jar"/>
+ <pathelement location="${falcon}/lib/compiler.jar"/>
+ </classpath>
+ </javac>
+ </target>
+
+ <target name="unit.tests" depends="download, compile.unit.tests">
+ <mkdir dir="${compiler}/target/junit-reports"/>
+ <mkdir dir="${compiler}/target/junit-temp"/>
+ <junit dir="${compiler.tests}"
+ fork="yes" forkMode="perBatch" maxmemory="${maxmem}m" timeout="${test.timeout}"
+ printsummary="true" showoutput="true"
+ haltonerror="true" haltonfailure="true"
+ failureproperty="tests.unit.failed">
+ <classpath>
+ <pathelement location="${compiler}/target/test-classes"/>
+ <fileset dir="${compiler}/lib" includes="**/*.jar"/>
+ <pathelement location="${falcon}/lib/compiler.jar"/>
+ </classpath>
+ <batchtest todir="${compiler}/target/junit-reports">
+ <fileset dir="${compiler}/target/test-classes">
+ <include name="**/*Tests.class"/>
+ <exclude name="mxml/tags/**"/>
+ <exclude name="properties/**"/>
+ <exclude name="**/MXMLDesignLayerNodeTests.class"/>
+ <exclude name="**/MXMLHTTPServiceNodeTests.class"/>
+ <exclude name="**/MXMLModelNodeTests.class"/>
+ <exclude name="**/MXMLRemoteObjectNodeTests.class"/>
+ <exclude name="**/MXMLStateNodeTests.class"/>
+ <exclude name="**/MXMLWebServiceNodeTests.class"/>
+ </fileset>
+ </batchtest>
+ <formatter type="xml"/>
+ </junit>
+ </target>
+
+ <target name="unit.tests.sdk" depends="download, compile.unit.tests">
+ <mkdir dir="${compiler}/target/junit-reports"/>
+ <mkdir dir="${compiler}/target/junit-temp"/>
+ <junit dir="${compiler.tests}"
+ fork="yes" forkMode="perBatch" maxmemory="${maxmem}m" timeout="${test.timeout}"
+ printsummary="true" showoutput="true"
+ haltonerror="true" haltonfailure="true"
+ failureproperty="tests.unit.failed">
+ <classpath>
+ <pathelement location="${compiler}/target/test-classes"/>
+ <fileset dir="${compiler}/lib" includes="**/*.jar"/>
+ <pathelement location="${falcon}/lib/compiler.jar"/>
+ </classpath>
+ <batchtest todir="${compiler}/target/junit-reports">
+ <fileset dir="${compiler}/target/test-classes">
+ <include name="**/MXMLDesignLayerNodeTests.class"/>
+ <include name="**/MXMLHTTPServiceNodeTests.class"/>
+ <include name="**/MXMLModelNodeTests.class"/>
+ <include name="**/MXMLRemoteObjectNodeTests.class"/>
+ <include name="**/MXMLStateNodeTests.class"/>
+ <include name="**/MXMLWebServiceNodeTests.class"/>
+ </fileset>
+ </batchtest>
+ <formatter type="xml"/>
+ </junit>
+ </target>
+
+ <target name="compile.feature.tests">
+ <delete dir="${compiler}/target/test-classes"/>
+ <mkdir dir="${compiler}/target/test-classes"/>
+ <javac debug="${javac.debug}" deprecation="${javac.deprecation}" destdir="${compiler}/target/classes" includeAntRuntime="true">
+ <src path="${compiler.tests}/feature-tests"/>
+ <src path="${compiler.tests}/src"/>
+ <compilerarg value="-Xlint:all,-path"/>
+ <classpath>
+ <fileset dir="${compiler}/lib" includes="**/*.jar"/>
+ <fileset dir="${compiler.tests}/lib" includes="**/*.jar"/>
+ <pathelement location="${falcon}/lib/compiler.jar"/>
+ </classpath>
+ </javac>
+ </target>
+
+ <target name="feature.tests" depends="download, compile.feature.tests">
+ <mkdir dir="${compiler.tests}/results"/>
+ <mkdir dir="${compiler.tests}/temp"/>
+ <junit dir="${compiler.tests}"
+ fork="yes" forkMode="perBatch" maxmemory="${maxmem}m" timeout="${test.timeout}"
+ printsummary="true" showoutput="true"
+ haltonerror="true" haltonfailure="true"
+ failureproperty="tests.unit.failed">
+ <classpath>
+ <pathelement location="${compiler.tests}/classes"/>
+ <fileset dir="${compiler}/lib" includes="**/*.jar"/>
+ <fileset dir="${compiler.tests}/lib" includes="**/*.jar"/>
+ <pathelement location="${falcon}/lib/compiler.jar"/>
+ </classpath>
+ <batchtest todir="${compiler.tests}/results">
+ <fileset dir="${compiler.tests}/classes">
+ <include name="**/*Tests.class"/>
+ <exclude name="**/MXMLComponentTagTests.class"/>
+ <exclude name="**/MXMLHTTPServiceTagTests.class"/>
+ <exclude name="**/MXMLModelTagTests.class"/>
+ <exclude name="**/MXMLRemoteObjectTagTests.class"/>
+ <exclude name="**/MXMLWebServiceTagTests.class"/>
+ <exclude name="**/MXMLProperty*.class"/>
+ </fileset>
+ </batchtest>
+ <formatter type="xml"/>
+ </junit>
+ </target>
+
+ <target name="feature.tests.sdk" depends="download, compile.feature.tests">
+ <mkdir dir="${compiler.tests}/results"/>
+ <mkdir dir="${compiler.tests}/temp"/>
+ <junit dir="${compiler.tests}"
+ fork="yes" forkMode="perBatch" maxmemory="${maxmem}m" timeout="${test.timeout}"
+ printsummary="true" showoutput="true"
+ haltonerror="true" haltonfailure="true"
+ failureproperty="tests.unit.failed">
+ <classpath>
+ <pathelement location="${compiler.tests}/classes"/>
+ <fileset dir="${compiler}/lib" includes="**/*.jar"/>
+ <fileset dir="${compiler.tests}/lib" includes="**/*.jar"/>
+ <pathelement location="${falcon}/lib/compiler.jar"/>
+ </classpath>
+ <batchtest todir="${compiler.tests}/results">
+ <fileset dir="${compiler.tests}/classes">
+ <include name="**/MXMLComponentTagTests.class"/>
+ <include name="**/MXMLHTTPServiceTagTests.class"/>
+ <include name="**/MXMLModelTagTests.class"/>
+ <include name="**/MXMLRemoteObjectTagTests.class"/>
+ <include name="**/MXMLWebServiceTagTests.class"/>
+ <include name="**/MXMLProperty*.class"/>
+ <exclude name="**/MXMLPropertyTestsBase.class"/>
+ </fileset>
+ </batchtest>
+ <formatter type="xml"/>
+ </junit>
+ </target>
+
+ <target name="compile.functional.tests">
+ <delete dir="${compiler.tests}/classes" />
+ <mkdir dir="${compiler.tests}/classes"/>
+ <javac debug="${javac.debug}" deprecation="${javac.deprecation}" destdir="${compiler.tests}/classes" includeAntRuntime="true">
+ <src path="${compiler.tests}/src"/>
+ <src path="${compiler.tests}/functional-tests"/>
+ <compilerarg value="-Xlint:all,-path"/>
+ <classpath>
+ <fileset dir="${compiler}/lib" includes="**/*.jar"/>
+ <fileset dir="${compiler.tests}/lib" includes="**/*.jar"/>
+ <pathelement location="${falcon}/lib/compiler.jar"/>
+ </classpath>
+ </javac>
+ </target>
+
+ <target name="functional.tests" depends="download, compile.functional.tests">
+ <mkdir dir="${compiler.tests}/results"/>
+ <mkdir dir="${compiler.tests}/temp"/>
+ <junit dir="${compiler.tests}"
+ fork="yes" forkMode="perBatch" maxmemory="${maxmem}m" timeout="${test.timeout}"
+ printsummary="true" showoutput="true"
+ haltonerror="true" haltonfailure="true"
+ failureproperty="tests.functional.failed">
+ <classpath>
+ <pathelement location="${compiler.tests}/classes"/>
+ <fileset dir="${compiler}/lib" includes="**/*.jar"/>
+ <fileset dir="${compiler.tests}/lib" includes="**/*.jar"/>
+ <pathelement location="${falcon}/lib/compiler.jar"/>
+ </classpath>
+ <batchtest todir="${compiler.tests}/results">
+ <fileset dir="${compiler.tests}/classes">
+ <include name="**/*Tests.class"/>
+ </fileset>
+ </batchtest>
+ <formatter type="xml"/>
+ </junit>
+ </target>
+
+ end of old test organization -->
+
+ <target name="compile.tests">
+ <echo>compiler is ${compiler} falcon is ${falcon}</echo>
+ <delete dir="${compiler}/target/test-classes"/>
+ <mkdir dir="${compiler}/target/test-classes"/>
+ <javac debug="${javac.debug}" deprecation="${javac.deprecation}" destdir="${compiler}/target/test-classes" includeAntRuntime="true">
+ <src path="${compiler.tests}/java"/>
+ <compilerarg value="-Xlint:all,-path"/>
+ <classpath>
+ <fileset dir="${compiler}/lib/external" includes="**/*.jar"/>
+ <pathelement location="${compiler}/../compiler-build-tools/target/classes"/>
+ <pathelement location="${falcon}/lib/compiler.jar"/>
+ </classpath>
+ </javac>
+ </target>
+
+ <target name="tests" depends="download, compile.tests">
+ <mkdir dir="${compiler}/target/junit-reports"/>
+ <mkdir dir="${compiler}/target/junit-temp"/>
+ <junit dir="${compiler.tests}"
+ fork="yes" forkMode="perBatch" maxmemory="${maxmem}m" timeout="${test.timeout}"
+ printsummary="true" showoutput="true"
+ haltonerror="true" haltonfailure="true"
+ failureproperty="tests.unit.failed">
+ <classpath>
+ <pathelement location="${compiler}/target/test-classes"/>
+ <fileset dir="${compiler}/lib/external" includes="**/*.jar"/>
+ <pathelement location="${compiler}/../compiler-build-tools/target/classes"/>
+ <pathelement location="${falcon}/lib/compiler.jar"/>
+ </classpath>
+ <batchtest todir="${compiler}/target/junit-reports">
+ <fileset dir="${compiler}/target/test-classes">
+ <include name="**/*Tests.class"/>
+ <exclude name="mxml/tags/**"/>
+ <exclude name="properties/**"/>
+ <exclude name="**/MXMLDesignLayerNodeTests.class"/>
+ <exclude name="**/MXMLHTTPServiceNodeTests.class"/>
+ <exclude name="**/MXMLModelNodeTests.class"/>
+ <exclude name="**/MXMLRemoteObjectNodeTests.class"/>
+ <exclude name="**/MXMLStateNodeTests.class"/>
+ <exclude name="**/MXMLWebServiceNodeTests.class"/>
+ <exclude name="**/MXMLComponentTagTests.class"/>
+ <exclude name="**/MXMLHTTPServiceTagTests.class"/>
+ <exclude name="**/MXMLModelTagTests.class"/>
+ <exclude name="**/MXMLRemoteObjectTagTests.class"/>
+ <exclude name="**/MXMLWebServiceTagTests.class"/>
+ <exclude name="**/MXMLProperty*.class"/>
+ </fileset>
+ </batchtest>
+ <formatter type="xml"/>
+ </junit>
+ </target>
+
+ <target name="tests.sdk" depends="download, compile.tests">
+ <mkdir dir="${compiler}/target/junit-reports"/>
+ <mkdir dir="${compiler}/target/junit-temp"/>
+ <junit dir="${compiler.tests}"
+ fork="yes" forkMode="perBatch" maxmemory="${maxmem}m" timeout="${test.timeout}"
+ printsummary="true" showoutput="true"
+ haltonerror="true" haltonfailure="true"
+ failureproperty="tests.unit.failed">
+ <classpath>
+ <pathelement location="${compiler}/target/test-classes"/>
+ <fileset dir="${compiler}/lib" includes="**/*.jar"/>
+ <fileset dir="${compiler}/../compiler-build-tools/target/classes" includes="**/*.class"/>
+ <pathelement location="${falcon}/lib/compiler.jar"/>
+ </classpath>
+ <batchtest todir="${compiler}/target/junit-reports">
+ <fileset dir="${compiler}/target/test-classes">
+ <include name="**/MXMLComponentTagTests.class"/>
+ <include name="**/MXMLHTTPServiceTagTests.class"/>
+ <include name="**/MXMLModelTagTests.class"/>
+ <include name="**/MXMLRemoteObjectTagTests.class"/>
+ <include name="**/MXMLWebServiceTagTests.class"/>
+ <include name="**/MXMLProperty*.class"/>
+ <exclude name="**/MXMLPropertyTestsBase.class"/>
+ <include name="**/MXMLDesignLayerNodeTests.class"/>
+ <include name="**/MXMLHTTPServiceNodeTests.class"/>
+ <include name="**/MXMLModelNodeTests.class"/>
+ <include name="**/MXMLRemoteObjectNodeTests.class"/>
+ <include name="**/MXMLStateNodeTests.class"/>
+ <include name="**/MXMLWebServiceNodeTests.class"/>
+ </fileset>
+ </batchtest>
+ <formatter type="xml"/>
+ </junit>
+ </target>
+
+ <!--<target name="main" depends="unit.tests, feature.tests, jar.tests"/>-->
+ <!--<target name="sdk.dependent.tests" depends="unit.tests.sdk, feature.tests.sdk, functional.tests, ant.tests" />-->
+ <target name="main" depends="jar.tests, tests"/>
+ <target name="sdk.dependent.tests" depends="tests.sdk, ant.tests" />
+ <target name="all" depends="main, sdk.dependent.tests"/>
+
+ <target name="clean">
+ <delete dir="${compiler}/target/junit-reports"/>
+ <delete dir="${compiler}/target/junit-temp"/>
+ </target>
+
+ <target name="wipe" depends="clean">
+ <delete file="${compiler}/lib/external/commons-lang3-3.4.jar"/>
+ <delete file="${compiler}/lib/external/commons-compress-1.10.jar"/>
+ <delete file="${compiler}/lib/external/junit-4.10.jar"/>
+ </target>
+
+</project>
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/2e17ca46/compiler/src/test/downloads.xml
----------------------------------------------------------------------
diff --git a/compiler/src/test/downloads.xml b/compiler/src/test/downloads.xml
new file mode 100644
index 0000000..b112916
--- /dev/null
+++ b/compiler/src/test/downloads.xml
@@ -0,0 +1,179 @@
+<?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>
+ <pathconvert property="compiler" dirsep="/">
+ <path location="${basedir}/../.."/>
+ </pathconvert>
+
+ <property name="external.lib.dir" value="${compiler}/lib/external"/>
+
+ <property name="download.dir" value="${compiler}/in"/>
+
+ <!--
+ Notes:
+ For Apache, the JARS must be removed from the repository.
+
+ Licenses:
+ JUnit (4.10) - CPL 1.0
+ Commons Compress - Apache 2.0
+ Commons Lang3 - Apache 2.0
+ -->
+
+ <!--
+ 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, junit-jar, commons-compress-jar, commons-lang3-jar"
+ description="Downloads all the required thirdparty JARs"/>
+
+ <target name="prepare" >
+ <mkdir dir="${external.lib.dir}" />
+ </target>
+
+ <!--
+ Cleanup
+ -->
+
+ <target name="clean"
+ description="Removes thirdparty downloads.">
+ <delete includeEmptyDirs="true" failonerror="false">
+ <fileset dir="${download.dir}">
+ <include name="junit*/**"/>
+ <include name="commons-compress*/**"/>
+ </fileset>
+ </delete>
+ </target>
+
+ <!--
+ Download thirdparty JARs
+ -->
+
+ <!--
+ 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="fail-with-message" if="we.failed"
+ description="Conditionally fails with the specified message">
+ <fail message="${message}"/>
+ </target>
+
+ <!--
+ junit
+ -->
+
+ <target name="junit-jar-check" description="Checks if JUnit JAR exists.">
+ <condition property="junit.jar.exists">
+ <and>
+ <available file="${external.lib.dir}/junit-4.10.jar"/>
+ </and>
+ </condition>
+ </target>
+
+ <target name="junit-jar" depends="junit-jar-check" unless="junit.jar.exists"
+ description="Copies the JUnit JAR to the lib directory.">
+ <echo message="Obtaining lib/external/junit-4.10.jar"/>
+ <antcall target="junit-download-jar"/>
+ </target>
+
+ <target name="junit-download-jar" depends="junit-jar-check" unless="junit.jar.exists"
+ description="Downloads the JUnit jar.">
+ <antcall target="download-jar">
+ <param name="srcUrl" value="http://search.maven.org/remotecontent?filepath=junit/junit/4.10"/>
+ <param name="srcJarFile" value="junit-4.10.jar"/>
+ <param name="destJarFile" value="${external.lib.dir}/junit-4.10.jar"/>
+ </antcall>
+ </target>
+
+ <!--
+ commons-compress
+ -->
+
+ <target name="commons-compress-jar-check" description="Checks if commons-compress JAR exists.">
+ <condition property="commons-compress.jar.exists">
+ <and>
+ <available file="${external.lib.dir}/commons-compress-1.10.jar"/>
+ </and>
+ </condition>
+ </target>
+
+ <target name="commons-compress-jar" depends="commons-compress-jar-check" unless="commons-compress.jar.exists"
+ description="Copies the commons-compress JAR to the lib directory.">
+ <echo message="Obtaining lib/external/commons-compress-1.10.jar"/>
+ <antcall target="commons-compress-download-jar"/>
+ </target>
+
+ <target name="commons-compress-download-jar" depends="commons-compress-jar-check" unless="commons-compress.jar.exists"
+ description="Downloads the commons-compress jar.">
+ <antcall target="download-jar">
+ <param name="srcUrl" value="https://repo1.maven.org/maven2/org/apache/commons/commons-compress/1.10"/>
+ <param name="srcJarFile" value="commons-compress-1.10.jar"/>
+ <param name="destJarFile" value="${external.lib.dir}/commons-compress-1.10.jar"/>
+ </antcall>
+ </target>
+
+ <!--
+ commons-lang3
+ -->
+
+ <target name="commons-lang3-jar-check" description="Checks if commons-lang3 JAR exists.">
+ <condition property="commons-lang3.jar.exists">
+ <and>
+ <available file="${external.lib.dir}/commons-lang3-3.4.jar"/>
+ </and>
+ </condition>
+ </target>
+
+ <target name="commons-lang3-jar" depends="commons-lang3-jar-check" unless="commons-lang3.jar.exists"
+ description="Copies the commons-lang3 JAR to the lib directory.">
+ <echo message="Obtaining lib/external/commons-lang3-3.4.jar"/>
+ <antcall target="commons-lang3-download-jar"/>
+ </target>
+
+ <target name="commons-lang3-download-jar" depends="commons-lang3-jar-check" unless="commons-lang3.jar.exists"
+ description="Downloads the commons-lang3 jar.">
+ <antcall target="download-jar">
+ <param name="srcUrl" value="https://repo1.maven.org/maven2/org/apache/commons/commons-lang3/3.4"/>
+ <param name="srcJarFile" value="commons-lang3-3.4.jar"/>
+ <param name="destJarFile" value="${external.lib.dir}/commons-lang3-3.4.jar"/>
+ </antcall>
+ </target>
+
+</project>