Permalink
Browse files

added AIR building and packaging.

  • Loading branch information...
1 parent da3506d commit def369444f162aba1ea40a9d4142b27072fd5330 @raptros committed Aug 2, 2010
View
@@ -7,6 +7,8 @@
/bin/*
/doc/*
/report/*
+/tmp/*
+/apks/*
/dist/*
/.actionScriptProperties
@@ -7,13 +7,14 @@ autolaunch.url = true
mobile = false
#compiler mode: debug, optimize, apparat
-compile.type = debug
+compile.type = optimize
+compile.platform=air
# Build paths
FLEX_HOME = path/to/sdk
android.sdk = path/to/sdk
-APPARAT_HOME = path/to/apparat/
-SCALA_HOME = path/to/sdk
+#APPARAT_HOME = path/to/apparat/
+#SCALA_HOME = path/to/sdk
#Properties file for build.xml
project.name = DeveloperHappyHour
@@ -45,3 +46,6 @@ template.loc=${basedir}/build/templates
includes.loc=${basedir}/build/build-includes
air.swcs=${FLEX_HOME}/frameworks/libs/air
adb=${android.sdk}/tools/adb
+apks.loc=${basedir}/apks
+tmp.loc=${basedir}/tmp
+logs.loc=${report.loc}/logs
View
@@ -10,55 +10,80 @@
<!-- Add the ant-contrib tasks -->
<taskdef resource="net/sf/antcontrib/antcontrib.properties" classpath="${lib.loc}/ant-contrib.jar" />
+ <import file="${includes.loc}/logging.xml" />
<import file="${includes.loc}/misc.xml" />
<import file="${includes.loc}/test.xml" />
<import file="${includes.loc}/asdoc.xml" />
+ <import file="${includes.loc}/compile-air.xml" />
+ <import file="${includes.loc}/package-air.xml" />
<import file="${includes.loc}/compile-swf.xml" />
<import file="${includes.loc}/compile-swc.xml" />
<import file="${includes.loc}/android.xml" />
<!--<import file="${includes.loc}/apparat.xml" />-->
+ <target name="startlog" depends="logging.start"/>
+
<target name="usage" depends="misc.usage" description="Prints usage message" />
- <target name="test" depends="test.run" description="Runs unit tests and displays the report"/>
+ <target name="test" depends="startlog" description="Runs unit tests and displays the report">
+ <log>start target test</log>
+ <runtarget target="test.run"/>
+ <log>end target test</log>
+ </target>
<target name="asdoc" depends="asdoc.gen" description="generates ASDoc"/>
- <target name="compile" description="Compiles the project as a swf">
+ <target name="compile" depends="startlog" description="Compiles the project as a swf">
+ <log>start target compile</log>
<!--check for compiler flag: normal compile vs apparat compile-->
<if>
- <equals arg1="apparat" arg2="${compile.type}" casesensitive="false" />
+ <equals arg1="air" arg2="${compile.platform}" casesensitive="false" />
<then>
- <runtarget target="compile-swf.setup-bin" />
- <runtarget target="apparat.compile" />
+ <runtarget target="compile-air.compile" />
</then>
-
<else>
<runtarget target="compile-swf.compile" />
</else>
</if>
+ <log>end target compile</log>
+ </target>
+
+ <target name="run" description="Runs app">
+ <if>
+ <equals arg1="air" arg2="${compile.platform}" casesensitive="false" />
+ <then>
+ <runtarget target="compile-air.local-run" />
+ </then>
+ <else>
+ <runtarget target="compile-swf.local-run" />
+ </else>
+ </if>
+
</target>
- <target name="full-build" depends="test,compile" description="Runs tests, compiles project, and optionally runs it.">
+ <target name="full-build" depends="test" description="Runs tests, compiles project, and optionally runs it.">
+ <log message="autolaunching"/>
<if>
<istrue value="${autolaunch.url}"/>
- <then><runtarget target="compile-swf.local-run"/></then>
+ <then><runtarget target="run" /></then>
</if>
</target>
<target name="compile-swc" description="Compiles project as swc" depends="compile-swc.compile" />
<target name="deploy-lib" description="Prepares swf lib and moves it to deploy directory" depends="compile-swc.deploy"/>
- <target name="package-apk" description="Packages up project for deployment to android">
- <var name="mobile" value="true" />
+ <target name="package" depends="startlog" description="Packages up project as air app">
+ <log>start target package-apk</log>
+ <echo message="${compile.platform}"/>
<echo message="${mobile}"/>
- <runtarget target="compile" />
- <runtarget target="android.package-apk" />
+ <runtarget target="compile"/>
+ <runtarget target="package-air.package" />
+ <log>end target package-apk</log>
</target>
- <target name="deploy-to-emulator" depends="package-apk,android.deploy-to-emulator" />
+ <target name="deploy-to-emulator" depends="package,android.deploy-to-emulator" />
- <target name="deploy-to-phone" depends="package-apk,android.deploy-to-phone" />
+ <target name="deploy-to-phone" depends="package,android.deploy-to-phone" />
</project>
@@ -0,0 +1,5 @@
+
+# air-template variables
+width = 800
+height = 480
+
Binary file not shown.
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8" standalone="no"?>
+<application xmlns="http://ns.adobe.com/air/application/2.0">
+ <id>@package@</id>
+ <filename>@project@</filename>
+ <name>@project@</name>
+ <version>@version@</version>
+ <initialWindow>
+ <content>swfs/@projectversion@.swf</content>
+ <visible>true</visible>
+ <resizable>true</resizable>
+ <minimizable>true</minimizable>
+ <maximizable>true</maximizable>
+ <width>@width@</width>
+ <height>@height@</height>
+ </initialWindow>
+</application>
@@ -0,0 +1,5 @@
+
+# air-template variables
+width = 400
+height = 240
+
@@ -11,6 +11,8 @@
<fullScreen>true</fullScreen>
<aspectRatio>landscape</aspectRatio>
<autoOrients>false</autoOrients>
+ <width>@width@</width>
+ <height>@height@</height>
</initialWindow>
<icon>
<image72x72>images/icons/app-logo-72x72.png</image72x72>
@@ -1,60 +1,20 @@
<?xml version="1.0"?>
<project name="android" basedir=".">
-
- <target name="prep-bin">
- <copy file="${basedir}/build/android-resources/template-air-app.xml"
- tofile="${bin.loc}/${project.name}-air-app.xml"/>
-
- <replace file="${bin.loc}/${project.name}-air-app.xml">
- <replacefilter token="@project@" value="${project.name}"/>
- <replacefilter token="@package@" value="${app.package}"/>
- <replacefilter token="@version@" value="1"/>
- <replacefilter token="@projectversion@" value="${project.name.versioned}"/>
- </replace>
-
- <antcall target="uninstall-apk"/>
- </target>
-
- <!-- Android Deployment -->
- <target name="package-apk" depends="prep-bin">
-
- <java jar="${FLEX_HOME}/lib/adt.jar" fork="true" failonerror="true">
- <arg value="-package"/>
- <arg value="-target"/>
- <arg value="apk"/>
- <arg value="-storetype"/>
- <arg value="pkcs12"/>
- <arg value="-keystore"/>
- <arg value="${basedir}/build/android-resources/codesigningCert.p12"/>
- <arg value="-storepass"/>
- <arg value="${password}"/>
-
-
- <arg value="${basedir}/bin/${project.name.versioned}.apk"/>
- <arg value="${basedir}/bin/${project.name}-air-app.xml"/>
-
- <arg value="-C"/>
- <arg value="${basedir}/bin"/>
- <arg value="."/>
-
- </java>
- </target>
-
- <target name="deploy-to-phone" depends="package-apk">
+ <target name="deploy-to-phone" depends="uninstall-apk">
<exec executable="${adb}">
<arg value="-d"/>
<arg value="install"/>
- <arg value="${bin.loc}/${project.name.versioned}.apk"/>
+ <arg value="${apks.loc}/${project.name.versioned}.apk"/>
</exec>
</target>
- <target name="deploy-to-emulator" depends="package-apk">
+ <target name="deploy-to-emulator" depends="uninstall-apk">
<exec executable="${adb}">
<!-- <arg value="-s"/>
<arg value="emulator-5556"/>-->
<arg value="-e"/>
<arg value="install"/>
- <arg value="${bin.loc}/${project.name.versioned}.apk"/>
+ <arg value="${apks.loc}/${project.name.versioned}.apk"/>
</exec>
</target>
@@ -0,0 +1,125 @@
+<?xml version="1.0"?>
+<project name="compile-air" basedir="." default="local-run">
+
+ <target name="clean-bin">
+ <!-- Remove all directories created during the build process -->
+ <if>
+ <available type="dir" file="${bin.loc}"/>
+ <then>
+ <delete includeemptydirs="true" failonerror="false">
+ <fileset dir="${bin.loc}" defaultexcludes="false">
+ <include name="**/*"/>
+ </fileset>
+ </delete>
+ </then>
+ <else>
+ <mkdir dir="${bin.loc}"/>
+ </else>
+ </if>
+ </target>
+
+ <target name="clean-css">
+ <if>
+ <available type="dir" file="${bin.loc}/css"/>
+ <then>
+ <replaceregexp flags="g">
+ <regexp pattern="\s*([@{}:;,]|\)\s|\s\()\s*|\s*\/\*([^*\\\\]|\*(?!\/))+\*\/\s*|[\n\r\t]" />
+ <substitution expression="\1" />
+ <fileset dir="${bin.loc}/css">
+ <include name="*.css" />
+ </fileset>
+ </replaceregexp>
+ </then>
+ </if>
+ </target>
+
+ <target name="setup-bin" depends="clean-bin">
+ <sync todir="${bin.loc}">
+ <fileset dir="${basedir}/build/bin-resources"/>
+ </sync>
+
+ <copy file="${basedir}/build/air-resources/template-air-app.xml"
+ tofile="${bin.loc}/${project.name}-air-app.xml" />
+ <copy file="${basedir}/build/air-resources/air.properties"
+ tofile="${bin.loc}/air.properties"/>
+
+ <replace file="${bin.loc}/${project.name}-air-app.xml" propertyFile="${bin.loc}/air.properties">
+ <replacefilter token="@width@" property="width"/>
+ <replacefilter token="@height@" property="height"/>
+ <replacefilter token="@project@" value="${project.name.versioned}"/>
+ <replacefilter token="@package@" value="${app.package}"/>
+ <replacefilter token="@version@" value="1"/>
+ <replacefilter token="@projectversion@" value="${project.name.versioned}"/>
+ </replace>
+ <if>
+ <istrue value="${csstidy}" />
+ <then>
+ <runtarget target="clean-css" />
+ </then>
+ </if>
+ </target>
+
+
+ <!-- Compile Release SWF -->
+ <target name="compile" depends="setup-bin">
+ <echo>[compile] Compiling SWF</echo>
+ <echo>[compile] Using Flex SDK at: ${FLEX_HOME}</echo>
+
+ <if>
+ <equals arg1="debug" arg2="${compile.type}" casesensitive="false"/>
+ <then>
+ <property name="debug.flag" value="true"/>
+ <property name="optimize.flag" value="false"/>
+ <property name="mode.name" value="Debug"/>
+ </then>
+ <elseif>
+ <equals arg1="optimize" arg2="${compile.type}" casesensitive="false"/>
+ <then>
+ <property name="debug.flag" value="false"/>
+ <property name="optimize.flag" value="true"/>
+ <property name="mode.name" value="Optimized"/>
+ </then>
+ </elseif>
+ </if>
+
+ <java jar="${FLEX_HOME}/lib/mxmlc.jar" dir="${FLEX_HOME}/frameworks" fork="true" failonerror="true">
+ <arg value="+configname=air"/>
+ <arg value="${main.src.loc}/${project.name}.as"/>
+ <arg value="-source-path=${main.src.loc}"/>
+
+ <arg value="-output=${bin.loc}/swfs/${project.name.versioned}.swf"/>
+ <arg value="-static-link-runtime-shared-libraries=true"/>
+ <!--Compile mode debug vs. optimize-->
+ <arg value="-debug=${debug.flag}"/>
+ <arg value="-optimize=${optimize.flag}"/>
+ <!-- Include classes from SWCs in this folder, but only the ones we use. -->
+ <arg value="-library-path+=${lib.loc}"/>
+ <arg value="-library-path+=${air.swcs}"/>
+ <arg value="-incremental=true"/>
+ <arg value="-verbose-stacktraces=true"/>
+ <arg value="-headless-server=true"/>
+ <arg value="-use-network=false"/>
+ <!--<arg value="-default-frame-rate=31"/>-->
+ <arg value="-define=CONFIG::mobile,${mobile}"/>
+ </java>
+
+ <echo>[compile] ${mode.name} SWF ${project.name.versioned}.swf created successfully</echo>
+ </target>
+
+ <target name="local-run" depends="compile">
+ <echo message="${os.name}"/>
+ <if>
+ <equals arg1="${os.name}" arg2="Mac OS X"/>
+ <then>
+ <exec executable="${FLEX_HOME}/bin/adl" spawn="false">
+ <arg line="${bin.loc}/${project.name}-air-app.xml"/>
+ </exec>
+ </then>
+ <else>
+ <exec executable="${FLEX_HOME}/bin/adl.exe" spawn="false">
+ <arg line="${bin.loc}/${project.name}-air-app.xml"/>
+ </exec>
+ </else>
+ </if>
+ </target>
+</project>
Oops, something went wrong.

0 comments on commit def3694

Please sign in to comment.