Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
removed CoverageAgent.swc from FlexUnit4FlexCoverListener and added d…
…ownload.xml to automatically download those dependencies.
- Loading branch information
Showing
3 changed files
with
277 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,177 @@ | ||
<?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: | ||
CoverageAgent (0.90) - TODO license??? | ||
--> | ||
|
||
<!-- | ||
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, coverageagent-swc" 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}"> | ||
<include name="flexcover*/**" /> | ||
</fileset> | ||
</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}" /> | ||
|
||
<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-swc" /> | ||
</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> | ||
|
||
|
||
<!-- | ||
CoverageAgent | ||
--> | ||
|
||
<target name="coverageagent-swc" depends="coverageagent-swc-check" unless="coverageagent.swc.exists" | ||
description="Downloads and copies coverageagent to the lib directory."> | ||
<echo message="Obtaining lib/CoverageAgent.swc" /> | ||
<antcall target="download-zip"> | ||
<param name="srcUrl" value="https://flexcover.googlecode.com/files" /> | ||
<param name="zipFile" value="flexcover-0.90.zip" /> | ||
<param name="srcJarPath" value="flexcover-0.90/CoverageAgent/bin/CoverageAgent.swc" /> | ||
<param name="md5" value="b73fe1bb5f443993adcf8b274f6a48b2" /> | ||
<param name="destJarFile" value="${lib.dir}/CoverageAgent.swc" /> | ||
</antcall> | ||
<delete dir="${download.dir}/temp/flexcover-0.90" /> | ||
</target> | ||
|
||
<target name="coverageagent-swc-check" description="Checks if coverageagent swc exists."> | ||
<condition property="coverageagent.swc.exists"> | ||
<and> | ||
<available file="${lib.dir}/CoverageAgent.swc" /> | ||
</and> | ||
</condition> | ||
</target> | ||
|
||
</project> |
Binary file not shown.