Top Banner
Ian McLean Con$nuous Build Systems: Start to Finish Thursday, December 17, 2009
34
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Continuous Build Systems Start to Finish

Ian  McLean      

Con$nuous  Build  Systems:  Start  to  Finish

Thursday, December 17, 2009

Page 2: Continuous Build Systems Start to Finish

Who  is  this  guy?

Me  Now:• Flex  since  2005.• Flash  for  much  longer.• Currently  a  minion  for  the  evil  internet  ad  syndicate.

Also  me:• Background  in  engineering,  game  development.• I  write  dance  music  {150,  170}  bpm• I  like  kung  fu• Fluent  in  Japanese  when  drunk  enough.

Thursday, December 17, 2009

Page 3: Continuous Build Systems Start to Finish

Build  Systems  FTW!!

Thursday, December 17, 2009

Page 4: Continuous Build Systems Start to Finish

Two  parts

One  Part  Build  Automa$onScripted  build  process  (think  “Make”  scripts)

One  Part  Build  Management•Scheduling  and  build  execu$on    •Repor$ng  on  build  status•Maintaining  history

Most  importantly,make  builds  results  readily  available!

Thursday, December 17, 2009

Page 5: Continuous Build Systems Start to Finish

Benefits

Internal• Automate  complex  tasks• Know  when  builds  really  fail

• Compiler  errors• Test  failures

External•   Visibility  into  the  project.

Yes,  stakeholders  can  monitor  your  progress!(WARNING:  You  may  or  not  want  this)

Thursday, December 17, 2009

Page 6: Continuous Build Systems Start to Finish

Some$mes  presenta$ons  use  diagrams

Thursday, December 17, 2009

Page 7: Continuous Build Systems Start to Finish

Other  common  tasks

• Running  unit  tests

• Crea>ng  documenta>on

• Packaging

• Produc>on  Deployment

Thursday, December 17, 2009

Page 8: Continuous Build Systems Start to Finish

Popular  Build  Systems

Commercial:

• Atlassian  Bamboo

Open  Source:

• Hudson,  Apache  Con>nuum

• CruiseControl

– Flexible

– Lots  of  func>onality

– A  much  higher  learning  curve

Thursday, December 17, 2009

Page 9: Continuous Build Systems Start to Finish

Common  build  automa>on  tools

Apache  Ant

Apache  Maven•   -­‐Similar  to  Ant

•   -­‐Enforces  good/standard  project  structure

…We’ll  be  looking  at  Ant.

Thursday, December 17, 2009

Page 10: Continuous Build Systems Start to Finish

How  does  it  work  with  Flex?

A  Couple  of  op>ons:

• Manually  execute  Flex  compiler  binaries

• Use  Flex  Ant  tasks– Provides  MXMLC  and  COMPC  tasks

Thursday, December 17, 2009

Page 11: Continuous Build Systems Start to Finish

A  build  script  from  scratch

• Step  one:  Write  targets  for  the  following

1. Define  paths  and  proper$es2. Clean3. SCM  update4. Build  target  (mxmlc)5. Run  tests  (FlexUnit)6. Handle  applica$on  versioning/update  system7. Package  target  (adt)8. Generate  documenta$on  (AsDoc)9. Deploy  to  produc$on

• Step  two:  – Say  goodbye  to  your  sanity

Thursday, December 17, 2009

Page 12: Continuous Build Systems Start to Finish

Antennae  is  your  friend

• Antennae– Flex/Air  Build  automa>on  scripts– h_p://code.google.com/p/antennae/

Capabili>es  (to  name  a  few):– Compile  SWF/SWC/AIR– Compile  Java– Run  tests– ASDoc  genera>on

Thursday, December 17, 2009

Page 13: Continuous Build Systems Start to Finish

Demo  

Building  Flex  and  AIR  with  Antennae

Thursday, December 17, 2009

Page 14: Continuous Build Systems Start to Finish

AIR  building  >ps

Just  use  the  Antennae  AIR  template.

Tips:

• Don’t  forget  to  set    <content>mySwf.swf</content>in  AIR  applica$on  descriptor  xml– FlashBuilder  automa$cally  does  this,  Antennae  doesn’t

• Build.xml  has  mul$ple  targets– Build,  stage,  package,  run– You’ll  need  to  manually  call  what  you  want

Thursday, December 17, 2009

Page 15: Continuous Build Systems Start to Finish

 CruiseControl  Concepts

BootstapperA  Task  that  runs  before  each  aeempted  build

Scheduler:  Specifies  when  build  aeempts  run

Modifica4onSetAllows  the  execu$on  of  builds  if  changes  are  detected

Ar4factsThe  file  to  download  when  the  build  succeeds

Thursday, December 17, 2009

Page 16: Continuous Build Systems Start to Finish

Demo  

Cruisecontrol  overview

Thursday, December 17, 2009

Page 17: Continuous Build Systems Start to Finish

Build  on  SVN  Commit

Use  SvnAnt  or  manually  exec  svn

In  CruiseControl

• Configure  a  SVN  modifica>on  set

• Call  svn  update  in  bootstrapper

Thursday, December 17, 2009

Page 18: Continuous Build Systems Start to Finish

Demo  

Cruisecontrol  Install  +  svn  integra$on  

Thursday, December 17, 2009

Page 19: Continuous Build Systems Start to Finish

Configuring  other  build  intervals

Op#ons:  Weekly,  Nightly,  Hourly  etc…

• In  config.xml

<project requireModification = false>

• Specify  

<schedule interval=“?”>

• Note:  You  must  have  a  modifica#on  set  tag  despite  not  requiring  modifica#on  

Thursday, December 17, 2009

Page 20: Continuous Build Systems Start to Finish

Unit  Tes>ng

• FlexUnit– Flex  Unit  tes>ng  framework• Based  on  JUnit

• Use  Antennae  tes>ng  templates

What  Antennae  doesn’t  do:– No  support  for  FlexUnit4

Thursday, December 17, 2009

Page 21: Continuous Build Systems Start to Finish

Demo  

Running  tests  with  Antennae

Thursday, December 17, 2009

Page 22: Continuous Build Systems Start to Finish

Produc>on  deploy

• Copy  the  output  file  to  your  web  server

• Use  the  <copy>  or  <gp>  tasks

Thursday, December 17, 2009

Page 23: Continuous Build Systems Start to Finish

Demo  

Produc$on  deploy

Thursday, December 17, 2009

Page 24: Continuous Build Systems Start to Finish

Asdoc  genera>on

• Put  AsDoc  comments  in  code

• Add  the  Antennae  “asdoc”  target  to  your  build  script

• You  can  use  <artifactspublisher> to  make  docs  available  in  CruiseControl

Thursday, December 17, 2009

Page 25: Continuous Build Systems Start to Finish

Demo  

AsDoc  genera$on

Thursday, December 17, 2009

Page 26: Continuous Build Systems Start to Finish

Version  Tracking  in  Ant

• Use  the  <buildnumber>  task

• Set  your  applica>on  version  property

Thursday, December 17, 2009

Page 27: Continuous Build Systems Start to Finish

Sekng  the  version  in  AIR

• Create  applica>on  descriptor  template  with  tokens

• Use  <replace>  tokens  with  fill  values

*You  can  hand  edit  build.num  file  if  its  out  of  sync  with  CruiseControl

Thursday, December 17, 2009

Page 28: Continuous Build Systems Start to Finish

Demo  

Building  version  info  into  AIR  app

Thursday, December 17, 2009

Page 29: Continuous Build Systems Start to Finish

Display  version  in  SWF

Only  slightly  different:

• Deploy  build.num  file  with  swf

• Load  its  contents  with  URLoader()  

Thursday, December 17, 2009

Page 30: Continuous Build Systems Start to Finish

Auto-­‐upda>ng  AIR  apps  for  QA  

1. Deploy  your  build.num  to  a  server

2. Load  value  in  from  AIR

3. Use  AIR  update  manager  to  update  (if  outdated)

Note:  not  recommended  for  official  releases

Thursday, December 17, 2009

Page 31: Continuous Build Systems Start to Finish

Gekng  no>fica>ons

• Email– People  don’t  like  this

• CCTray  (WIN)

• CCMenu  (OSX)

• AirBob  (Yup,  AIR  based)

Thursday, December 17, 2009

Page 32: Continuous Build Systems Start to Finish

General  >ps

• Run  CC  in  a  console  for  tes>ng

• Test  your  ant  scripts  from  the  command  line  BEFORE  running  them  in  CruiseControl

Thursday, December 17, 2009

Page 33: Continuous Build Systems Start to Finish

Shameless-­‐plug

“Flex  based  Workflow  tools  for  the  Flash  IDE”

Adobe  MAX

Tuesday  at  1:30  pm

511C

Be  there  or  be  somewhere  else!  (En#rely  up  to  you  really)

Thursday, December 17, 2009

Page 34: Continuous Build Systems Start to Finish

@ianmclean

[email protected]

h_p://devote.your.life.auricom.comThursday, December 17, 2009