Flex Compiler Shell
From Adobe Labs
NOTE: This shell is meant for Flex 2.0.1. The most up-to-date version is part of Flex 3 and can be found with the Flex 3 SDK.
| Table of contents |
Introduction to fcsh
The fcsh (Flex Compiler Shell) utility provides a shell environment that you use to compile Flex applications, modules, and component libraries. It works very similarly to the mxmlc and compc command line compilers, but it compiles faster than the mxmlc and compc command-line compilers. One reason is that by keeping everything in memory, fcsh eliminates the overhead of launching the JVM and loading the compiler classes. Another reason is that compilation results (for example, type information) can be kept in memory for subsequent compilations.
This utility is intended to improve the experience of users of the command-line compilers. If you are using Flex Builder, you do not need to use fcsh. The Flex Builder tool already uses the optimizations provided by fcsh.
For simple applications, fcsh might not be necessary. But for more complex applications that you compile frequently, you should experience a significant performance improvement over using the mxmlc and compc command-line compilers.
When you first compile an application with fcsh, you will not typically notice any difference between fcsh and the command-line compilers. This is because fcsh must load the application model and custom libraries into memory, just as the command-line compilers would. After that, however, each subsequent compilation uses the libraries in memory to compile. This reduces the amount of disk access that the compilers need to perform and should result in shorter compile times.
This utility is supported in the Windows and Unix/Linux/Mac environments.
Installing fcsh
Installing fcsh is a simple process. You copy files from the ZIP file to their target directories.
To install fcsh:
1. Download the fcsh ZIP file and view the license agreement.
Note: Your use of this site including software downloads, submission of comments, ideas, feature requests and techniques on this and other Adobe maintained forums, as well as Adobe’s rights to use such materials, is governed by the Terms of Use.
2. Extract the contents of the fcsh ZIP file to a temporary directory.
3. Copy the contents of the ZIP file's bin directory to your SDK bin directory. This includes the fcsh.exe and fcsh files.
4. Copy the contents of the ZIP file's lib directory to your SDK lib directory. This includes the fcsh.jar file.
Using fcsh
You invoke fcsh from the command line. You can launch the utility either as an executable (Windows) or shell command (Unix/Linux/Mac).
To use fcsh:
1. Open a command prompt.
2. Navigate to the {SDK_root}/bin directory.
3. Enter fcsh at the command line.
Typically, you compile a simple application when you first launch fcsh; for example:
(fcsh) mxmlc c:/myfiles/MyApp.mxml
The fcsh utility returns a target id:
fcsh: Assigned 1 as the compile target id.
You then refer to the target ids when using subsequent commands inside the fcsh utility. For example, to compile the application with incremental compilation:
(fcsh) compile 1
You can enter help in the fcsh shell to see a list of available options; for example:
(fcsh) help
You can enter quit in the fcsh shell to exit fcsh and return to the command prompt; for example:
(fcsh) quit
The following example shows that fcsh dramatically reduces compilation time when compiling the same application multiple times:
(fcsh) mxmlc -benchmark=true flexstore.mxml Total time: 8885ms Peak memory usage: 84 MB (Heap: 58, Non-Heap: 26) (fcsh) mxmlc -benchmark=true flexstore.mxml Total time: 5140ms Peak memory usage: 84 MB (Heap: 57, Non-Heap: 27)
Then, the second full compilation of the same application is much faster:
> touch flexstore.mxml (fcsh) compile 1 Files changed: 1 Files affected: 0 Total time: 933ms Peak memory usage: 88 MB (Heap: 62, Non-Heap: 26) flexstore.swf (522456 bytes) Total time: 1102ms Peak memory usage: 77 MB (Heap: 51, Non-Heap: 26) (fcsh)
About fcsh options
The following table describes the available fcsh options:
| Option | Description |
|---|---|
clear [id] |
Removes the target id(s) from memory but saves the target's *.cache file. If you enter this command without specifying an id argument, fcsh clears all target ids. For information about cache files, see the incremental compilation discussion in Building and Deploying Flex 2 Applications. |
compile id |
Uses incremental compilation (without linking) to compile the specified id. If you try to compile a target that has not changed, fcsh skips that target. |
compc arg1 [...] |
Compiles SWC files from the specified sources. This command returns a target id that you can then pass to other fcsh options. The target ids are incremented by 1 for each new compilation. If you quit fcsh and then relaunch it, all targets are cleared and the ids start at 1 again. |
info [id] |
Displays compiler target information such as the source files and cache file name. If you do not specify a target id, fcsh prints file info for all targets in reverse id order. |
mxmlc arg1 [...] |
Compiles and optimizes the target Flex application or module using the mxmlc command line compiler. This command returns a target id that you can then pass to other fcsh options. The target ids are incremented by 1 for each new compilation. If you quit fcsh and then relaunch it, all targets are cleared and the ids start at 1 again. |
quit |
Exits the fcsh utility. All data stored in memory is destroyed. When you relaunch fcsh, you cannot access any targets that you created in a previous session. |
