sfug: deploy flex with apache ant

Post on 09-May-2015

209 Views

Category:

Technology

1 Downloads

Preview:

Click to see full reader

TRANSCRIPT

DeployFlex withApache Ant

Swiss Flash User Group (sfug)

Zürich | 20. Januar 2009

Hello my name isAndreas Lorenz

dctrl - interactive media gmbh

1Ant OverviewThe basics

Without Ant

With Ant

What is Ant?1. An XML based custom build tool2. Open source & well documented3. Standardized & widely used4. Implemented in Java5. Platform independent

Ant GoalsCreate a continuous integration basedbuild process:

• Centralized • Automated • Self-Testing

Usage1. Don‘t do work you‘ve already done2. Do alot of tasks once3. Prevent Mistakes

What Ant can do1. Build swf2. Do UnitTest‘s3. Generate ASDoc‘s & SWC Files4. Build template files5. Combine Flex projects, modules, assets6. Copy, zip, ftp, svn7. Source distribution

2Ant BasicsCreating Issues

Installing Ant1. http://ant.apache.org2. Bundled with IDE‘s like Eclipse

Directory structure/ project / ant / build / dist / html-template / src

3Ant StructureCreating Issues

Files1. Build file «build.xml»2. Main property file «build.properties»3. Local property file «build.mac.properties»

build.properties1. Separate data from the process2. Configuration file3. Re-usability4. Not under SVN

build.properties

# default pathes main.path = dctrl/project src.path = ${ main.path}/ src

Referenced by ${var}

build.xml1. One «build.xml» file per project2. Each build use targets3. Each target use tasks4. Each task has properties

build.xml structureExample:

<project name="example" default="hello" basedir="."> <property name="string.var" value="Hello World"/> <target name="hello"> <echo message="${string.var}" /> </target></project>

Build output

<project>Root element

4 attributes: 1. name - projectname (optional) 2. basedir - reference (optional) 3. default - target (required) 4. description - info (optional)

<project>Example:

<project name=”hello” default=”main” basedir=”.” description=“standard build“>

<property>1. User defined variables2. Case sensitive3. Defined in build.xml or build.properties4. Reference by ${var}5. System properties ${os.name}6. Built-in properties ${ant.java.version}

<property>Example:

<property file="build.properties" /><property name="compile.debug" value="true"/>

<echo>The main path is ${ main.path }</echo><echo>The debug state is ${ compile.debug }</echo>

<target>1. A <project> has one or more <target>2. Wrapper for a sequences of actions (tasks)3. Can depend on other <target>4. Executes only once

<target>5 attributes: 1. name - target reference 2. depends - other targets (optional) 3. if - conditional (optional) 4. unless - converse of if (optional) 5. description - info (optional)

<target>Example:<target name="jar" depends="compile" description="create a Jar file for the application">

<target name="jar" if="gui_ready">

<target name="jar" unless="gui_ready">

<task>1. Ant built-in Java commands (tasks)2. Additional tasks like flexTasks (JAR files)3. Custom Java commands4. Independent executed code 5. Wrapped in a <target> 6. Can have multiple attributes

<task>Example:

<target name="compile" depends="init"> <!- - Compile the java code - -> <javac srcdir="${src}" destdir="${build}"/> </target>

<task>Ant built-in tasks:

Ant Exec GZip Replace UnzipAntCall ExecOn Jar Style ZipAvailable Fail Mail TarCopy Filter Mkdir TaskdefDelete Get Move TouchEcho GUnzip Property Tstamp

<task>Optional tasks (must install JAR files):

FTPSVNMailFlexTasks

EventsAnt generates events as it executes:

1. Build started/finished2. Target Build started/finished3. Task Build started/finished4. Message logged

4A Typical ProjectExamples

5Some more infosbefore you start your own

ResourcesHomepage: http://ant.apache.orgUser Manual: http://jakarta.apache.org/ant/manual/index.htmlWiki: http://wiki.apache.org/ant/FrontPageFAQ: http://ant.apache.org/faq.htmlBooks: http://sourceforge.net/projects/antbookApache Ant Resources: http://jakarta.apache.org/ant/resources.html Apache Ant 1.5 Manual: http://jakarta.apache.org/ant/manual/index.htmlFlex Ant Tasks: http://labs.adobe.com/wiki/index.php/Flex_Ant_Tasks

Thanks!al@dctrl.ch , www.dctrl.ch

www.slideshare.net/dctrl/deploy-flex-with-apache-ant-presentation

top related