Created
May 12, 2011 22:55
-
-
Save rynbyjn/969640 to your computer and use it in GitHub Desktop.
AS3 Air 2.6 Ant build files iDevice Android
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
# SDK Stuff | |
FLEX_HOME = /PATH_TO_FLEX_SDK_DIR_OVERLAID_W_AIR_2.6 | |
flex_libs = ${FLEX_HOME}/frameworks/libs | |
air_libs = ${flex_libs}/air | |
mxmlc = ${FLEX_HOME}/lib/mxmlc.jar | |
air_adl = ${FLEX_HOME}/bin/adl | |
air_adt = ${FLEX_HOME}/lib/adt.jar | |
# Project and current version | |
project.name = ProjectName | |
version = 1.0.0 | |
project.version = ${project.name}-${version} | |
# Properties for the directory structure | |
build = ${basedir}/build | |
libs = ${basedir}/libs | |
src = ${basedir}/src | |
assets = ${basedir}/assets | |
debug = ${basedir}/debug | |
publish = ${basedir}/publish | |
package = ${basedir}/package | |
# Global compiler arguments | |
target.player = 11 | |
# Apparat arguments | |
SCALA_HOME = /PATH_TO_SCALA_DIR | |
APPARAT_HOME = /PATH_TO_APPARAT_DIR | |
apparat = ${APPARAT_HOME}/apparat | |
# Properties for compiling the air app | |
airapp.name = project.name | |
airapp.assetdir = ${assets} | |
airapp.debugdir = ${debug} | |
airapp.publishdir = ${publish} | |
airapp.package = ${package} | |
airapp.settings = ${airapp.assetdir}/settings | |
airapp.main = ${src}/PATH_TO_MAIN_CLASS | |
airapp.swf = ${airapp.name}.swf | |
airapp.air = ${airapp.name}.air | |
airapp.descriptor = ${airapp.settings}/${airapp.name}-app.xml | |
# Properties for creating a certificate for the air and android versions of the app | |
aircert.name = ${airapp.name}Certificate | |
aircert.validity = 25 | |
aircert.password = ******** | |
aircert.keytype = 1024-RSA | |
aircert.loc = ${airapp.settings} | |
aircert.country = US | |
aircert.storetype = pkcs12 | |
aircert.file = ${aircert.loc}/${aircert.name}.pfx | |
# idevice compiling properties | |
idevice.descriptor = ${airapp.settings}/${airapp.name}-idevice.xml | |
idevice.profilePath = ${airapp.settings}/PROVISIONING_NAME.mobileprovision | |
idevice.certificate = ${airapp.settings}/${aircert.name}.p12 | |
idevice.ipa = ${airapp.name}.ipa | |
# android compiling properties | |
android.descriptor = ${airapp.settings}/${airapp.name}-android.xml | |
android.apk = ${airapp.name}.apk |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!-- | |
ant howto: http://ant.apache.org/manual/running.html | |
* this file expects to be in a build directory at the root of your project | |
--> | |
<project name="ProjectName" basedir="../" default="usage"> | |
<!-- Include the properties for running builds --> | |
<property file="./build/build.properties"/> | |
<!-- ******************************************************************************************************* | |
CERTIFICATE - UNSIGNED | |
(For use with normal .air app and android) | |
******************************************************************************************************** --> | |
<target name="air-create-certificate" description="Creates a certificate for this app."> | |
<delete file="${aircert.file}"/> | |
<java jar="${air_adt}" fork="true"> | |
<arg value="-certificate"/> | |
<arg value="-validityPeriod"/> | |
<arg value="${aircert.validity}"/> | |
<arg value="-cn"/> | |
<arg value="${aircert.name}"/> | |
<arg value="-c"/> | |
<arg value="${aircert.country}"/> | |
<arg value="${aircert.keytype}"/> | |
<arg value="${aircert.file}"/> | |
<arg value="${aircert.password}"/> | |
</java> | |
</target> | |
<!-- ******************************************************************************************************* | |
AIR 2.6 COMPILING | |
* this keeps Inject and PostConstruct for usage with Robotlegs(http://www.robotlegs.org/) | |
* also defines conditional compiler args for kiosk, computer(testing), idevice, and android for use in code: | |
CONFIG::isIDevice { | |
// do idevice specific stuff here... | |
} | |
******************************************************************************************************** --> | |
<target name="-air-compile-app" depends="-air-kill-adl"> | |
<exec executable="java" failonerror="true"> | |
<arg value="-Xms128m"/> | |
<arg value="-Xmx1024m"/> | |
<arg value="-jar"/> | |
<arg value="${mxmlc}"/> | |
<arg value="-debug=${isDebug}"/> | |
<arg value="+flexlib=${FLEX_HOME}/frameworks"/> | |
<arg value="+configname=air"/> | |
<arg value="-file-specs=${airapp.main}"/> | |
<arg value="-o=${airapp.debugdir}/${airapp.swf}"/> | |
<arg value="-sp=${src}"/> | |
<arg value="-library-path=${libs}"/> | |
<arg value="-library-path=${flex_libs}"/> | |
<arg value="-library-path=${air_libs}"/> | |
<arg value="-library-path=${APPARAT_HOME}"/> | |
<arg value="-define+=CONFIG::isKiosk,${isKiosk}"/> | |
<arg value="-define+=CONFIG::isComputer,${isComputer}"/> | |
<arg value="-define+=CONFIG::isIDevice,${isIDevice}"/> | |
<arg value="-define+=CONFIG::isAndroid,${isAndroid}"/> | |
<arg value="-keep-as3-metadata+=Inject"/> | |
<arg value="-keep-as3-metadata+=PostConstruct"/> | |
<arg value="-target-player=${target.player}"/> | |
</exec> | |
<!-- need to figure out a better way of calling this only when isDebug=false, otherwise we don't get as good of error reporting | |
<antcall target="-apparat"/> --> | |
</target> | |
<!-- ******************************************************************************************************* | |
APPARAT (http://code.google.com/p/apparat/) | |
******************************************************************************************************** --> | |
<path id="apparat.path"> | |
<fileset dir="${SCALA_HOME}" includes="lib/*.jar"/> | |
<fileset dir="${APPARAT_HOME}" includes="*.jar"/> | |
</path> | |
<taskdef resource="apparat/embedding/ant/antlib.xml"> | |
<classpath refid="apparat.path"/> | |
</taskdef> | |
<target name="-apparat"> | |
<!-- strips out all trace statements from the code --> | |
<stripper in="${basedir}/${airapp.debugdir}/${airapp.swf}"> | |
<classpath refid="apparat.path"/> | |
</stripper> | |
<!-- reduces the size of png files that are embedded with the [Embed] metadata tag --> | |
<!-- TODO: figure out why I can't get this reducer version to work properly, currently it just hangs there... | |
<reducer in="${basedir}/${airapp.debugdir}/${airapp.swf}" quality="0.8"> | |
<classpath refid="apparat.path"/> | |
</reducer> --> | |
<!-- turbo diesel sport injection --> | |
<tdsi in="${basedir}/${airapp.debugdir}/${airapp.swf}"> | |
<classpath refid="apparat.path"/> | |
</tdsi> | |
</target> | |
<!-- ******************************************************************************************************* | |
AIR PACKAGING | |
******************************************************************************************************** --> | |
<!-- public --> | |
<!-- Show application without packaging for developing --> | |
<target name="air-test-adl" depends="-setComputerTrue, -air-debug-app, air-launch-app-adl" description="Show application without packaging for development."/> | |
<!-- Show application without packaging for developing --> | |
<target name="air-launch-app-adl" description="Debug application with adl, does NOT repackage or compile!" depends="-air-debug-app"> | |
<exec executable="${air_adl}" failonerror="true"> | |
<arg value="${airapp.descriptor}"/> | |
<arg value="${airapp.debugdir}"/> | |
</exec> | |
</target> | |
<!-- Packaging the application to an air-file in the publish directory --> | |
<target name="air-package-app" depends="-air-publish-app" description="Packages up the air file in the publish directory."> | |
<exec executable="java"> | |
<arg value="-Xms128m"/> | |
<arg value="-Xmx1024m"/> | |
<arg value="-jar"/> | |
<arg value="${air_adt}"/> | |
<arg value="-package"/> | |
<arg value="-storetype"/> | |
<arg value="${aircert.storetype}"/> | |
<arg value="-keystore"/> | |
<arg value="${aircert.file}"/> | |
<arg value="${airapp.package}/${airapp.air}"/> | |
<arg value="${airapp.descriptor}"/> | |
<arg value="-C"/> | |
<arg value="${airapp.debugdir}"/> | |
<arg value="${airapp.swf}"/> | |
<arg value="-C"/> | |
<arg value="${airapp.assetdir}"/> | |
<arg value="icons"/> | |
<!-- This handles the prompt for 'password' from the command line. --> | |
<redirector inputstring="${aircert.password}"/> | |
</exec> | |
</target> | |
<!-- private --> | |
<!-- Compile SWF to debug directory and copy assets to debug directory --> | |
<target name="-air-debug-app" depends="-setDebugTrue, -air-compile-app"> | |
<copy todir="${airapp.debugdir}"> | |
<fileset dir="${airapp.assetdir}"/> | |
</copy> | |
</target> | |
<!-- Compile SWF to build directory for packaging --> | |
<target name="-air-publish-app" depends="-setKioskTrue, -setDebugFalse, -air-compile-app"> | |
</target> | |
<!-- ******************************************************************************************************* | |
iDEVICE PACKAGING | |
******************************************************************************************************** --> | |
<!-- public --> | |
<target name="idevice-debug" depends="-setIDeviceDebug, -setIDeviceTrue, -setDebugTrue, -compile-idevice" description="Creating ipad app in debug mode..."> | |
<echo>ideviced!</echo> | |
</target> | |
<target name="idevice-test" depends="-setIDeviceTest, -setIDeviceTrue, -setDebugFalse, -compile-idevice" description="Creating ipad app in test mode..."> | |
<echo>ideviced!</echo> | |
</target> | |
<target name="idevice-ad-hoc" depends="-setIDeviceAdHoc, -setIDeviceTrue, -setDebugFalse, -compile-idevice" description="Creating ipad ad hoc dealy..."> | |
<echo>ideviced!</echo> | |
</target> | |
<target name="idevice-app-store" depends="-setIDeviceAppStore, -setIDeviceTrue, -setDebugFalse, -compile-idevice" description="Creating ipad for app store release..."> | |
<echo>ideviced!</echo> | |
</target> | |
<!-- private--> | |
<!-- TODO: hook up the --connect flag to ipa-debug method for better debugging --> | |
<target name="-setIDeviceDebug"> | |
<property name="iDeviceTarget" value="ipa-debug"/> | |
</target> | |
<target name="-setIDeviceTest"> | |
<property name="iDeviceTarget" value="ipa-test"/> | |
</target> | |
<target name="-setIDeviceAdHoc"> | |
<property name="iDeviceTarget" value="ipa-ad-hoc"/> | |
</target> | |
<target name="-setIDeviceAppStore"> | |
<property name="iDeviceTarget" value="ipa-app-store"/> | |
</target> | |
<target name="-compile-idevice" depends="-air-compile-app"> | |
<echo>Compiling app for idevices...</echo> | |
<exec executable="java"> | |
<arg value="-Xms128m"/> | |
<arg value="-Xmx1024m"/> | |
<arg value="-jar"/> | |
<arg value="${air_adt}"/> | |
<arg value="-package"/> | |
<arg value="-target"/> | |
<arg value="${iDeviceTarget}"/> | |
<arg value="-storetype"/> | |
<arg value="${aircert.storetype}"/> | |
<arg value="-keystore"/> | |
<arg value="${idevice.certificate}"/> | |
<arg value="-storepass"/> | |
<arg value="${aircert.password}"/> | |
<arg value="-provisioning-profile"/> | |
<arg value="${idevice.profilePath}"/> | |
<arg value="${airapp.package}/${idevice.ipa}"/> | |
<arg value="${idevice.descriptor}"/> | |
<arg value="-C"/> | |
<arg value="${airapp.debugdir}"/> | |
<arg value="${airapp.swf}"/> | |
<arg value="-C"/> | |
<arg value="${airapp.assetdir}"/> | |
<arg value="icons"/> | |
<!-- This handles the prompt for 'password' from the command line. --> | |
<redirector inputstring="${aircert.password}"/> | |
</exec> | |
</target> | |
<!-- ******************************************************************************************************* | |
ANDROID PACKAGING | |
******************************************************************************************************** --> | |
<!-- public --> | |
<target name="android-debug" depends="-setAndroidDebug, -setAndroidTrue, -setDebugTrue, -compile-android" description="Creating android app in debug mode..."> | |
<echo>androided!</echo> | |
</target> | |
<target name="android-apk" depends="-setAndroidAPK, -setAndroidTrue, -setDebugFalse, -compile-android" description="Creating android apk..."> | |
<echo>androided!</echo> | |
</target> | |
<target name="android-apk-emulator" depends="-setAndroidAPKEmulator, -setAndroidTrue, -setDebugTrue, -compile-android" description="Creating android apk for emulator..."> | |
<echo>androided!</echo> | |
</target> | |
<!-- private --> | |
<target name="-setAndroidDebug"> | |
<property name="androidTarget" value="apk-debug"/> | |
</target> | |
<target name="-setAndroidAPK"> | |
<property name="androidTarget" value="apk"/> | |
</target> | |
<target name="-setAndroidAPKEmulator"> | |
<property name="androidTarget" value="apk-emulator"/> | |
</target> | |
<target name="-compile-android" depends="-air-compile-app"> | |
<echo>Compiling app for Android...</echo> | |
<exec executable="java"> | |
<arg value="-Xms128m"/> | |
<arg value="-Xmx1024m"/> | |
<arg value="-jar"/> | |
<arg value="${air_adt}"/> | |
<arg value="-package"/> | |
<arg value="-target"/> | |
<arg value="${androidTarget}"/> | |
<arg value="-storetype"/> | |
<arg value="${aircert.storetype}"/> | |
<arg value="-keystore"/> | |
<arg value="${aircert.file}"/> | |
<arg value="-storepass"/> | |
<arg value="${aircert.password}"/> | |
<arg value="${airapp.package}/${android.apk}"/> | |
<arg value="${android.descriptor}"/> | |
<arg value="-C"/> | |
<arg value="${airapp.debugdir}"/> | |
<arg value="${airapp.swf}"/> | |
<arg value="-C"/> | |
<arg value="${airapp.assetdir}"/> | |
<arg value="icons"/> | |
<!-- This handles the prompt for 'password' from the command line. --> | |
<redirector inputstring="${aircert.password}"/> | |
</exec> | |
</target> | |
<!-- ******************************************************************************************************* | |
DEBUGGING FLAGS | |
******************************************************************************************************** --> | |
<!-- private: kick start the FDT bugger and allow the .swf to be compiled in debug mode. **This one still requires FDT for having debugging in the console. Unless you use flash tail or something like that** --> | |
<target name="-setDebugTrue"> | |
<property name="isDebug" value="true"/> | |
</target> | |
<!-- private: compile the .swf without debug mode. --> | |
<target name="-setDebugFalse"> | |
<property name="isDebug" value="false"/> | |
</target> | |
<!-- ******************************************************************************************************* | |
CONDITIONAL COMPILE ARGS | |
******************************************************************************************************** --> | |
<!-- set it to kiosk mode --> | |
<target name="-setKioskTrue" depends="-setComputerFalse, -setIDeviceFalse, -setAndroidFalse"> | |
<property name="isKiosk" value="true"/> | |
</target> | |
<target name="-setKioskFalse"> | |
<property name="isKiosk" value="false"/> | |
</target> | |
<!-- set it to computer mode --> | |
<target name="-setComputerTrue" depends="-setKioskFalse, -setIDeviceFalse, -setAndroidFalse"> | |
<property name="isComputer" value="true"/> | |
</target> | |
<target name="-setComputerFalse"> | |
<property name="isComputer" value="false"/> | |
</target> | |
<!-- set it to idevice mode --> | |
<target name="-setIDeviceTrue" depends="-setComputerFalse, -setKioskFalse, -setAndroidFalse"> | |
<property name="isIDevice" value="true"/> | |
</target> | |
<target name="-setIDeviceFalse"> | |
<property name="isIDevice" value="false"/> | |
</target> | |
<!-- set it to android mode --> | |
<target name="-setAndroidTrue" depends="-setComputerFalse, -setIDeviceFalse, -setKioskFalse"> | |
<property name="isAndroid" value="true"/> | |
</target> | |
<target name="-setAndroidFalse"> | |
<property name="isAndroid" value="false"/> | |
</target> | |
</project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment