Skip to content
Permalink
Browse files
removed CoverageAgent.swc from FlexUnit4FlexCoverListener and added d…
…ownload.xml to automatically download those dependencies.
  • Loading branch information
cyrillzadra committed May 23, 2013
1 parent 0f9cd88 commit dab610e7c304acb691695bd6ca226646c1df4cc3
Showing 3 changed files with 277 additions and 96 deletions.
@@ -16,117 +16,121 @@
limitations under the License.
-->
<project name="FlexUnit4FlexCoverListener" basedir="." default="package">
<import file="${basedir}/../utils.xml" />
<property environment="env" />
<import file="${basedir}/../utils.xml" />
<property environment="env" />

<!-- Configuration -->
<property name="build.artifactId" value="flexunit-flexcoverlistener" />
<property name="build.finalName" value="${build.artifactId}-${build.version}-${build.number}-${build.sdk}" />
<property name="build.packaging" value="swc" />
<property name="build.deploy.name" value="FlexUnit FlexCover Listener" />
<property name="build.deploy.description" value="Continuous integration listener to be used with the FlexUnit Ant Tasks and the FlexCover application." />
<!-- Configuration -->
<property name="build.artifactId" value="flexunit-flexcoverlistener" />
<property name="build.finalName" value="${build.artifactId}-${build.version}-${build.number}-${build.sdk}" />
<property name="build.packaging" value="swc" />
<property name="build.deploy.name" value="FlexUnit FlexCover Listener" />
<property name="build.deploy.description" value="Continuous integration listener to be used with the FlexUnit Ant Tasks and the FlexCover application." />

<!-- Existing -->
<property name="src.loc" location="${basedir}/src" />
<property name="lib.loc" location="${basedir}/libs" />
<!-- Existing -->
<property name="src.loc" location="${basedir}/src" />
<property name="lib.loc" location="${basedir}/libs" />

<!-- Generated -->
<property name="dist.loc" location="${basedir}/target" />
<property name="sonatype.loc" location="${dist.loc}/sonatype" />
<property name="bin.loc" location="${basedir}/target/bin" />
<property name="doc.loc" location="${basedir}/target/docs" />
<!-- Generated -->
<property name="dist.loc" location="${basedir}/target" />
<property name="sonatype.loc" location="${dist.loc}/sonatype" />
<property name="bin.loc" location="${basedir}/target/bin" />
<property name="doc.loc" location="${basedir}/target/docs" />

<!-- Setup Flex Ant Resources -->
<property name="FLEX_HOME" location="${env.FLEX_HOME}" />
<taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar" />
<!-- Setup Flex Ant Resources -->
<property name="FLEX_HOME" location="${env.FLEX_HOME}" />
<taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar" />

<target name="clean">
<delete dir="${dist.loc}" failonerror="false" />
<delete failonerror="false">
<fileset dir="${lib.loc}">
<exclude name="CoverageAgent.swc" />
</fileset>
</delete>
</target>
<target name="clean">
<delete dir="${dist.loc}" failonerror="false" />
<delete failonerror="false">
<fileset dir="${lib.loc}" />
</delete>
<ant antfile="${basedir}/downloads.xml" target="clean" dir="${basedir}" />
</target>

<target name="init">
<mkdir dir="${dist.loc}" />
<mkdir dir="${sonatype.loc}" />
<mkdir dir="${bin.loc}" />
<mkdir dir="${doc.loc}" />
<target name="init">
<mkdir dir="${dist.loc}" />
<mkdir dir="${sonatype.loc}" />
<mkdir dir="${bin.loc}" />
<mkdir dir="${doc.loc}" />

<!-- Copy required dependencies -->
<copy todir="${lib.loc}" overwrite="true" failonerror="false">
<fileset dir="${basedir}/../FlexUnit4/target">
<include name="flexunit*as3*.swc" />
</fileset>
<fileset dir="${basedir}/../FlexUnit4CIListener/target">
<include name="*.swc" />
</fileset>
</copy>
</target>
<!-- Copy required dependencies -->
<copy todir="${lib.loc}" overwrite="true" failonerror="false">
<fileset dir="${basedir}/../FlexUnit4/target">
<include name="flexunit*as3*.swc" />
</fileset>
<fileset dir="${basedir}/../FlexUnit4CIListener/target">
<include name="*.swc" />
</fileset>
</copy>
</target>

<target name="compile" depends="init">
<compc output="${bin.loc}/${build.finalName}.${build.packaging}">
<include-sources dir="${src.loc}" includes="*" append="true" />
<source-path path-element="${src.loc}" />
<library-path dir="${lib.loc}" append="true">
<include name="CoverageAgent.swc" />
</library-path>
<compiler.external-library-path dir="${lib.loc}" append="true">
<include name="*.swc" />
<exclude name="CoverageAgent.swc" />
</compiler.external-library-path>
<compiler.external-library-path dir="${FLEX_HOME}/frameworks/libs" append="true">
<include name="flex.swc" />
<include name="framework.swc" />
<include name="rpc.swc" />
<include name="utilities.swc" />
</compiler.external-library-path>
<compiler.verbose-stacktraces>true</compiler.verbose-stacktraces>
<compiler.headless-server>true</compiler.headless-server>
</compc>
</target>
<target name="prebuild">
<ant antfile="${basedir}/downloads.xml" dir="${basedir}" />
</target>

<target name="report" depends="compile" if="build.report">
<java jar="${FLEX_HOME}/lib/asdoc.jar" fork="true" failonerror="true">
<jvmarg value="-Xmx256M" />
<arg line="+flexlib '${FLEX_HOME}/frameworks'" />
<arg line="-doc-sources '${src.loc}'" />
<arg line="-source-path+='${src.loc}'" />
<arg line="-output '${doc.loc}'" />
<arg line="-library-path+='${lib.loc}'" />
</java>
</target>
<target name="compile" depends="init, prebuild">
<compc output="${bin.loc}/${build.finalName}.${build.packaging}">
<include-sources dir="${src.loc}" includes="*" append="true" />
<source-path path-element="${src.loc}" />
<library-path dir="${lib.loc}" append="true">
<include name="CoverageAgent.swc" />
</library-path>
<compiler.external-library-path dir="${lib.loc}" append="true">
<include name="*.swc" />
<exclude name="CoverageAgent.swc" />
</compiler.external-library-path>
<compiler.external-library-path dir="${FLEX_HOME}/frameworks/libs" append="true">
<include name="flex.swc" />
<include name="framework.swc" />
<include name="rpc.swc" />
<include name="utilities.swc" />
</compiler.external-library-path>
<compiler.verbose-stacktraces>true</compiler.verbose-stacktraces>
<compiler.headless-server>true</compiler.headless-server>
</compc>
</target>

<target name="package" depends="report">
<copy file="${bin.loc}/${build.finalName}.${build.packaging}" todir="${dist.loc}" />
</target>

<target name="deploy" depends="package" description="Requires Ant-Contrib and GPG to work.">
<!-- Copy artifacts w/o build number for use with sonatype -->
<copy todir="${sonatype.loc}">
<fileset dir="${dist.loc}">
<include name="*.swc" />
</fileset>
<filtermapper>
<replacestring from="-${build.number}-" to="-" />
</filtermapper>
</copy>

<!-- prepare sonatype bundle -->
<sonatype-bundle dir="${sonatype.loc}"
<target name="report" depends="compile" if="build.report">
<java jar="${FLEX_HOME}/lib/asdoc.jar" fork="true" failonerror="true">
<jvmarg value="-Xmx256M" />
<arg line="+flexlib '${FLEX_HOME}/frameworks'" />
<arg line="-doc-sources '${src.loc}'" />
<arg line="-source-path+='${src.loc}'" />
<arg line="-output '${doc.loc}'" />
<arg line="-library-path+='${lib.loc}'" />
</java>
</target>

<target name="package" depends="report">
<copy file="${bin.loc}/${build.finalName}.${build.packaging}" todir="${dist.loc}" />
</target>

<target name="deploy" depends="package" description="Requires Ant-Contrib and GPG to work.">
<!-- Copy artifacts w/o build number for use with sonatype -->
<copy todir="${sonatype.loc}">
<fileset dir="${dist.loc}">
<include name="*.swc" />
</fileset>
<filtermapper>
<replacestring from="-${build.number}-" to="-" />
</filtermapper>
</copy>

<!-- prepare sonatype bundle -->
<sonatype-bundle dir="${sonatype.loc}"
todir="${sonatype.loc}"
pomTemplate="${basedir}/../pom.template"
artifact="${build.artifactId}"
type="${build.packaging}"
name="${build.deploy.name}"
version="${build.version}"
description="${build.deploy.description}">
<includes>
<include name="*.swc" />
<include name="pom.xml" />
</includes>
</sonatype-bundle>
</target>
<includes>
<include name="*.swc" />
<include name="pom.xml" />
</includes>
</sonatype-bundle>
</target>
</project>
@@ -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.

0 comments on commit dab610e

Please sign in to comment.