deploy flex with apache ant

35
Deploy Flex with Apache Ant Swiss Flash User Group (sfug) Zürich | 20. Januar 2009

Upload: achtgrad-ag

Post on 11-Jul-2015

2.912 views

Category:

Technology


22 download

TRANSCRIPT

Page 1: Deploy Flex with Apache Ant

DeployFlex withApache Ant

Swiss Flash User Group (sfug)

Zürich | 20. Januar 2009

Page 2: Deploy Flex with Apache Ant

Hello my name isAndreas Lorenz

dctrl - interactive media gmbh

Page 3: Deploy Flex with Apache Ant

1Ant OverviewThe basics

Page 4: Deploy Flex with Apache Ant

Without Ant

Page 5: Deploy Flex with Apache Ant

With Ant

Page 6: Deploy Flex with Apache Ant

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

Page 7: Deploy Flex with Apache Ant

Ant GoalsCreate a continuous integration basedbuild process:

• Centralized • Automated • Self-Testing

Page 8: Deploy Flex with Apache Ant

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

Page 9: Deploy Flex with Apache Ant

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

Page 10: Deploy Flex with Apache Ant

2Ant BasicsCreating Issues

Page 11: Deploy Flex with Apache Ant

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

Page 12: Deploy Flex with Apache Ant

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

Page 13: Deploy Flex with Apache Ant

3Ant StructureCreating Issues

Page 14: Deploy Flex with Apache Ant

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

Page 15: Deploy Flex with Apache Ant

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

Page 16: Deploy Flex with Apache Ant

build.properties

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

Referenced by ${var}

Page 17: Deploy Flex with Apache Ant

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

Page 18: Deploy Flex with Apache Ant

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>

Page 19: Deploy Flex with Apache Ant

Build output

Page 20: Deploy Flex with Apache Ant

<project>Root element

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

Page 21: Deploy Flex with Apache Ant

<project>Example:

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

Page 22: Deploy Flex with Apache Ant

<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}

Page 23: Deploy Flex with Apache Ant

<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>

Page 24: Deploy Flex with Apache Ant

<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

Page 25: Deploy Flex with Apache Ant

<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)

Page 26: Deploy Flex with Apache Ant

<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">

Page 27: Deploy Flex with Apache Ant

<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

Page 28: Deploy Flex with Apache Ant

<task>Example:

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

Page 29: Deploy Flex with Apache Ant

<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

Page 30: Deploy Flex with Apache Ant

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

FTPSVNMailFlexTasks

Page 31: Deploy Flex with Apache Ant

EventsAnt generates events as it executes:

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

Page 32: Deploy Flex with Apache Ant

4A Typical ProjectExamples

Page 33: Deploy Flex with Apache Ant

5Some more infosbefore you start your own

Page 34: Deploy Flex with Apache Ant

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

Page 35: Deploy Flex with Apache Ant

[email protected] , www.dctrl.ch

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