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. Nevertheless, Falcon The 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.
...
- 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 generate better bytecode for 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/trunk-falcon.git
. You can download it with any Subversion GIT client.
Binary Distributions
No binary distributions are available. Perhaps someone will volunteer to set up auotmated 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).
The Ant script downloads several third-party JARs. One third-party JAR must be installed as a prerequisite. See the README file for more information.
...
2 (Juno).
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 |
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 |
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 falconcompiler.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.
...
- 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.
...
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 they are very large and require more extensive legal 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.
...
Q: Where is the specification for ActionScript ByteCode (ABC)?
A: http://www.adobe.com/content/dam/Adobe/en/devnet/actionscript/articles/avm2overview.pdf
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