Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Falcon is a new compiler for Flex

...

that is under development. It will eventually replace the legacy compiler that has been part of the Flex SDK.

Current Status

Falcon has completed a legal review at Adobe and is awaiting signature by the relevant Adobe Vice President, after which it will be donated to Apache.

Adobe donated the source code to the Falcon compiler as revision 1383121 on September 10, 2012. It currently lives at flex/falcon/trunk. A development branch at {flex/falcon/branches/develop}} will follow after the build scripts have been tested and debugged.

The ActionScript side of Falcon is near-shippable quality and was the basis for Flash Builder 4.7 Preview 1. The rest of Falcon (MXML, CSS, FXG, PROPERTIES) is pre-alpha quality and not ready for production use. NeverthelessThe ActionScript side of Falcon is of shipping quality and is the basis for Flash Builder 4.7. The rest of Falcon (MXML, CSS, FXG, PROPERTIES) is pre-alpha quality and not ready for production use. Nevertheless, Falcon already supports enough of MXML to compile a correctly-running version of Checkinapp, the test app that is part of the SDK. (Exception: Checkinapp uses one Repeater tag, which is not yet implemented.) The main areas where Falcon needs more work are databinding, states, MXML-specific error reporting, and ASDoc generation.

After donation, Gordon Smith of Adobe, who has worked on Falcon from the beginning of the Falcon project, is on loan to Apache Flex for one day a week to improve Falcon's MXML support, with the goal of making it a suitable replacement for the legacy compiler. He will provide advice to Apache developers contributing to Falcon. Alex Harui of Adobe has become familiar with MXML code generation in Falcon and can offer advice in that area.

...

  • Run the source code for all Apache Flex SWCs through Falcon to see if spurious problems are reported.
  • Update the source code as necessary, given the fact that Falcon is somewhat stricter than the legacy compiler. It should be possible to make both compilers happy.
  • Get various test apps besides Checkinapp compiling, linking against Falcon-compiled SWCs, and running correctly.
  • Get Mustella tests compiling with Falcon and passing.
  • Fix bugs that the Apache Flex community prioritizes.

Falcon's Original Goals

Compared with the legacy compiler, Falcon had the following goals when the project was started:. Compared with the legacy compiler,

  • It should compile faster for both full and incremental compiles, especially for multi-project workspaces.
  • It should require less memory, especially for multi-project workspaces.
  • It should be useful as a code-intelligence engine and incremental compiler for an integrated development environment, and not just as a command-line compiler.
  • It should have a design that is easy to understand and to evolve.
  • It should generatge generate better bytecode for better improved runtime performance.

Source Code

The Falcon trunk will soon be 'develop' branch is now available in Apache's Subversion GIT repository at https://svngit-wip-us.apache.org/repos/asf/incubator/flex/falcon/trunkImage Removed-falcon.git. You can download it with any Subversion client.

...

GIT client.

Binary Distributions

No binary distributions are available. Perhaps someone will volunteer to set up automated builds and a build download page?

Setup for Falcon

Falcon is written in Java 1.6. Its build scripts use Ant 1.7.1. Eclipse projects for development use Eclipse 4.2 (Juno).

Information about Ant targets will be available by the time of donation.

All the compiled Java classes that comprise Falcon are packaged as falcon.jar. It is generated at generated/dist/sdk/lib. Other JAR files such as falcon-mxmlc.jar and falcon-compc.jar are codeless launcher JARs which serve only to run a particular entry point within Falcon. Launchers such as the shell script mxmlc or the batch file mxmlc.bat simply run these launch JARs from the command line.

Because Falcon requires a number of other files (such as flex-config.xml, framework.swc, etc.) to compile anything, the Falcon build script actually creates a small SDK in which everything is arranged so that tools like Falcon's mxmlc work the way they would if they were in an actual Apache Flex SDK. This "Falcon SDK" is built at generated/dist/sdk.

Using Falcon

On the Command Line

The bin folder inside generated/dist/sdk has the command-line launchers like mxmlc, so using Falcon is the same as you are used to. For example, if you have but this bin directory on your PATH and you have cd'd to you application directory, then you just do

No Format

mxmlc MyApp.mxml

You must obtain JFlex 1.4.3 as a prerequisite and set the environment variable JFLEX_JAR to point to JFlex.jar. You can obtain JFlex here.

Building Falcon

The top-level Ant script currently has the following targets:

Target

Purpose

javadoc

Builds Falcon's Javadoc at generated/javadoc.

eclipse

Prepares or updates the project for use in Eclipse. This takes care of generating the Java code for the lexers, parsers, and BURMs.

main (default)

Produces an SDK at generated/dist/sdk containing both Falcon and the legacy compiler.

clean

Cleans the build output but leaves any downloaded JARs.

wipe

Wipes out everything that didn't come from GIT.

The main, eclipse, or javadoc target will do a one-time download of five third party JARs:

  • lib/antlr.jar
  • lib/commons-cli.jar
  • lib/commons-io.jar
  • lib/guava.jar
  • lib/lzma-sdk.jar

Occasionally one of these downloads hangs. Just interrupt Ant and try again. These JARs will remain in the lib directory until you do a wipe.

If you do ant -q main (where the -q switch means "quiet" and turns off a lot of noisy output), the output the first time should look like this:

No Format

$ ant -q
    [echo] JFLEX_JAR is d:/jflex-1.4.3/jflex/lib/JFlex.jar
    [echo] Obtaining lib/antlr.jar
    [echo] Obtaining lib/commons-cli.jar
    [echo] Obtaining lib/commons-io.jar
    [echo] Obtaining lib/guava.jar
    [echo] Obtaining lib/jburg.jar
    [echo] Obtaining lib/lzma.jar
    [echo] Building lib/lzma.jar
    [echo] Generating RawASTokenizer
    [echo] Generating RawASDocTokenizer
    [echo] Generating RawMXMLTokenizer
    [echo] Generating ASParser and ASTokenTypes
   [antlr] ANTLR Parser Generator   Version 2.7.7 (20060906)   1989-2005
    [echo] Generating MetadataParser and MetadataTokenTypes
   [antlr] ANTLR Parser Generator   Version 2.7.7 (20060906)   1989-2005
    [echo] Generating CSSLexer and CSSParser
    [echo] Generating CSSTree
    [echo] Generating CmcEmitter
    [echo] Generating CSSEmitter
    [echo] Compiling Java code
    [echo] Creating generated/dist/sdk/lib/compiler.jar
    [echo] Creating generated/dist/sdk/lib/falcon-asc.jar
    [echo] Creating generated/dist/sdk/lib/falcon-mxmlc.jar
    [echo] Creating generated/dist/sdk/lib/falcon-compc.jar
    [echo] Creating generated/dist/sdk/lib/falcon-optimizer.jar
    [echo] Creating generated/dist/sdk/lib/falcon-swfdump.jar
    [echo] Creating lib/aet.jar
    [echo] Creating generated/dist/sdk/lib/flexTasks.jar
    [echo] Copying Apache SDK
    [echo] Building support.swc
    [echo] compiler main completed on 09/14/2012 11:32:37 PM

BUILD SUCCESSFUL
Total time: 1 minute 16 seconds

From this you can see that the overall flow of the build is

  • Download the necessary third-party JAR files.
  • Generate Java-based lexer classes from JFlex .lex files, Java-based parser classes from ANTLR .g files, and Java-based BURM classes from JBurg .jbg files.
  • Compile the Java code (both the code that's in GIT and the lexers/parsers/BURMs that are generated by the previous step).
  • Create the JAR files that are the Falcon deliverables.
  • Create a SWC file that needs to be used when compiling Flex with Falcon (because Falcon generates different code for CSS than the old compiler).

All the compiled Java classes that comprise Falcon are packaged as compiler.jar, which is generated at generated/dist/sdk/lib. Other JAR files such as falcon-mxmlc.jar and falcon-compc.jar are codeless launcher JARs which serve only to run a particular entry point within Falcon. Launchers such as the shell script mxmlc or the batch file mxmlc.bat simply run these launch JARs from the command line.

Because Falcon requires a number of other files (such as flex-config.xml, framework.swc, etc.) to compile anything, the Falcon build script actually creates a small SDK in which everything is arranged so that tools like Falcon's mxmlc work the way they would if they were in an actual Apache Flex SDK. This "Falcon SDK" is built at generated/dist/sdk.

Committing to Falcon

Each commit to the trunk will be expected to:

  • Keep the Java warnings in the Eclipse project(s) at 0.
  • Keep the 'ant javadoc' warnings at 0.
  • Provide Javadoc for new non-private APIs.
  • Not change the public API surface (to ease possible re-integration into Flash Builder).
  • Pass whatever tests are part of ant tests, once we have some tests.

Using Falcon

On the Command Line

The bin folder inside generated/dist/sdk has the command-line launchers like mxmlc, so using Falcon is the same as you are used to. For example, if you have but this bin directory on your PATH and you have cd'd to you application directory, then you just do

No Format

mxmlc MyApp.mxml

The options to the Falcon version of mxmlc are basically the same as for the legacy compiler. Some options such as -keep are no longer supported. If you try use an unsupported options, a warning will let you know.

In an Ant Script

Like the legacy compiler, Falcon provides <mxmlc> and <compc> Ant tasks. They are implemented by the classes MXMLCTask and COMPCTask in the org.apache.flex.compiler.ant package. These classes are part of falcon.jar. To use these tasks in an Ant script, first do

No Format

<taskdef ???/>

The require that the Ant property FLEX_HOME be set to a Flex SDK directory so that config files and SWC files can be foundThe options to the Falcon version of mxmlc are basically the same as for the legacy compiler. Some options such as -keep are no longer supported. If you try use an unsupported options, a warning will let you know.

Inside Eclipse

The relevant entry points for a Debug Configuration are the MXMLC and COMPC classes in the comorg.adobeapache.flashflex.compiler.clients package.

...

There is no way to use Apache Falcon inside of Flash Builder, at least for now. Because Falcon is designed to be both a compiler and a code-intelligence engine, it has to be tightly integrated with Flash Builder; Flash Builder cannot load it from an SDK.

Testing Falcon

Test suites for Falcon Falcon's existing test suites are not yet ready for donation, because they require more extensive legal review. They will be donated laterare very large and require more extensive review. They will be donated later.

As soon as possible after donation, a handful of tests will be developed to ensure that are still able to compile framework.swc and Checkinapp. These make poor unit tests but reasonable functional tests.

Javadoc

Falcon has reasonably extensive Javadoc, including a short overview and package-level documentation that provides a general orientation to various subsystems. The Javadoc is not currently available online. If we get an automated build for Falcon, we may start posting Javadoc.

To build itthe Javadoc, download the source code and do

...

Q: Where is the specification for ActionScript ByteCode (ABC)?

A: http://www.adobe.com/content/dam/Adobe/en/devnet/actionscript/articles/avm2overview.pdfImage Removed

Q: What is a semantic checker?

...

A: Falcon does constant propagation and inlining.

Aditional Information about Falcon and FalconJS

Open Discussion about Falcon and FalconJS
Adobe announces important changes to Flex SDK