Advertisement
Guest User

Ant script for building AIR app

a guest
Jul 12th, 2012
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 3.78 KB | None | 0 0
  1. <project name="A script to build an AIR app"  basedir="." default="distributable-air">
  2.  
  3.   <property name="FLEX_HOME" value="/home/...../Flex/SDK/4.0" />
  4.  
  5.   <property name="adt" value="/home/...../Flex/SDK/air/bin/adt" />
  6.   <property name="adl" value="/home/...../Flex/SDK/air/bin/adl" />
  7.  
  8.   <property name="src.dir" value="${basedir}/src/" />
  9.   <property name="out.dir" value="${basedir}/bin-release/" />
  10.   <property name="dbg.dir" value="${basedir}/bin-debug/" />
  11.   <property name="e4xu.dir" value="/home/........./src/" />
  12.  
  13.   <taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar" />
  14.  
  15.   <target name="clean" description="Clean the project">
  16.     <delete dir="${out.dir}" failonerror="false" />
  17.   </target>
  18.  
  19.   <target name="create-certificate" description="Creates a self-signed certificate">
  20.     <input message="The password for certificate" addproperty="password"/>
  21.     <!--
  22.         Remember the password you entered (better write it somewhere),
  23.         you will need it to compile the project later.
  24.         This target is not included in the build, so you will have to
  25.         run it before you build the project.
  26.    -->
  27.     <exec executable="${adt}" failonerror="true">
  28.       <arg line="-certificate -cn SelfSigned 1024-RSA ${basedir}/AS3Reader.pfx ${password}" />
  29.     </exec>
  30.   </target>
  31.  
  32.   <target name="init" description="initialize the project" depends="clean">
  33.     <mkdir dir="${out.dir}" />
  34.     <!--
  35.         This is similar to what Flash Builder does when it copies files
  36.         you used in the source folders to the bin folder.
  37.    -->
  38.     <copy todir="${out.dir}" includeemptydirs="false">
  39.       <fileset dir="${basedir}">
  40.         <exclude name="**/*.as" />
  41.         <exclude name="**/*.mxml" />
  42.         <exclude name="**/build.xml" />
  43.         <exclude name="**/*.properties" />
  44.         <exclude name="**/*.air" />
  45.         <exclude name="**/*.pfx" />
  46.         <exclude name="**/*.swf" />
  47.         <include name="**/*" />
  48.       </fileset>
  49.     </copy>
  50.   </target>
  51.  
  52.   <target name="compile-as3-reader"
  53.          description="Compile swf modules and main swf" depends="init">
  54.     <!-- Compiles AS3Reader.swf -->
  55.     <mxmlc file="${src.dir}......./AS3ReaderTest.mxml" output="${out.dir}/AS3Reader.swf"
  56.           debug="true"
  57.           optimize="true"
  58.           warn-unlikely-function-value="false"
  59.           locale="en_US"
  60.           configname="air">
  61.       <source-path path-element="${src.dir}" />
  62.       <source-path path-element="${e4xu.dir}" />
  63.       <library-path dir="${FLEX_HOME}/frameworks/libs" append="true">
  64.         <include name="*.swc" />
  65.       </library-path>
  66.       <library-path dir="${FLEX_HOME}/frameworks/libs/air" append="true">
  67.         <include name="*.swc" />
  68.       </library-path>
  69.       <library-path dir="${FLEX_HOME}/frameworks/locale" append="true">
  70.         <include name="{locale}" />
  71.       </library-path>  
  72.     </mxmlc>
  73.   </target>
  74.  
  75.   <target name="distributable-air" description="Create the AIR package for our app"
  76.          depends="compile-as3-reader">
  77.     <!-- Packages the AS3Reader.swf into AS3Reader.air -->
  78.     <input addproperty="password" message="The password you used to sign the certificate"/>
  79.     <exec executable="${adt}" failonerror="true">
  80.       <arg line="-package -storetype pkcs12"/>
  81.       <arg line="-keystore ${basedir}/AS3Reader.pfx -storepass ${password}"/>
  82.       <arg line="AS3Reader.air ${src.dir}/AS3ReaderTest-app.xml ${out.dir}/AS3Reader.swf -C ${out.dir}" />
  83.     </exec>
  84.   </target>
  85.  
  86.   <target name="debug-air" description="Runs AIR debugger with our application" >
  87.     <!-- Use this for debugging -->
  88.     <exec executable="${adl}" failonerror="true">
  89.       <arg line="${src.dir}/AS3ReaderTest-app.xml -C ${basedir}" />
  90.     </exec>
  91.   </target>
  92. </project>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement