Compiling an Adobe Air Flex Project is almost the same as compiling a Flex project. However, after the project is compiled to a swf, you will need adl.exe to run/test your Adobe Air application and/or adt.bat to package the swf.

First compiling your Adobe Air project goes like this…

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
<target name="Build For Apollo">
        <mxmlc 
        	file="eva.mxml" 
        	output="${DEPLOY_DIR}/evaApollo.swf"
    		keep-generated-actionscript="true"
    		locale="nl_BE"
    	 >
            <load-config filename="${FLEX3_SDK}/frameworks/air-config.xml"/>
            <!-- Default Configuration File For Air
                 If you are using apollo, you will need apollo-config.xml
                 (Talk about these configuration files in another post) -->
            <source-path path-element="${FLEX3_SDK}/frameworks"/>
            <sp path-element="../locale/{locale}"/>
            <!-- List of SWC files or directories that contain SWC files. -->
            <compiler.library-path dir="${FLEX3_SDK}/frameworks/libs" append="true">
                <include name="*" />
            </compiler.library-path>
            <!-- Adobe Air Libraries -->
            <compiler.library-path dir="${FLEX3_SDK}/frameworks/libs/air" append="true"> 
                <include name="*" />
            </compiler.library-path>
            <!-- A framework library for my project -->
            <compiler.library-path dir="${EVAFRAMEWORKSWC}" append="true">
                <include name="EvaFrameWork.swc" />
            </compiler.library-path>
        </mxmlc> 
        <antcall target="Run EvaApollo"/>
    </target>

You’ll notice that you will have to copy some localization files from air to your locale folders of your project.

Running an Adobe Air Application (swf)…

1
2
3
4
5
	<target name="Run EvaApollo">
		<exec dir="${basedir}\..\flexBin" executable="${APOLLO_SDK}\bin\adl.exe" spawn="false">
			<arg value="application.xml"/>
		</exec>
	</target>

The application.xml is a configuration file you will need to edit for your application.

To package your Adobe Air Project, you’ll first need to create a certificate…

1
2
3
4
5
6
7
8
9
10
<target name="Create certificate EvaApollo">
		<exec dir="${basedir}\..\flexBin" executable="${APOLLO_SDK}\bin\adt.bat" spawn="false">
			<arg value="-certificate"/>
			<arg value="-cn"/>
			<arg value="eva"/>
			<arg value="2048-RSA"/>
			<arg value="eva.pfx"/>
			<arg value="johlero"/>
		</exec>
	</target>

Packaging…

1
2
3
4
5
6
7
8
9
10
11
12
	<target name="Package EvaApollo">
		<exec dir="${basedir}\..\flexBin" executable="${APOLLO_SDK}\bin\adt.bat" spawn="false">
			<arg value="-package"/>
			<arg value="-certificate"/>
			<arg value="eva.pfx"/>
			<arg value="-password"/>
			<arg value="johlero"/>
			<arg value="Eva.air"/>
			<arg value="application.xml"/>
			<arg value="evaApollo.swf"/>
		</exec>
	</target>

More info at :
http://labs.adobe.com/wiki/index.php/Flex_Ant_Tasks
http://livedocs.adobe.com/labs/air/1/devappsflex/CommandLineTools_1.html

Adios!

pixel Building Adobe Air Flex Project With Ant
No TweetBacks yet. (Be the first to Tweet this post)