Successfully reported this slideshow.

SFUG: Deploy Flex with Apache ANT

489 views

Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

SFUG: Deploy Flex with Apache ANT

  1. 1. DeployFlex withApache AntSwiss Flash User Group (sfug)Zürich | 20. Januar 2009
  2. 2. Hello my name isAndreas Lorenzdctrl - interactive media gmbh
  3. 3. 1Ant OverviewThe basics
  4. 4. Without Ant
  5. 5. With Ant
  6. 6. What is Ant?1. An XML based custom build tool2. Open source & well documented3. Standardized & widely used4. Implemented in Java5. Platform independent
  7. 7. Ant GoalsCreate a continuous integration basedbuild process: • Centralized • Automated • Self-Testing
  8. 8. Usage1. Don‘t do work you‘ve already done2. Do alot of tasks once3. Prevent Mistakes
  9. 9. 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
  10. 10. 2Ant BasicsCreating Issues
  11. 11. Installing Ant1. http://ant.apache.org2. Bundled with IDE‘s like Eclipse
  12. 12. Directory structure/ project / ant / build / dist / html-template / src
  13. 13. 3Ant StructureCreating Issues
  14. 14. Files1. Build file «build.xml»2. Main property file «build.properties»3. Local property file «build.mac.properties»
  15. 15. build.properties1. Separate data from the process2. Configuration file3. Re-usability4. Not under SVN
  16. 16. build.propertiesReferenced by ${var}# default pathesmain.path = dctrl/projectsrc.path = ${ main.path}/ src
  17. 17. build.xml1. One «build.xml» file per project2. Each build use targets3. Each target use tasks4. Each task has properties
  18. 18. 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>
  19. 19. Build output
  20. 20. <project>Root element4 attributes: 1. name - projectname (optional) 2. basedir - reference (optional) 3. default - target (required) 4. description - info (optional)
  21. 21. <project>Example:<project name=”hello” default=”main” basedir=”.” description=“standard build“>
  22. 22. <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}
  23. 23. <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>
  24. 24. <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
  25. 25. <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)
  26. 26. <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">
  27. 27. <task>1. Ant built-in Java commands (tasks)2. Additional tasks like flexTasks (JAR files)3. Custom Java commands4. Independent executed code5. Wrapped in a <target>6. Can have multiple attributes
  28. 28. <task>Example:<target name="compile" depends="init"> <!- - Compile the java code - -> <javac srcdir="${src}" destdir="${build}"/></target>
  29. 29. <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
  30. 30. <task>Optional tasks (must install JAR files):FTPSVNMailFlexTasks
  31. 31. EventsAnt generates events as it executes:1. Build started/finished2. Target Build started/finished3. Task Build started/finished4. Message logged
  32. 32. 4A Typical ProjectExamples
  33. 33. 5Some more infosbefore you start your own
  34. 34. 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.htmlApache Ant 1.5 Manual: http://jakarta.apache.org/ant/manual/index.htmlFlex Ant Tasks: http://labs.adobe.com/wiki/index.php/Flex_Ant_Tasks
  35. 35. Thanks!al@dctrl.ch , www.dctrl.chwww.slideshare.net/dctrl/deploy-flex-with-apache-ant-presentation

×