Sunday, February 13, 2011

How to build the Flex SDK

Gigantt's UI is built with Adobe Flex 4.1. It's a great web development SDK, but Adobe is notoriously slow to respond to bug reports. So sometimes we find ourselves having to go into the Flex SDK's source code in order to debug stuff or work around bugs. In order to fix a bug in mx:DateField today I had to download and build the SDK (which is open source) from Adobe.
It's not hard, but I thought I'd share the how-to with the world:




How to build the Flex SDK on Windows
(based on Windows 7 64-bit)

Prerequisites
  • Java - You'll need the JDK, not just the JRE (the runtime which comes with Flash Builder, for example).
    • I used the 64 bit version:
      "c:\Program Files\Java\jdk1.6.0_23" 
  • Ant - You can download the binaries: http://ant.apache.org/bindownload.cgi
    • I used 1.8.2
    • Just unzip it to c:\dev\ant
  • Flex open-source SDK
    • I used 4.1.0.16076
    • Unzip it to c:\dev\sdk (just for simplcity)
Building
  1. Let's create a batch file to set some useful envars: envars.bat
    set JAVA_HOME=c:\Program Files\Java\jdk1.6.0_23
    set PATH=c:\dev\ant\bin;%PATH%
    set ANT_OPTS=-Xmx256m
    1. Open cmd.exe and run it...
  2. Edit c:\dev\sdk\frameworks\build.xml 
    1. Look for:
      <target name="datavisualization" description="Builds datavisualization.swc">
    2. And fix the location of the manifest file from:
      "${datavis.dir}/manifest.xml" to:
      "${datavis.dir}/manifest_datavisualization.xml"
  3. Run Ant:c:\dev\sdk\frameworks> ant
    1. It should end with such a message: BUILD SUCCESSFUL
  4. Now let's tell Flash Builder where to find this new SDK: c:\dev\sdk 
    1. Add it to the "Installed SDKs" settings in Flash Builder
    2. Make sure your project is configured to use this SDK (it was probably created with the original one and still refers to it).
  5. Rebuild your project. It should work.

No comments:

Post a Comment