blob: 0573834e100dfbcb02190efbc405295dd15784f7 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
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
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.
<project name="FlexPMD Flex Cover Report ANT build report utility" basedir="" default="report">
<!-- set up the build environment -->
<property file="" />
<property file="" />
<property environment="env" />
<property name="flexpmd.version" value="1.0-RC1" />
<!-- get the hostname of the machine we're running on -->
<property name="env.HOSTNAME" value="${env.COMPUTERNAME}" />
<!-- include the flex target definitions -->
<taskdef resource="flexTasks.tasks" classpath="${FLEX_TASKS}" />
<!-- Define the FlexUnit task. -->
<taskdef resource="com/adobe/ac/ant/tasks/" classpath="${ant.lib}/FlexUnitAntTasks.jar" />
<!-- uncomment if you need to see what properties ant is picking up -->
<!-- the main build target the build machine uses, build, test, report, nag -->
<target name="run.prepare"
description="cleans, compiles and tests the app, builds a non-release package." />
<target name="report">
<antcall target="run.prepare">
<param name="testName" value="TestRunner" />
<target name="run">
<antcall target="run.prepare">
<param name="testName" value="TestViewRunner" />
<!-- usethis target to test locally -->
<target name="compileAndRunTests" depends="clean,compileTest,runTest"
description="compile and run the test suite and code coverage tool" />
<target name="getInstrumentationMetadata"
description="compiles the app to get metadata about classes needed for code coverage" depends="clean">
<compile />
<target name="cleanUp" description="removes test harness and temp folder from build directory">
<delete file="${build}/${testAppXML}">
<delete file="${build}/${testSWF}">
<property name="coverageMetadata-path" location="${coverageMetadata}" />
<property name="coverageReport-path" location="${coverageReport}" />
<property name="coverageCVR-path" location="${coverageCVR}" />
<property name="coverageXML-path" location="${coverageXML}" />
<target name="launchCodeCoverageApp" description="launches to code coverage listener app">
<echo>'${coverageMetadata-path}' -output '${coverageCVR-path}' -emma-report '${coverageReport-path}'</echo>
<launchApp appXML="${coverageXML-path}" additionalArgs="${coverageMetadata-path} -output ${coverageCVR-path} -emma-report ${coverageReport-path}" />
<macrodef name="launchApp">
<attribute name="appXML" />
<attribute name="additionalArgs" />
<attribute name="spawn" default="true" />
<pathconvert property="xmlPath" dirsep="${dirSep}">
<path location="@{appXML}" />
<echo>launching adl with ${xmlPath}</echo>
<exec executable="${adl}" spawn="@{spawn}">
<arg line="'${xmlPath}'" />
<arg line="--" />
<arg line="@{additionalArgs}" />
<macrodef name="compile">
<attribute name="srcFile" default="${src}/${mainAppMXML}" />
<attribute name="outputFile" default="${temp}/${mainSWF}" />
<mxmlc file="@{srcFile}" output="@{outputFile}" debug="${debugMode}"
allow-source-path-overlap="true" show-actionscript-warnings="false"
keep-generated-actionscript="false" maxmemory="1024m">
<define name="CONFIG::debugging" value="false" />
<load-config filename="${flexConfig}" />
<!-- path to our source -->
<source-path path-element="${src}" />
<source-path path-element="${src_test}" />
<source-path path-element="${src_locale}" />
<source-path path-element="${testClassPath}" />
<source-path path-element="${resourceBundles}" />
<source-path path-element="${flexUnitSrc}" />
<!-- core flex libraries -->
<compiler.library-path dir="${flexcover.sdk}/frameworks" append="true">
<include name="libs" />
<compiler.library-path dir="${flexcover.sdk}/frameworks/locale" append="true">
<include name="${LOCALE}" />
<!-- air libraries (why need to declare separate)? -->
<compiler.library-path dir="${flexcover.sdk}/frameworks" append="true">
<include name="libs/air" />
<!-- local libraries -->
<compiler.library-path dir="." append="true">
<include name="libs" />
<include name="${ant.lib}" />
<!-- compile the unit tests -->
<target name="compileTest" description="compile the the test suite">
<compile srcFile="${src}/${testAppMXML}" outputFile="${build}/${testSWF}" />
<generateAppXML srcFile="${src}/${testAppXML}" destFile="${build}/${testAppXML}" initialContent="${testSWF}" />
<!-- create the application XML file -->
<macrodef name="generateAppXML">
<attribute name="srcFile" />
<attribute name="destFile" />
<attribute name="initialContent" />
<copy file="@{srcFile}" tofile="@{destFile}" />
<replace file="@{destFile}" token="${initialContentToken}" value="@{initialContent}" />
<echo>setting build number to: ${versionNumber}</echo>
<replace file="@{destFile}" token="%VERSION%" value="${versionNumber}" />
<!-- Clears out the build directory -->
<target name="clean">
<echo message="Removing build directory contents" description="removes build related directory contents" />
<target name="runTest" description="runs the test harness and coverage tool" depends="clean,compileTest">
<parallel timeout="120000">
<antcall target="launchCodeCoverageApp">
<sleep seconds="15" />
<launchApp appXML="${build}/${testAppXML}" additionalArgs="'${testOutputDir}'" spawn="no" />
<airflexunit reportDir="${testOutputDir}" haltonfailure="true" />
<echo>finished running tests </echo>
<available file="${coverageCVR-path}" />
<echo>found coverage CVR </echo>
<available file="${coverageReport-path}" />
<echo>found coverage report</echo>