Switch branches/tags
Find file
Fetching contributors…
Cannot retrieve contributors at this time
185 lines (160 sloc) 7.66 KB
<?xml version="1.0"?>
<project name="robotlegs-framework" basedir="." default="test">
<!-- This is 100% ripped off from RobotLegs -
I am working on making my own but this one is so damn good I couldn't help myself. -->
<!-- set up a prefix for all environment variables -->
<property environment="env."/>
<!-- System environment must contain FLEX_HOME variable that points to Flex SDK
<property name="FLEX_HOME" location="${env.FLEX_HOME}"/> -->
<!-- identify properties file -->
<property file=""/>
<!-- Set up FlexUnit Ant tasks -->
<taskdef resource="flexUnitTasks.tasks" classpath="${lib.loc}/flexUnitTasks.jar"/>
<target name="usage">
<echo message=""/>
<echo message="Robotlegs Build Usage"/>
<echo message="-----------------------------------"/>
<echo message=""/>
<echo message="Available targets are:"/>
<echo message=""/>
<echo message="test --> Build Robotlegs SWC and run unit tests"/>
<echo message="asdoc --> Build Robotlegs SWC, test, and generate asdocs"/>
<echo message="package --> Build Robotlegs SWC, test, and create release zip"/>
<echo message="compile --> Build Robotlegs SWC"/>
<echo message="clean --> Remove all folders created by build script"/>
<echo message="init --> Clean and create build folders"/>
<echo message=""/>
<!-- Clean Build and Report files -->
<target name="clean">
<!-- Remove all directories created during the build process -->
<echo>[clean] Removing Build and Report directories</echo>
<delete includeemptydirs="true" failonerror="false">
<fileset dir="${report.loc}" defaultexcludes="false">
<include name="**/*"/>
<fileset dir="${dist.loc}" defaultexcludes="false">
<include name="**/*"/>
<echo>[clean] Build and Report directories removed</echo>
<!-- Create directories needed for the build process -->
<target name="init" depends="clean">
<echo>[init] Creating Bin and Report directories</echo>
<mkdir dir="${bin.loc}"/>
<mkdir dir="${report.loc}"/>
<echo>[init] Bin and Report directories created</echo>
<!-- Compile Release SWC -->
<target name="compile" depends="init">
<echo>[compile] Compiling release SWC</echo>
<echo>[compile] Using Flex SDK at: ${FLEX_HOME}</echo>
<java jar="${FLEX_HOME}/lib/compc.jar" dir="${FLEX_HOME}/frameworks" fork="true" failonerror="true">
<!-- Build our SWC with a versioned name. -->
<arg value="-output=${bin.loc}/${}.swc" />
<!-- We want all the org package classes in the SWC being built. -->
<arg value="-include-sources=${main.src.loc}/com" />
<!-- Include classes from SWCs in this folder, but only the ones we use. -->
<arg value="-library-path+=${lib.loc}" />
<!-- Keep the magic alive. -->
<arg value="-keep-as3-metadata+=Inject" />
<!-- Boolean mosh pit! -->
<arg value="-incremental=true" />
<arg value="-static-link-runtime-shared-libraries=true" />
<arg value="-verbose-stacktraces=true" />
<arg value="-headless-server=true" />
<echo>[compile] Release SWC ${}.swc created successfully</echo>
<!-- Run Unit Tests -->
<target name="test" depends="compile">
<echo>[test] Running Unit Tests</echo>
<!-- Compile TestRunner.mxml as a SWF -->
<java jar="${FLEX_HOME}/lib/mxmlc.jar" dir="${FLEX_HOME}/frameworks" fork="true" failonerror="true">
<arg value="${test.src.loc}/FCSSTest.mxml" />
<arg value="-source-path=${main.src.loc}" />
<!-- Flash those sweet legs. Blink and you'll miss 'em. -->
<arg value="-output=${bin.loc}/TestRunner.swf" />
<arg value="-default-size=307,136" />
<arg value="-default-background-color=0x000000" />
<!-- Include classes from SWCs in this folder, but only the ones we use. -->
<arg value="-library-path+=${lib.loc}" />
<!-- So true. -->
<arg value="-incremental=true" />
<arg value="-verbose-stacktraces=true" />
<arg value="-headless-server=true" />
<!-- Execute TestRunner.swf as FlexUnit tests and publish reports -->
<flexunit swf="bin/TestRunner.swf" toDir="${report.loc}" haltonfailure="true" verbose="true" localTrusted="true"/>
<!-- Generate readable JUnit-style reports -->
<junitreport todir="${report.loc}">
<fileset dir="${report.loc}">
<include name="TEST-*.xml"/>
<report format="frames" todir="${report.loc}/html"/>
<echo>[test] Finished running Unit Tests</echo>
<!-- Build Documentation -->
<target name="asdoc" depends="test">
<echo>[create-docs] Generating ASDOC documentation</echo>
<format property="docgen.time" pattern="MM/dd/yyyy hh:mm aa" unit="hour"/>
<java jar="${FLEX_HOME}/lib/asdoc.jar" dir="${FLEX_HOME}/frameworks" fork="true" failonerror="true">
<arg line="-external-library-path ${lib.loc}"/>
<arg line="-doc-sources ${main.src.loc}"/>
<arg line="-source-path ${main.src.loc}"/>
<arg line="-output ${doc.loc}"/>
<arg line="-window-title 'Robotlegs ${robotlegs.ver.num}'"/>
<arg line="-main-title 'Robotlegs ${robotlegs.ver.num}'"/>
<arg line="-footer 'Robotlegs - - Documentation generated at: ${docgen.time}'" />
<arg line="-package org.robotlegs.adapters 'Adapters to bridge third-party Di/IoC and reflection libraries'"/>
<arg line="-package org.robotlegs.base 'Base classes used to build custom Robotlegs frameworks'"/>
<arg line="-package org.robotlegs.core 'The core Robotlegs Framework apparatus contracts'"/>
<arg line="-package org.robotlegs.mvcs 'The reference MVCS Robotlegs Framework implementation'"/>
<echo>[create-docs] ASDOC documentation generated successfully</echo>
<!-- Package the Build -->
<target name="package" depends="test">
<format property="touch.time" pattern="MM/dd/yyyy hh:mm aa" unit="hour"/>
<!-- Assemble -->
<echo>[package] Packaging Release</echo>
<mkdir dir="${dist.loc}"/>
<mkdir dir="${dist.loc}/bin"/>
<mkdir dir="${dist.loc}/src"/>
<copy file="${bin.loc}/${}.swc" todir="${dist.loc}/bin"/>
<copy todir="${dist.loc}/src/org">
<fileset dir="${main.src.loc}/org"/>
<!-- Copy README -->
<copy file="${template.loc}/README.tmpl" tofile="${dist.loc}/README" overwrite="true">
<token key="date" value="${touch.time}"/>
<token key="rlversion" value="${robotlegs.ver.num}"/>
<token key="releasename" value="${}"/>
<token key="ssversion" value="${swift.suspenders.version}"/>
<token key="sslink" value="${}"/>
<token key="rlprojectlink" value="${}"/>
<token key="bestpracticeslink" value="${}"/>
<token key="faqlink" value="${}"/>
<!-- Zip It -->
<zip destfile="${dist.loc}/${}.zip">
<fileset dir="${dist.loc}"/>
<!-- Clean Up -->
<delete file="${dist.loc}/${}.swc"/>
<delete file="${dist.loc}/README"/>
<delete dir="${dist.loc}/bin"/>
<delete dir="${dist.loc}/src"/>
<echo>[package] Release packaged successfully</echo>