Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

file 224 lines (200 sloc) 10.096 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224
<?xml version="1.0" encoding="UTF-8"?>
<project name="site_stream" default="all">
<!-- TODO: flex unit test coverage -->
<!-- Sets up all required build properties -->
<target name="-init">
<!-- External props -->
<property environment="env"/>
<property file="${basedir}/build.user.properties" />
<property name="build.properties.loc" location="${basedir}/build.properties" />
<property file="${build.properties.loc}" />

<!-- flex.sdk.loc should point to the root directory of the flex sdk, 4.5.0
to override the FLEX_HOME environment variable, use the build.user.properties file -->
<property name="flex.sdk.loc" value="${env.FLEX_HOME}" />

<!-- General Source -->
<property name="src.loc" location="${basedir}/siteStreamSrc" />
<property name="test.src.loc" location="${basedir}/testSrc" />
<property name="libs.loc" location="${basedir}/libs" />

<!-- Build Config -->
<property name="config.loc" location="${basedir}/config" />
<property name="config.flex" value="${config.loc}/flex-config.xml" />

<!-- General Build -->
<property name="build.loc" location="${basedir}/build" />
<property name="build.api.loc" location="${build.loc}/api" />
<property name="build.release.loc" location="${build.loc}/release" />
<property name="build.release.compile.loc"
location="${build.release.loc}/${build.name}-${build.version}_${build.num}.swc" />
<property name="build.release.package.loc"
location="${build.release.loc}/${build.name}-${build.version}_${build.num}.zip" />
<property name="build.analysis.loc" location="${build.loc}/analysis" />
<property name="build.test.loc" location="${build.loc}/test" />
<property name="build.test.reports.loc" location="${build.test.loc}/reports" />

<!-- Flex tasks -->
<property name="FLEX_HOME" value="${flex.sdk.loc}" />
<taskdef resource="flexTasks.tasks" classpath="${flex.sdk.loc}/ant/lib/flexTasks.jar" />

<!-- FlexUnit -->
<taskdef resource="flexUnitTasks.tasks"
classpath="${libs.loc}/flexUnitTasks-4.1.0_RC2-4.jar" />

<!-- FlexCPD -->
<property name="flexpmd.version" value="1.2" />
<taskdef name="flexcpd" classname="com.adobe.ac.cpd.ant.FlexCpdAntTask"
classpath="${libs.loc}/flex-pmd-cpd-ant-task-${flexpmd.version}.jar">
<classpath>
<pathelement location="${libs.loc}/flex-pmd-files-${flexpmd.version}.jar" />
<pathelement location="${libs.loc}/flex-pmd-cpd-${flexpmd.version}.jar" />
<pathelement location="${libs.loc}/as3-plugin-utils-${flexpmd.version}.jar" />
<pathelement location="${libs.loc}/as3-parser-${flexpmd.version}.jar" />
<pathelement location="${libs.loc}/as3-parser-api-${flexpmd.version}.jar" />
<pathelement location="${libs.loc}/pmd-4.2.5.jar" />
</classpath>
</taskdef>

<!-- FlexPMD -->
<taskdef name="flexpmd" classname="com.adobe.ac.pmd.ant.FlexPmdAntTask"
classpath="${libs.loc}/flex-pmd-ant-task-${flexpmd.version}.jar">
<classpath>
<pathelement location="${libs.loc}/flex-pmd-core-${flexpmd.version}.jar" />
<pathelement location="${libs.loc}/flex-pmd-files-${flexpmd.version}.jar" />
<pathelement location="${libs.loc}/flex-pmd-ruleset-${flexpmd.version}.jar" />
<pathelement location="${libs.loc}/as3-plugin-utils-${flexpmd.version}.jar" />
<pathelement location="${libs.loc}/as3-parser-${flexpmd.version}.jar" />
<pathelement location="${libs.loc}/as3-parser-api-${flexpmd.version}.jar" />
<pathelement location="${libs.loc}/commons-lang-2.4.jar" />
<pathelement location="${libs.loc}/flex-pmd-ruleset-api-${flexpmd.version}.jar" />
<pathelement location="${libs.loc}/pmd-4.2.5.jar" />
<pathelement location="${libs.loc}/plexus-utils-1.0.2.jar" />
</classpath>
</taskdef>

<!-- FlexMetrics -->
<taskdef name="flexmetrics" classname="com.adobe.ac.pmd.metrics.ant.FlexMetricsAntTask"
classpath="${libs.loc}/flex-pmd-metrics-ant-task-${flexpmd.version}.jar">
<classpath>
<pathelement location="${libs.loc}/flex-pmd-files-${flexpmd.version}.jar" />
<pathelement location="${libs.loc}/flex-pmd-metrics-${flexpmd.version}.jar" />
<pathelement location="${libs.loc}/as3-plugin-utils-${flexpmd.version}.jar" />
<pathelement location="${libs.loc}/as3-parser-${flexpmd.version}.jar" />
<pathelement location="${libs.loc}/as3-parser-api-${flexpmd.version}.jar" />
<pathelement location="${libs.loc}/commons-lang-2.4.jar" />
<pathelement location="${libs.loc}/flex-pmd-ruleset-api-${flexpmd.version}.jar" />
<pathelement location="${libs.loc}/pmd-4.2.5.jar" />
<pathelement location="${libs.loc}/dom4j-1.6.1.jar"/>
</classpath>
</taskdef>
</target>

<!-- Remove build artifacts -->
<target name="clean" depends="-init" description="Remove build artifacts">
<delete dir="${build.loc}" />
</target>

<!-- Setup build artifacts directories -->
<target name="-prepare" depends="clean">
<mkdir dir="${build.loc}" />
<mkdir dir="${build.release.loc}" />
<mkdir dir="${build.analysis.loc}" />
<mkdir dir="${build.test.loc}" />
<mkdir dir="${build.test.reports.loc}" />
</target>

<!-- Run all tests and create a debug build of the library -->
<!-- TODO: Add test to all once can get to work in CI environment -->
<target name="all" depends="analyse,doc,package"
description="Run all tests and create a package of the library" />

<!-- Generate all documentation -->
<target name="doc" depends="doc-api" description="Generate all documentation" />

<!-- Generate API Documentation -->
<target name="doc-api" depends="-prepare" description="Generates API Documentation">
<asdoc output="${build.api.loc}" lenient="false" failonerror="true">
<doc-sources path-element="${src.loc}" />
<external-library-path file="${libs.loc}/tbyrne.swc" />
        </asdoc>
</target>

<!-- Creates an SWC of the library -->
<target name="compile" depends="-prepare"
description="Create an SWC of the library">
<compileswc file="${build.release.compile.loc}" />
<propertyfile file="${build.properties.loc}">
<entry key="build.num" default="0" value="1" type="int" operation="+" />
</propertyfile>
</target>

<!-- Creates a debug SWC of the library -->
<target name="compile-debug" depends="-prepare"
description="Create a debug SWC of the library">
<compileswc file="${build.release.compile.loc}" debug="true" />
<propertyfile file="${build.properties.loc}">
<entry key="build.num" default="0" value="1" type="int" operation="+" />
</propertyfile>
</target>

<!-- Creates a full distributable package -->
<target name="package" depends="doc,compile">
<!-- TODO: Examples, example projects, docs, etc. -->
<zip destfile="${build.release.package.loc}">
<zipfileset file="${build.release.compile.loc}"
fullpath="${build.name}-${build.version}.swc" />
<zipfileset file="${libs.loc}/tbyrne.swc" />
<zipfileset dir="${build.api.loc}" prefix="doc/api" />
</zip>
</target>

<!-- Build a release package for the current library -->
<target name="release" depends="test,package"
description="Build a release package for the current library">
<move file="${build.release.compile.loc}"
tofile="${build.release.loc}/${build.name}-${build.version}.swc" />
<move file="${build.release.package.loc}"
tofile="${build.release.loc}/${build.name}-${build.version}.zip" />
<!-- TODO: make a git tag -->
<!-- TODO: Upload to github downloads? -->
</target>

<!-- Run all tests -->
<target name="test" depends="-prepare" description="Run all tests">
<flexunit workingDir="${build.test.loc}" toDir="${build.test.reports.loc}"
haltonfailure="true" verbose="false" localTrusted="true">
<source dir="${src.loc}" />
<testSource dir="${test.src.loc}">
<!--<include name="**/*Test.as" />-->
<include name="ExampleTest.as" />
</testSource>
<library dir="${libs.loc}" />
</flexunit>
<junitreport todir="${build.test.reports.loc}">
<fileset dir="${build.test.reports.loc}">
<include name="TEST-*.xml" />
</fileset>
<report format="frames" todir="${build.test.reports.loc}/html" />
</junitreport>
</target>

<!-- Run all analysis -->
<target name="analyse" depends="analyse-cpd,analyse-metrics,analyse-pmd"
description="Run all analysis" />

<!-- Run CPD Analysis -->
    <target name="analyse-cpd" depends="-prepare" description="Runs CPD Analysis">
     <flexcpd minimumTokenCount="50" outputFile="${build.analysis.loc}/cpd.xml">
         <fileset dir="${src.loc}">
             <include name="**/*.as"/>
           </fileset>
        </flexcpd>
    </target>

<!-- Run Metrics Analysis -->
<target name="analyse-metrics" depends="-prepare" description="Run Metrics Analysis">
<flexmetrics sourcedirectory="${src.loc}" outputfile="${build.analysis.loc}/metrics.xml"/>
</target>

<!-- Run PMD Analysis -->
<target name="analyse-pmd" depends="-prepare" description="Run PMD Analysis">
<flexpmd sourceDirectory="${src.loc}" outputDirectory="${build.analysis.loc}/pmd" />
<!--ruleset="${basedir}/pmd-ruleset.xml" />-->
</target>

<!-- Compile swc version of the library -->
<macrodef name="compileswc">
<attribute name="file" />
<attribute name="debug" default="false" />
<sequential>
<compc output="@{file}" debug="@{debug}">
<source-path path-element="${src.loc}" />
<include-sources dir="${src.loc}" includes="**/*.as" />
<external-library-path dir="${libs.loc}">
<include name="*.swc"/>
</external-library-path>
<load-config filename="${config.flex}" />
<external-library-path dir="${flex.sdk.loc}/frameworks/libs/player/10.0">
<include name="*.swc"/>
</external-library-path>
</compc>
</sequential>
</macrodef>
</project>
Something went wrong with that request. Please try again.