Datasheet

Luchner c01.tex V3 - 03/20/2008 2:29pm Page 19
Chapter 1: The Development Environment
</exec>
</target>
<target name="package" if="do.package" depends="compile"
description="Packages AIR application.">
<antcall target="create.certificate" />
<java jar="${adt.jar}" fork="true" failonerror="true"
inputstring="${cert.pass}">
<arg value="-package" />
<arg value="-storetype" />
<arg value="${store.type}" />
<arg value="-keystore" />
<arg value="${cert.name}" />
<arg value="${app.name}.air" />
<arg value="${desc.name}.xml" />
<arg value="${app.name}.swf" />
</java>
</target>
<target name="create.certificate" if="do.package"
description="Creates self signed certificate.">
<java jar="${adt.jar}" fork="true" failonerror="true">
<arg value="-certificate" />
<arg value="-cn" />
<arg value="${app.name}" />
<arg value="${cert.type}" />
<arg value="${cert.name}" />
<arg value="${cert.pass}" />
</java>
</target>
</project>
2. Save the file as
build.xml
in the development directory of the Hello World project.
Three main execution tasks are associated with the ANT build file:
compile
,
launch
,and
package
.The
type of task to run depends on the user input of the
taskInput
task. The
compile
task is always called,
as the success of the
launch
and
package
tasks depends on the existence of a generated SWF file.
Along with these three main tasks that can be run based upon input is a task to create a self-signed
certificate prior to packaging, and a task to set property values based on the operating system. The
init
task is run in order to set the OS-specific properties needed for running the command-line tools of the
Flex 3 SDK. To run a .
bat
file within the
exec
ANT task on Windows, the extension needs to be included.
On Mac OS X, the name of the file is sufficient. In order to run the ADT using the
java
directive, the path
to the .
jar
file is needed. As such, a
condition
task is run to evaluate the correct path based on your
operating system.
To run this build, open a command prompt, navigate to the development directory, and enter the follow-
ing command:
>ant
19