deploy flex with apache ant
TRANSCRIPT
![Page 1: Deploy Flex with Apache Ant](https://reader034.vdocuments.site/reader034/viewer/2022042614/55a0fa261a28ab90398b474d/html5/thumbnails/1.jpg)
DeployFlex withApache Ant
Swiss Flash User Group (sfug)
Zürich | 20. Januar 2009
![Page 2: Deploy Flex with Apache Ant](https://reader034.vdocuments.site/reader034/viewer/2022042614/55a0fa261a28ab90398b474d/html5/thumbnails/2.jpg)
Hello my name isAndreas Lorenz
dctrl - interactive media gmbh
![Page 3: Deploy Flex with Apache Ant](https://reader034.vdocuments.site/reader034/viewer/2022042614/55a0fa261a28ab90398b474d/html5/thumbnails/3.jpg)
1Ant OverviewThe basics
![Page 4: Deploy Flex with Apache Ant](https://reader034.vdocuments.site/reader034/viewer/2022042614/55a0fa261a28ab90398b474d/html5/thumbnails/4.jpg)
Without Ant
![Page 5: Deploy Flex with Apache Ant](https://reader034.vdocuments.site/reader034/viewer/2022042614/55a0fa261a28ab90398b474d/html5/thumbnails/5.jpg)
With Ant
![Page 6: Deploy Flex with Apache Ant](https://reader034.vdocuments.site/reader034/viewer/2022042614/55a0fa261a28ab90398b474d/html5/thumbnails/6.jpg)
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](https://reader034.vdocuments.site/reader034/viewer/2022042614/55a0fa261a28ab90398b474d/html5/thumbnails/7.jpg)
Ant GoalsCreate a continuous integration basedbuild process:
• Centralized • Automated • Self-Testing
![Page 8: Deploy Flex with Apache Ant](https://reader034.vdocuments.site/reader034/viewer/2022042614/55a0fa261a28ab90398b474d/html5/thumbnails/8.jpg)
Usage1. Don‘t do work you‘ve already done2. Do alot of tasks once3. Prevent Mistakes
![Page 9: Deploy Flex with Apache Ant](https://reader034.vdocuments.site/reader034/viewer/2022042614/55a0fa261a28ab90398b474d/html5/thumbnails/9.jpg)
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](https://reader034.vdocuments.site/reader034/viewer/2022042614/55a0fa261a28ab90398b474d/html5/thumbnails/10.jpg)
2Ant BasicsCreating Issues
![Page 11: Deploy Flex with Apache Ant](https://reader034.vdocuments.site/reader034/viewer/2022042614/55a0fa261a28ab90398b474d/html5/thumbnails/11.jpg)
Installing Ant1. http://ant.apache.org2. Bundled with IDE‘s like Eclipse
![Page 12: Deploy Flex with Apache Ant](https://reader034.vdocuments.site/reader034/viewer/2022042614/55a0fa261a28ab90398b474d/html5/thumbnails/12.jpg)
Directory structure/ project / ant / build / dist / html-template / src
![Page 13: Deploy Flex with Apache Ant](https://reader034.vdocuments.site/reader034/viewer/2022042614/55a0fa261a28ab90398b474d/html5/thumbnails/13.jpg)
3Ant StructureCreating Issues
![Page 14: Deploy Flex with Apache Ant](https://reader034.vdocuments.site/reader034/viewer/2022042614/55a0fa261a28ab90398b474d/html5/thumbnails/14.jpg)
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](https://reader034.vdocuments.site/reader034/viewer/2022042614/55a0fa261a28ab90398b474d/html5/thumbnails/15.jpg)
build.properties1. Separate data from the process2. Configuration file3. Re-usability4. Not under SVN
![Page 16: Deploy Flex with Apache Ant](https://reader034.vdocuments.site/reader034/viewer/2022042614/55a0fa261a28ab90398b474d/html5/thumbnails/16.jpg)
build.properties
# default pathes main.path = dctrl/project src.path = ${ main.path}/ src
Referenced by ${var}
![Page 17: Deploy Flex with Apache Ant](https://reader034.vdocuments.site/reader034/viewer/2022042614/55a0fa261a28ab90398b474d/html5/thumbnails/17.jpg)
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](https://reader034.vdocuments.site/reader034/viewer/2022042614/55a0fa261a28ab90398b474d/html5/thumbnails/18.jpg)
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](https://reader034.vdocuments.site/reader034/viewer/2022042614/55a0fa261a28ab90398b474d/html5/thumbnails/19.jpg)
Build output
![Page 20: Deploy Flex with Apache Ant](https://reader034.vdocuments.site/reader034/viewer/2022042614/55a0fa261a28ab90398b474d/html5/thumbnails/20.jpg)
<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](https://reader034.vdocuments.site/reader034/viewer/2022042614/55a0fa261a28ab90398b474d/html5/thumbnails/21.jpg)
<project>Example:
<project name=”hello” default=”main” basedir=”.” description=“standard build“>
![Page 22: Deploy Flex with Apache Ant](https://reader034.vdocuments.site/reader034/viewer/2022042614/55a0fa261a28ab90398b474d/html5/thumbnails/22.jpg)
<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](https://reader034.vdocuments.site/reader034/viewer/2022042614/55a0fa261a28ab90398b474d/html5/thumbnails/23.jpg)
<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](https://reader034.vdocuments.site/reader034/viewer/2022042614/55a0fa261a28ab90398b474d/html5/thumbnails/24.jpg)
<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](https://reader034.vdocuments.site/reader034/viewer/2022042614/55a0fa261a28ab90398b474d/html5/thumbnails/25.jpg)
<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](https://reader034.vdocuments.site/reader034/viewer/2022042614/55a0fa261a28ab90398b474d/html5/thumbnails/26.jpg)
<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](https://reader034.vdocuments.site/reader034/viewer/2022042614/55a0fa261a28ab90398b474d/html5/thumbnails/27.jpg)
<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](https://reader034.vdocuments.site/reader034/viewer/2022042614/55a0fa261a28ab90398b474d/html5/thumbnails/28.jpg)
<task>Example:
<target name="compile" depends="init"> <!- - Compile the java code - -> <javac srcdir="${src}" destdir="${build}"/> </target>
![Page 29: Deploy Flex with Apache Ant](https://reader034.vdocuments.site/reader034/viewer/2022042614/55a0fa261a28ab90398b474d/html5/thumbnails/29.jpg)
<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](https://reader034.vdocuments.site/reader034/viewer/2022042614/55a0fa261a28ab90398b474d/html5/thumbnails/30.jpg)
<task>Optional tasks (must install JAR files):
FTPSVNMailFlexTasks
![Page 31: Deploy Flex with Apache Ant](https://reader034.vdocuments.site/reader034/viewer/2022042614/55a0fa261a28ab90398b474d/html5/thumbnails/31.jpg)
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](https://reader034.vdocuments.site/reader034/viewer/2022042614/55a0fa261a28ab90398b474d/html5/thumbnails/32.jpg)
4A Typical ProjectExamples
![Page 33: Deploy Flex with Apache Ant](https://reader034.vdocuments.site/reader034/viewer/2022042614/55a0fa261a28ab90398b474d/html5/thumbnails/33.jpg)
5Some more infosbefore you start your own
![Page 34: Deploy Flex with Apache Ant](https://reader034.vdocuments.site/reader034/viewer/2022042614/55a0fa261a28ab90398b474d/html5/thumbnails/34.jpg)
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