Flex Builder has advanced options for customizing project builds. You can, for example, builds projects manually, change the default build order of projects in the workspace, and create custom builders using the Apache Ant utility.
When you build projects manually, you can control the timing and scope of the build. For example, you can build a single project, all projects in the workspace, or create a working set of projects or selected project resources and build only those projects and resources. A working set is a collection of workspace resources (projects, files, and folders) that you can select and group together and work with as you see fit. For more information about working sets, see Creating working sets.
The build options are available in the Project menu, as shown in the following example:
The selected project is built, and new or updated release and debug application files are added to the project output folder.
Build all projects in the workspace
Select Project > Build All from the main menu.
All projects in the workspace are built and application files are added to each project output folder. You are then prompted to save files if you have not already chosen to save files automatically before a build begins.
Do either of the following:
All projects in the working set are built and the application files are added to the project output folder.
When you build your projects manually, you are prompted to save all resources before the build begins. To bypass this prompt, you can set workspace preferences to automatically save project resources.
After a project has been built, subsequent builds affect only the resources that have been added or modified. To force the Flex Builder compiler to rebuild all resources in a project, you can perform a clean build. You might perform a clean build if, for example, you want to eliminate all potential sources of a problem you encountered when testing your application.
Flex Builder lets you create relationships between projects when working with multiple projects in the workspace. For example, you can import ActionScript classes from one project into another. Creating relationships between projects affects the order in which your projects are built.
By default, the compiler builds related projects in the order required to build them all properly. For example, if a project refers to classes contained in another project, the project containing the classes is built first. In most cases, relying on the compiler to build projects in the proper order is sufficient and your applications will be generated successfully.
You can, however, change the build order. For example, you might change the build order if you created a custom Ant builder and associated it with a project in your workspace, and you need to build that project before other projects are built. For more information about creating custom builders, see Customizing builds with Apache Ant.
The Build Order dialog box displays the following options:
Use Default Build Order The default build order is dictated by the dependencies between projects and is handled by the compiler.
Project Build Order You can manually set the build order for all the projects in the workspace. You can also remove a project from the build order list; it will still be built, but only after all the projects in the build order list.
Max Iterations When Building With Cycles If your projects contain cyclic references (something you should avoid), you can set the number of build attempts so that the compiler can properly build all the projects. The default maximum number of iterations is 10.
By creating a custom builder, you can modify and extend the standard build process. Flex Builder contains a standard build script that is used to compile your applications. If needed, you can create custom build scripts using Apache Ant, which is an open-source Java-based build tool.
While developing Ant build scripts is beyond the scope of this guide, this topic shows you how to create and apply a custom builder to your projects.
You can apply custom builders to all the Flex Builder project types.
Detailed information about working with Ant build scripts can be found in the Eclipse documentation, which is available at http://help.eclipse.org/help31/index.jsp.
%embedded%FlexSDKPreferencePage | Using multiple SDKs in Flex Builder
Flex Builder lets you change the version of the SDK that you use to compile your projects. You can select the SDK when you first create a project or at any time you are working on a project.
The combination of a framework and the compiler make up the SDK. If you select the Flex 2.0.1 SDK, then you are using the 2.0.1 version of the Flex framework SWC files, and the 2.0.1 version of the Flex compiler. You cannot use, for example, the Flex 3 compiler with the Flex 2.0.1 framework SWC files.
Using a different SDK can be useful if you are given a project that was developed using Flex Builder 2.0.1 (which uses the Flex 2.0.1 SDK), but you are running Flex Builder 3 (which uses the Flex 3 SDK by default). By selecting an older SDK to build with, you can maintain projects that have not been updated to be compatible with the latest version of the SDK. In addition, if you are currently working on a project for the Flex 2.0.1 SDK, but want to use the Flex Builder 3 features such as code refactoring, you can upgrade your edition of Flex Builder, but then select the older SDK as the default SDK.
If you develop a project and then change the SDK, Flex Builder performs a full rebuild, not an incremental build. As a result, Flex Builder flags any differences that would throw compiler errors as if the project had been developed under the original SDK. For example, if you use an AdvancedDataGrid component in your project (which was first introduced in the Flex 3 SDK), but then change the project to use the 2.0.1 SDK, Flex Builder will notify you that the AdvancedDataGrid class is unknown.
Flex Builder also regenerates all supporting files for the projects. These include the history management and deep linking files used by the HTML wrapper. For Flex 2.0.1 SDK projects, Flex Builder creates the Flex 2.0.1. SDK-compatible history.swf, history.html, and history.js history management files in the html-templates directory. For Flex 3 SDK projects, Flex Builder creates the Flex 3 SDK-compatible deep-linking history.htm, history.js. and historyFrame.html files in the html-templates/history directory.
In addition, the availability of Flex Builder options change depending on the selected SDK. For example, if you add a module to your project with a project that uses the Flex 2.0.1 SDK, Flex Builder does not let you select whether you want to optimize that module or not. You must do this manually.
For more information about the differences between the Flex 3 SDK and the Flex 2.0.1 SDK, see Backward compatibility in Building and Deploying Adobe Flex 3 Applications.
When you create a new Flex project, Flex Builder uses the default SDK. The default is the latest SDK that shipped with Flex Builder, but you can change it to any SDK that is visible in the list of available SDKs in Flex Builder.
When you create a new Flex library project or ActionScript project, you can select which SDK you want that project to use in the New Flex Library Project and New ActionScript Project dialog boxes.
Add a new Flex SDK to the list of available SDKs
The currently installed SDKs are listed. The default SDK has a check mark next to its name.
Change the SDK version for the current project
Flex Builder applies the new SDK to the current project. This can cause errors and warnings to appear if the project uses code that is not compatible with the new SDK.
The default SDK has a check mark next to its name.
You can also change the SDK when compiling in a server-based environment. When you create a new server-based project, you are prompted either to compile the application locally or to compile the application on the server. If you choose the first option, to compile the application locally, Flex Builder uses the server's SDK. You can later change the SDK to a different one. If you choose the second option, to compile the application on the server, Flex Builder offloads the compilation to the server and uses the web-tier compiler to compile the project. In this case, you cannot change the SDK.