Class: FlashSDK::CompilerBase Abstract
- Inherits:
-
Sprout::Executable::Base
- Object
- Sprout::Executable::Base
- FlashSDK::CompilerBase
- Defined in:
- flashsdk/lib/flashsdk/compiler_base.rb
Overview
Constant Summary
Constants included from Sprout::Executable
DEFAULT_FILE_EXPRESSION, DEFAULT_PREFIX, DEFAULT_SHORT_PREFIX
Instance Attribute Summary (collapse)
-
- (Boolean) accessible
Enables accessibility features when compiling the Flex application or SWC file.
-
- (String) actionscript_file_encoding
Sets the file encoding for ActionScript files.
-
- (Boolean) allow_source_path_overlap
Checks if a source-path entry is a subdirectory of another source-path entry.
-
- (Boolean) as3
Use the ActionScript 3.0 class-based object model for greater performance and better error reporting.
-
- (Boolean) benchmark
Prints detailed compile times to the standard output.
-
- (Path) context_root
Sets the value of the contextcontext.root token in channel definitions in the flex-services.xml file.
-
- (String) contributor
Sets metadata in the resulting SWF file.
-
- (String) creator
Sets metadata in the resulting SWF file.
-
- (String) date
Sets metadata in the resulting SWF file.
-
- (Boolean) debug
Generates a debug SWF file.
-
- (String) debug_password
Lets you engage in remote debugging sessions with the Flash IDE.
-
- (String) default_background_color
Sets the SWF background color.
-
- (Url) default_css_url
Defines the location of the default style sheet.
-
- (Number) default_frame_rate
Sets the application's frame rate.
-
- (String) default_script_limits
Defines the application's script execution limits.
-
- (String) default_size
Defines the default application size, in pixels as a String.
-
- (Array<String>) define_conditional
This parameter is normally called 'define' but thanks to scoping issues with Sprouts and Rake, we needed to rename it and chose: 'define_conditional'.
-
- (String) description
Sets metadata in the resulting SWF file.
-
- (File) dump_config
Outputs the compiler options in the flex-config.xml file to the target path; for example:.
-
- (Boolean) es
Use the ECMAScript edition 3 prototype-based object model to allow dynamic overriding of prototype properties.
-
- (Array<String> [Files]) external_library_path
Specifies a list of SWC files or directories to exclude from linking when compiling a SWF file.
-
- (Array<String>) externs
Sets a list of symbols to exclude from linking when compiling a SWF file.
-
- (Object) fcsh_port
The FCSH port to use for connections.
-
- (Array<String> [Files]) file_specs
Specifies source files to compile.
-
- (String) fonts_languages_language_range
Specifies the range of Unicode settings for that language.
-
- (Array<String>) fonts_managers
Defines the font manager.
-
- (Number) fonts_max_cached_fonts
Sets the maximum number of fonts to keep in the server cache.
-
- (Number) fonts_max_glyphs_per_face
Sets the maximum number of character glyph-outlines to keep in the server cache for each font face.
-
- (Array<String>) frames_frame
Specifies a SWF file frame label with a sequence of one or more class names that will be linked onto the frame.
-
- (Boolean) generate_frame_loader
Toggles the generation of an IFlexBootstrap-derived loader class.
-
- (Boolean) headless_server
Enables the headless implementation of the Flex compiler.
-
- (Array<String> [Files]) include_libraries
Links all classes inside a SWC file to the resulting application SWF file, regardless of whether or not they are used.
-
- (Array<String> [Paths]) include_path
Define one or more directory paths for include processing.
-
- (Array<String>) includes
Links one or more classes to the resulting application SWF file, whether or not those classes are required at compile time.
-
- (Boolean) incremental
Enables incremental compilation.
-
- (Array<String>) keep_as3_metadata
Keep the specified metadata in the SWF (advanced, repeatable).
-
- (Boolean) keep_generated_actionscript
Determines whether to keep the generated ActionScript class files.
-
- (String) language
Sets metadata in the resulting SWF file.
-
- (Boolean) lazy_init
Enables ABC bytecode lazy initialization.
-
- (Array<String> [Files]) library_path
Links SWC files to the resulting application SWF file.
-
- (String) license
<product> <serial-number>.
-
- (String) link_report
Prints linking information to the specified output file.
-
- (Array<String> [Files]) load_config
Specifies the location of the configuration file that defines compiler options.
-
- (File) load_externs
Specifies the location of an XML file that contains .
-
- (String) locale
Specifies the locale that should be packaged in the SWF file (for example, en_EN).
-
- (String) localized_description
Sets metadata in the resulting SWF file.
-
- (String) localized_title
Sets metadata in the resulting SWF file.
-
- (String) namespaces_namespace
Specifies a namespace for the MXML file.
-
- (Boolean) optimize
Enables the ActionScript optimizer.
-
- (File) output
Specifies the output path and filename for the resulting file.
-
- (String) publisher
Sets metadata in the resulting SWF file.
-
- (String) raw_metadata
XML text to store in the SWF metadata (overrides metadata.* configuration) (advanced).
-
- (File) resource_bundle_list
Prints a list of resource bundles to input to the compc compiler to create a resource bundle SWC file.
-
- (Array<String>) runtime_shared_libraries
Specifies a list of run-time shared libraries (RSLs) to use for this application.
-
- (Array<String>) runtime_shared_library_path
Setting up Runtime Shared Libraries (RSLs) is extremely complicated and usually not worth doing unless you're using the Flex framework.
-
- (File) services
Specifies the location of the services-config.xml file.
-
- (Boolean) show_actionscript_warnings
Shows warnings for ActionScript classes.
-
- (Boolean) show_binding_warnings
Shows a warning when Flash Player cannot detect changes to a bound property.
-
- (Boolean) show_deprecation_warnings
Shows deprecation warnings for Flex components.
-
- (Array<String> [Paths]) source_path
Adds directories to the source path.
-
- (Boolean) static_link_runtime_shared_libraries
Statically link the libraries specified by the #runtime_shared_libraries option.
-
- (Boolean) strict
Prints undefined property and function calls; also performs compile-time type checking on assignments and options supplied to method calls.
-
- (String) target_player
Specifies the version of the player the application is targeting.
-
- (Array<String> [Files]) theme
Specifies a list of theme files to use with this application.
-
- (String) title
Sets metadata in the resulting SWF file.
-
- (Object) use_fcsh
Set to true in order to compile with the Flex Compiler Shell (FCSH).
-
- (Boolean) use_network
Specifies that the current application uses network services.
-
- (Boolean) verbose_stacktraces
Generates source code that includes source files and line numbers.
-
- (Boolean) verify_digests
Verifies the libraries loaded at runtime are the correct ones.
-
- (Boolean) warn_warning_type
Enables specified warnings.
-
- (Boolean) warnings
Enables all warnings.
Instance Method Summary (collapse)
-
- (Object) execute
Temporary override while waiting for integration of next version! TODO: Remove this method override.
-
- (Object) execute_delegate
protected
override.
- - (Object) execute_with_fcsh protected
-
- (File) library_added(path)
protected
Template method called by Sprout::Executable when a Sprout::Library is found in the Rake::Task prerequisite list.
-
- (Object) prepare
protected
override.
- - (Object) update_fcsh protected
Methods inherited from Sprout::Executable::Base
add_param, add_param_alias, #binary_path, #binary_path=, #create_outer_task, #default_file_expression, #from_hash, #initialize, #parse!, #parse_extra_options!, #parse_rake_task_arg, set, static_default_value_collection, static_parameter_collection, #stderr, #stderr=, #stdout, #stdout=, #system_execute, #to_hash, #to_help, #to_rake, #to_shell, #update_rake_task_name_from_args
Methods included from Sprout::Concern
#append_features, extended, #included
Constructor Details
This class inherits a constructor from Sprout::Executable::Base
Instance Attribute Details
- (Boolean) accessible
Enables accessibility features when compiling the Flex application or SWC file. The default value is false.
desc "Compile the Application" mxmlc 'bin/SomeProject.swf' do |t| t.input = 'src/SomeProject.as' t.source_path << 'src' t.accessible = true end
|
|
# File '' add_param :accessible, Boolean, { :hidden_value => true } |
- (String) actionscript_file_encoding
Sets the file encoding for ActionScript files.
|
|
# File '' add_param :actionscript_file_encoding, String |
- (Boolean) allow_source_path_overlap
Checks if a source-path entry is a subdirectory of another source-path entry. It helps make the package names of MXML components unambiguous.
desc "Compile the Application" mxmlc 'bin/SomeProject.swf' do |t| t.input = 'src/SomeProject.as' t.source_path << 'src' t.source_path << 'src/com/foo' t.allow_source_path_overlap = true end
|
|
# File '' add_param :allow_source_path_overlap, Boolean, { :hidden_value => true } |
- (Boolean) as3
Use the ActionScript 3.0 class-based object model for greater performance and better error reporting. In the class-based object model, most built-in functions are implemented as fixed methods of classes.
Setting this value to false will switch the compiler into a more ECMA-compatible mode.
The default value is true. If you set this value to false, you must set the es option to true.
desc "Compile the Application" mxmlc 'bin/SomeProject.swf' do |t| t.input = 'src/SomeProject.as' t.source_path << 'src' t.as3 = false end
|
|
# File '' add_param :as3, Boolean, { :default => true, :show_on_false => true } |
- (Boolean) benchmark
Prints detailed compile times to the standard output. The default value is true.
desc "Compile the Application" mxmlc 'bin/SomeProject.swf' do |t| t.input = 'src/SomeProject.as' t.source_path << 'src' t.benchmark = true end
|
|
# File '' add_param :benchmark, Boolean, { :default => true, :show_on_false => true } |
- (Path) context_root
Sets the value of the FlashSDK::CompilerBase.contextcontext.root token in channel definitions in the flex-services.xml file. If you do not specify the value of this option, Flex uses an empty string.
|
|
# File '' add_param :context_root, Path |
- (String) contributor
Sets metadata in the resulting SWF file.
|
|
# File '' add_param :contributor, String |
- (Boolean) debug
Generates a debug SWF file. This file includes line numbers and filenames of all the source files. When a run-time error occurs, the stacktrace shows these line numbers and filenames. This information is also used by the command-line debugger and the Flex Builder debugger. Enabling the debug option generates larger SWF files.
For the mxmlc compiler, the default value is false. For the compc compiler, the default value is true.
For SWC files generated with the compc compiler, set this value to true, unless the target SWC file is an RSL. In that case, set the debug option to false.
For information about the command-line debugger, see Using the Command-Line Debugger (livedocs.adobe.com/flex/2/docs/00001540.html#181846).
Flex also uses the verbose-stacktraces setting to determine whether line numbers are added to the stacktrace.
desc "Compile the Application" mxmlc 'bin/SomeProject.swf' do |t| t.input = 'src/SomeProject.as' t.source_path << 'src' t.debug = true end
|
|
# File '' add_param :debug, Boolean, { :hidden_value => true } |
- (String) debug_password
Lets you engage in remote debugging sessions with the Flash IDE.
|
|
# File '' add_param :debug_password, String |
- (String) default_background_color
Sets the SWF background color.
If you're using the Flex framework, the default background IMAGE is that sickly, horrendous, blue-green-grey gradient.
If you want to see the background color that you set here, you will also need to override the backgroundImage property in your Flex Application document.
You can also set the background color (and other values) using the [Embed] metadata directive directly in your Document Root class.
[SWF(width='400', height='300', backgroundColor='#ffffff', frameRate='30')]
To set the background color from a Rake task, use the 0x notation, as the following example shows:
desc "Compile the Application" mxmlc 'bin/SomeProject.swf' do |t| t.input = 'src/SomeProject.as' t.source_path << 'src' t.default_background_color = '0xffcc00' end
|
|
# File '' add_param :default_background_color, String |
- (Url) default_css_url
Defines the location of the default style sheet. Setting this option overrides the implicit use of the defaults.css style sheet in the framework.swc file.
|
|
# File '' add_param :default_css_url, Url |
- (Number) default_frame_rate
Sets the application's frame rate. The default value is 24.
desc "Compile the Application" mxmlc 'bin/SomeProject.swf' do |t| t.input = 'src/SomeProject.as' t.source_path << 'src' t.default_frame_rate = 24 end
|
|
# File '' add_param :default_frame_rate, Number |
- (String) default_script_limits
Defines the application's script execution limits.
The max-recursion-depth value specifies the maximum depth of Adobe Flash Player call stack before Flash Player stops. This is essentially the stack overflow limit. The default value is 1000.
The max-execution-time value specifies the maximum duration, in seconds, that an ActionScript event handler can execute before Flash Player assumes that it is hung, and aborts it. The default value is 60 seconds. You cannot set this value above 60 seconds.
Example:
desc "Compile the Application" mxmlc 'bin/SomeProject.swf' do |t| t.input = 'src/SomeProject.as' t.source_path << 'src' # 900 is new max-recursion-depth # 20 is new max-execution-time t.default_script_limits = '900 20' end
You can override these settings in the application.
|
|
# File '' add_param :default_script_limits, String |
- (String) default_size
Defines the default application size, in pixels as a String.
If you're using the Flex 4 SDK, these values should be comma-delimited like:
desc "Compile the Application" mxmlc 'bin/SomeProject.swf' do |t| t.input = 'src/SomeProject.as' t.source_path << 'src' t.default_size = '950,550' end
If you're using the Flex 3 SDK, these values should be space-delimited like:
desc "Compile the Application" mxmlc 'bin/SomeProject.swf' do |t| t.input = 'src/SomeProject.as' t.source_path << 'src' t.default_size = '950 550' end
|
|
# File '' add_param :default_size, String |
- (Array<String>) define_conditional
This parameter is normally called 'define' but thanks to scoping issues with Sprouts and Rake, we needed to rename it and chose: 'define_conditional'.
The format of each String value is "namespace::variable_name,value", for example, if I wanted an Environment named 'production' available to conditional compilation statements, I might do the following:
Define a global AS3 conditional compilation definition:
desc "Compile the Application" mxmlc 'bin/SomeProject.swf' do |t| t.input = 'src/SomeProject.as' t.source_path << 'src' t.define_conditional << 'CONFIG::environment,production' end
Then, in any given ActionScript class, we might add the following:
public static const environent:String = CONFIG::environment
This value would be available to code at runtime where we can then branch on different environments.
We can also use IFDEF like statements to completely remove or add code based on a conditional value. This is (sadly) done with Boolean conditionals as follows:
desc "Compile the Application" mxmlc 'bin/SomeProject.swf' do |t| t.input = 'src/SomeProject.as' t.source_path << 'src' t.define_conditional << 'CONFIG::release,true' t.define_conditional << 'CONFIG::debug,false' end
Then, in any given ActionScript class, we might add the following:
CONFIG::release
public function getValue():String {
return value;
}
CONFIG::debug
public function getValue():String {
return value + " : " + debugInfo;
}
Note how the CONFIG::[name] statement precedes an ActionScript statement, but doesn't need to enclose it brackets or anything. This can go in front of any ActionScript statement (functions, classes, variables, etc).
For more information, please read Adobe's documentation on conditional compilation.
|
|
# File '' add_param :define_conditional, Strings, { :shell_name => "-define" } |
- (String) description
Sets metadata in the resulting SWF file.
desc "Compile the Application" mxmlc 'bin/SomeProject.swf' do |t| t.input = 'src/SomeProject.as' t.source_path << 'src' t.description = "This SWF was built with Project Sprouts!" end
|
|
# File '' add_param :description, String |
- (File) dump_config
Outputs the compiler options in the flex-config.xml file to the target path; for example:
desc "Compile the Application" mxmlc 'bin/SomeProject.swf' do |t| t.input = 'src/SomeProject.as' t.source_path << 'src' t.dump_config = 'mxmlc-config.xml' end
|
|
# File '' add_param :dump_config, File |
- (Boolean) es
Use the ECMAScript edition 3 prototype-based object model to allow dynamic overriding of prototype properties. In the prototype-based object model, built-in functions are implemented as dynamic properties of prototype objects.
You can set the strict option to true when you use this model, but it might result in compiler errors for references to dynamic properties.
The default value is false. If you set this option to true, you must set the as3 option to false.
desc "Compile the Application" mxmlc 'bin/SomeProject.swf' do |t| t.input = 'src/SomeProject.as' t.source_path << 'src' t.es = true t.as3 = false end
|
|
# File '' add_param :es, Boolean |
- (Array<String> [Files]) external_library_path
Specifies a list of SWC files or directories to exclude from linking when compiling a SWF file.
This option provides compile-time link checking for external components that are dynamically linked.
desc "Compile the Application" mxmlc 'bin/SomeProject.swf' do |t| t.input = 'src/SomeProject.as' t.source_path << 'src' t.external_library_path << 'src/com/domain/project/SomeClass.as' t.external_library_path << 'lib/somelib/' t.external_library_path << 'lib/otherlib/OtherLibrary.swc' end
To dynamically link against classes instead of files, folders or SWCs, see #externs.
|
|
# File '' add_param :external_library_path, Files |
- (Array<String>) externs
Sets a list of symbols to exclude from linking when compiling a SWF file.
This option provides compile-time link checking for external references that are dynamically linked.
desc "Compile the Application" mxmlc 'bin/SomeProject.swf' do |t| t.input = 'src/SomeProject.as' t.source_path << 'src' t.externs << 'com.somedomain.SomeClass' t.externs << 'com.otherdomain.OtherClass' end
To dynamically link against files, folders or SWCs instead of classes, see #external_library_path.
|
|
# File '' add_param :externs, Strings |
- (Object) fcsh_port
The FCSH port to use for connections. If you are building from multiple different directories, you will need to start up the FCSH servers on different ports. This can be done like:
rake fcsh:start FCSH_PORT=12322
and in another terminal:
rake fcsh mxmlc FCSH_PORT=12322
1030 1031 1032 |
# File 'flashsdk/lib/flashsdk/compiler_base.rb', line 1030 def fcsh_port @fcsh_port end |
- (Array<String> [Files]) file_specs
Specifies source files to compile. This is the default option for the mxmlc compiler.
|
|
# File '' add_param :file_specs, Files |
- (String) fonts_languages_language_range
Specifies the range of Unicode settings for that language.
|
|
# File '' add_param :fonts_languages_language_range, String, { :shell_name => "-compiler.fonts.languages.language-range" } |
- (Array<String>) fonts_managers
Defines the font manager. The default is flash.fonts.JREFontManager. You can also use the flash.fonts.BatikFontManager.
|
|
# File '' add_param :fonts_managers, Strings |
- (Number) fonts_max_cached_fonts
Sets the maximum number of fonts to keep in the server cache.
|
|
# File '' add_param :fonts_max_cached_fonts, Number |
- (Number) fonts_max_glyphs_per_face
Sets the maximum number of character glyph-outlines to keep in the server cache for each font face.
|
|
# File '' add_param :fonts_max_glyphs_per_face, Number |
- (Array<String>) frames_frame
Specifies a SWF file frame label with a sequence of one or more class names that will be linked onto the frame.
desc "Compile the Application" mxmlc 'bin/SomeProject.swf' do |t| t.input = 'src/SomeProject.as' t.source_path << 'src' t.frames_frame << 'someFrameLabel SomeClass OtherClass AnotherClass' t.frames_frame << 'anotherFrameLabel YetAnotherClass' end
|
|
# File '' add_param :frames_frame, Strings, { :shell_name => '-frames.frame' } |
- (Boolean) generate_frame_loader
Toggles the generation of an IFlexBootstrap-derived loader class.
desc "Compile the Application" mxmlc 'bin/SomeProject.swf' do |t| t.input = 'src/SomeProject.as' t.source_path << 'src' t.generate_frame_loader = false end
-
Might be deprecated?
|
|
# File '' add_param :generate_frame_loader, Boolean |
- (Boolean) headless_server
Enables the headless implementation of the Flex compiler.
This sets the following (in Java):
System.setProperty('java.awt.headless', 'true')
The headless setting (java.awt.headless=true) is required to compile SWFs that use fonts and SVG on UNIX systems that aren't running X Windows.
|
|
# File '' add_param :headless_server, Boolean |
- (Array<String> [Files]) include_libraries
Links all classes inside a SWC file to the resulting application SWF file, regardless of whether or not they are used.
Contrast this option with the #library_path option that includes only those classes that are referenced at compile time.
To link one or more classes whether or not they are used and not an entire SWC file, use the #includes option.
This option is commonly used to specify resource bundles.
desc "Compile the Application" mxmlc 'bin/SomeProject.swf' do |t| t.input = 'src/SomeProject.as' t.source_path << 'src' t.include_libraries << 'lib/somelib/SomeLib.swc' end
|
|
# File '' add_param :include_libraries, Files |
- (Array<String> [Paths]) include_path
Define one or more directory paths for include processing. For each path that is provided, all .as and .mxml files found forward of that path will be included in the SWF regardless of whether they are referenced elsewhere.
desc "Compile the Application" mxmlc 'bin/SomeProject.swf' do |t| t.input = 'src/SomeProject.as' t.source_path << 'src' t.source_path << 'lib/somelib' t.include_path << 'lib/somelib/com/somelib/net' end
|
|
# File '' add_param :include_path, Paths |
- (Array<String>) includes
Links one or more classes to the resulting application SWF file, whether or not those classes are required at compile time.
To link an entire SWC file rather than individual classes, use the #include_libraries option.
desc "Compile the Application" mxmlc 'bin/SomeProject.swf' do |t| t.input = 'src/SomeProject.as' t.source_path << 'src' t.source_path << 'lib/somelib' t.includes << 'com.domain.SomeClass' end
|
|
# File '' add_param :includes, Strings |
- (Boolean) incremental
Enables incremental compilation.
This option is true by default for the Flex Builder application compiler.
For the command-line compiler, the default is false.
The web-tier compiler does not support incremental compilation.
|
|
# File '' add_param :incremental, Boolean |
- (Array<String>) keep_as3_metadata
Keep the specified metadata in the SWF (advanced, repeatable). This parameter must be set if you attempt to define new metadata tags.
If you define metadata tags and use this parameter to include them when building a SWC, consumers of your SWC library will not also need to re-include the same metadata tags.
Following is an example Rakefile that is setting this property:
desc "Compile the Application" mxmlc 'bin/SomeProject.swf' do |t| t.input = 'src/SomeProject.as' t.source_path << 'src' t. << 'Orange' end
There could be a class somewhere that defines this metadata tag:
[Orange(isTasty=true)]
public function eatOranges():void {
// do something
}
There would normally be another class that does some kind of reflection to perform some special operation on all entities that declare themselves as [Orange].
|
|
# File '' add_param :keep_as3_metadata, Strings |
- (Boolean) keep_generated_actionscript
Determines whether to keep the generated ActionScript class files.
The generated class files include stubs and classes that are generated by the compiler and used to build the SWF file.
The default location of the files is the /generated subdirectory, which is directly below the target MXML file. If the /generated directory does not exist, the compiler creates one.
The default names of the primary generated class files are filename-generated.as and filename-interface.as.
The default value is false.
|
|
# File '' add_param :keep_generated_actionscript, Boolean |
- (Boolean) lazy_init
Enables ABC bytecode lazy initialization.
The default value is false.
|
|
# File '' add_param :lazy_init, Boolean |
- (Array<String> [Files]) library_path
Links SWC files to the resulting application SWF file. The compiler only links in those classes for the SWC file that are referenced from your Document Root, or another class that it references.
The default value of the #library_path option includes all SWC files in the libs directory and the current locale. These are required.
To point to individual classes or packages rather than entire SWC files, use the #source_path option.
You can use the << operator to append the new argument to the list of existing library paths:
desc "Compile the Application" mxmlc 'bin/SomeProject.swf' do |t| t.input = 'src/SomeProject.as' t.library_path << 'lib/somelib/SomeLib.swc' end
If you set the value of the library_path using the '=' operator, you must set the entire Array.
You may also need to explicitly add the framework.swc and locale SWC files. Your new entry is not appended to the #library_path but replaces it. Once the value has been set, you can use the '<<' operator for subsequent applications.
desc "Compile the Application" mxmlc 'bin/SomeProject.swf' do |t| t.input = 'src/SomeProject.as' t.source_path << 'src' t.library_path = ['lib/somelib/SomeLib.swc'] end
In a configuration file, you can set the append attribute of the library-path tag to true to indicate that the values should be appended to the library path rather than replace it.
|
|
# File '' add_param :library_path, Files |
- (String) license
<product> <serial-number>
Specifies a product and a serial number. (repeatable)
|
|
# File '' add_param :license, String |
- (String) link_report
Prints linking information to the specified output file. This file is an XML file that contains
<def>, <pre>, and <ext>
Symbols showing linker dependencies in the final SWF file.
The file format output by this command can be used to write a file for input to the #load_externs option.
desc "Compile the Application" mxmlc 'bin/SomeProject.swf' do |t| t.input = 'src/SomeProject.as' t.source_path << 'src' t.link_report = 'ext/link-report.xml' end
|
|
# File '' add_param :link_report, String |
- (Array<String> [Files]) load_config
Specifies the location of the configuration file that defines compiler options.
If you specify a configuration file, you can still override individual options by setting them on the command line.
All relative paths in the configuration file are relative to the location of the configuration file itself.
desc "Compile the Application" mxmlc 'bin/SomeProject.swf' do |t| t.input = 'src/SomeProject.as' t.source_path << 'src' t.load_config << 'mxmlc-config.xml' end
If you would like to see this file for your current configuration, you can set the #dump_config parameter and run your rake task.
|
|
# File '' add_param :load_config, Files |
- (File) load_externs
Specifies the location of an XML file that contains
<def>, <pre>, and <ext>
symbols to omit from linking when compiling a SWF file.
The XML file uses the same syntax as the one produced by the link-report option.
This option provides compile-time link checking for external components that are dynamically linked.
desc "Compile the Application" mxmlc 'bin/SomeProject.swf' do |t| t.input = 'src/SomeProject.as' t.source_path << 'src' t.load_externs = 'framework-link-report.xml' end
The input for this parameter is often the output of another build task that is set up to emit a #link_report, for example, the previous example might be loading a #link_report from a task that looks like:
desc "Compile the Application" compc 'bin/rsls' do |t| t.directory = true t.include_sources << 'lib/framework' t.link_report = 'framework-link-report.xml' end
|
|
# File '' add_param :load_externs, File |
- (String) locale
Specifies the locale that should be packaged in the SWF file (for example, en_EN).
You run the mxmlc compiler multiple times to create SWF files for more than one locale, with only the locale option changing.
You must also include the parent directory of the individual locale directories, plus the token locale, in the source-path.
One way to do this with Rake might be as follows:
# Create a new, empty task to asseble the locale-specific # build tasks: desc 'Build localized SWF files' task :build_locales # For each supported locale, create a new build task: ['en_US', 'en_EN', 'es_ES'].each do |locale| swf = "bin/SomeProject-#{locale}.swf" mxmlc swf do |t| t.input = 'src/SomeProject.as' t.source_path << 'src' t.source_path << "locale/#{locale}" t.locale = locale end # Add the localized build task as a prerequisite # to the aggregate task: task :build_locales => swf end
If the previous code was in a Rake file, you could build all localized SWFs with:
rake build_locales
You could also build a single locale with:
rake bin/SomeProject-en_US.swf
|
|
# File '' add_param :locale, String |
- (String) localized_description
Sets metadata in the resulting SWF file.
|
|
# File '' add_param :localized_description, String |
- (String) localized_title
Sets metadata in the resulting SWF file.
|
|
# File '' add_param :localized_title, String |
- (String) namespaces_namespace
Specifies a namespace for the MXML file. You must include a URI and the location of the manifest file that defines the contents of this namespace. This path is relative to the MXML file.
|
|
# File '' add_param :namespaces_namespace, String |
- (Boolean) optimize
Enables the ActionScript optimizer. This optimizer reduces file size and increases performance by optimizing the SWF file's bytecode, but takes slightly longer to compile. This should usually be set to true for any SWF files that are headed to production.
desc "Compile the Application" mxmlc 'bin/SomeProject.swf' do |t| t.input = 'src/SomeProject.as' t.source_path << 'src' t.optimize = true end
|
|
# File '' add_param :optimize, Boolean |
- (File) output
Specifies the output path and filename for the resulting file.
If you omit this option, the compiler saves the SWF file to the directory where the target file is located. The default SWF filename matches the target filename, but with a SWF file extension. When using this option with the component compiler (compc), the output is a SWC file rather than a SWF file.
The compiler creates extra directories based on the specified filename if those directories are not present.
The #mxmlc Rake task uses a Rake::File task under the covers, and will automatically set this value with the string passed into the task name.
This parameter should not be set directly within the task body.
|
|
# File '' add_param :output, File, { :file_task_name => true } |
- (String) publisher
Sets metadata in the resulting SWF file.
|
|
# File '' add_param :publisher, String |
- (String) raw_metadata
XML text to store in the SWF metadata (overrides metadata.* configuration) (advanced)
|
|
# File '' add_param :raw_metadata, String |
- (File) resource_bundle_list
Prints a list of resource bundles to input to the compc compiler to create a resource bundle SWC file. The filename argument is the name of the file that contains the list of bundles.
|
|
# File '' add_param :resource_bundle_list, File |
Specifies a list of run-time shared libraries (RSLs) to use for this application. RSLs are dynamically-linked at run time.
You specify the location of the SWF file relative to the deployment location of the application. For example, if you store a file named library.swf file in the web_root/libraries directory on the web server, and the application in the web root, you specify libraries/library.swf.
|
|
# File '' add_param :runtime_shared_libraries, Strings |
Setting up Runtime Shared Libraries (RSLs) is extremely complicated and usually not worth doing unless you're using the Flex framework.
Following are some URLs where you might learn more about using RSLs:
-
blogs.adobe.com/rgonzalez/2006/06/modular_applications_part_2.html
-
flexscript.wordpress.com/2008/11/15/using-runtime-shared-libraries-utilizing-flash-player-cache/
If you're not using the Flex framework, the most difficult thing you'll need to do is set up a Preloader and figure out how to determine which urls to load the RSLs from.
If you are setting up RSLs with the Flex framework, you should be able to create a build task something like the following:
version = '4.1.0.16076' rsls_dir = 'lib/rsls' crossdomain = '' host = 'http://yourdomain.com' desc "Compile the Application" mxmlc "bin/SomeProject.swf" do |t| t.source_path << 'src' t.input = 'src/SomeProject.mxml' t.pkg_version = version t.runtime_shared_library_path << "lib/framework_#{version}.swc,#{host}#{rsls_dir}/framework_#{version}.swz,#{crossdomain},#{host}#{rsls_dir}/framework_#{version}.swf" t.runtime_shared_library_path << "lib/rpc_#{version}.swc,#{host}#{rsls_dir}/rpc_#{version}.swz,#{crossdomain},#{host}#{rsls_dir}/rpc_#{version}.swf" end
|
|
# File '' add_param :runtime_shared_library_path, Strings |
- (File) services
Specifies the location of the services-config.xml file. This file is used by Flex Data Services.
|
|
# File '' add_param :services, File |
- (Boolean) show_actionscript_warnings
Shows warnings for ActionScript classes.
The default value is true.
desc "Compile the Application" mxmlc 'bin/SomeProject.swf' do |t| t.input = 'src/SomeProject.as' t.source_path << 'src' t.show_actionscript_warnings = false end
|
|
# File '' add_param :show_actionscript_warnings, Boolean, { :default => true, :show_on_false => true } |
- (Boolean) show_binding_warnings
Shows a warning when Flash Player cannot detect changes to a bound property.
The default value is true.
desc "Compile the Application" mxmlc 'bin/SomeProject.swf' do |t| t.input = 'src/SomeProject.mxml' t.source_path << 'src' t.show_binding_warnings = false end
|
|
# File '' add_param :show_binding_warnings, Boolean, { :default => true, :show_on_false => true } |
- (Boolean) show_deprecation_warnings
Shows deprecation warnings for Flex components. To see warnings for ActionScript classes, use the show-actionscript-warnings option.
The default value is true.
desc "Compile the Application" mxmlc 'bin/SomeProject.swf' do |t| t.input = 'src/SomeProject.mxml' t.source_path << 'src' t.show_deprecation_warnings = false end
|
|
# File '' add_param :show_deprecation_warnings, Boolean, { :default => true, :show_on_false => true } |
- (Array<String> [Paths]) source_path
Adds directories to the source path. The compiler searches directories in the source path for MXML or AS source files based on import statements and type references.
Only those files that have been referenced will be included in a compiled SWF or SWC file.
To add the contents of a SWC file to the entity search, use the #library_path option.
The source path is also used as the search path for the component compiler's #includes and #resource_bundle_list options.
desc "Compile the Application" mxmlc 'bin/SomeProject.swf' do |t| t.input = 'src/SomeProject.mxml' t.source_path << 'src' t.source_path << 'lib/othersrc' t.source_path << 'lib/anothersrc' end
|
|
# File '' add_param :source_path, Paths |
Statically link the libraries specified by the #runtime_shared_libraries option.
|
|
# File '' add_param :static_link_runtime_shared_libraries, Boolean, { :default => true } |
- (Boolean) strict
Prints undefined property and function calls; also performs compile-time type checking on assignments and options supplied to method calls.
Turning of strict typing will essentially enable Duck-Typing in the Flash Player.
The default value is true.
desc "Compile the Application" mxmlc 'bin/SomeProject.swf' do |t| t.input = 'src/SomeProject.mxml' t.source_path << 'src' t.strict = false end
|
|
# File '' add_param :strict, Boolean, { :default => true, :show_on_false => true } |
- (String) target_player
Specifies the version of the player the application is targeting.
Features requiring a later version will not be compiled into the application. The minimum value supported is "9.0.0".
Be aware that this value is a String.
desc "Compile the Application" mxmlc 'bin/SomeProject.swf' do |t| t.input = 'src/SomeProject.mxml' t.source_path << 'src' t.target_player = '10' end
|
|
# File '' add_param :target_player, String |
- (Array<String> [Files]) theme
Specifies a list of theme files to use with this application. Theme files can be SWC files with CSS files inside them or CSS files.
For information on compiling a SWC theme file, see Using Styles and Themes (livedocs.adobe.com/flex/2/docs/00000751.html#241755) in Flex 2 Developer's Guide.
|
|
# File '' add_param :theme, Files |
- (Object) use_fcsh
Set to true in order to compile with the Flex Compiler Shell (FCSH).
You can set this value directly on a single compiler instance like:
mxmlc 'bin/SomeProject.swf' do |t| t.input = 'src/SomeProject.as' t.use_fcsh = true end
This value can also be set to true by sending it into Ruby as an environment variable like:
rake test USE_FCSH=true
If you always want to use FCSH, you can set this value in your .bashrc or .bash_profile like:
export USE_FCSH=true
There is also an :fcsh helper rake task that will set this value simply by executing it before your build tasks. You can do this from the terminal like:
rake fcsh test
Or:
rake fcsh debug
Or you can make it a prerequisite to any other build task like:
mxmlc 'bin/SomeProject.swf' => :fcsh do |t| ... end
1017 1018 1019 |
# File 'flashsdk/lib/flashsdk/compiler_base.rb', line 1017 def use_fcsh @use_fcsh end |
- (Boolean) use_network
Specifies that the current application uses network services.
The default value is true.
When the use-network property is set to false, the application can access the local filesystem (for example, use the XML.load() method with file: URLs) but not network services. In most circumstances, the value of this property should be true.
|
|
# File '' add_param :use_network, Boolean, { :default => true, :show_on_false => true } |
- (Boolean) verbose_stacktraces
Generates source code that includes source files and line numbers. When a run-time error occurs, the stacktrace shows these line numbers.
Enabling this option generates larger SWF files.
The default value is false.
|
|
# File '' add_param :verbose_stacktraces, Boolean |
- (Boolean) verify_digests
Verifies the libraries loaded at runtime are the correct ones.
|
|
# File '' add_param :verify_digests, Boolean |
- (Boolean) warn_warning_type
Enables specified warnings.
|
|
# File '' add_param :warn_warning_type, Boolean |
- (Boolean) warnings
Enables all warnings. Set to false to disable all warnings. This option overrides the warn-warning_type options.
The default value is true.
|
|
# File '' add_param :warnings, Boolean |
Instance Method Details
- (Object) execute
Temporary override while waiting for integration of next version! TODO: Remove this method override.
1035 1036 1037 1038 |
# File 'flashsdk/lib/flashsdk/compiler_base.rb', line 1035 def execute prepare super end |
- (Object) execute_delegate (protected)
override
1081 1082 1083 |
# File 'flashsdk/lib/flashsdk/compiler_base.rb', line 1081 def execute_delegate (use_fcsh) ? execute_with_fcsh : super end |
- (Object) execute_with_fcsh (protected)
1085 1086 1087 1088 |
# File 'flashsdk/lib/flashsdk/compiler_base.rb', line 1085 def execute_with_fcsh client = FlashSDK::FCSHSocket.new client.execute "#{executable.to_s} #{to_shell}", ENV['FCSH_PORT'] end |
- (File) library_added(path) (protected)
Template method called by Sprout::Executable when a Sprout::Library is found in the Rake::Task prerequisite list.
1063 1064 1065 1066 1067 1068 1069 1070 |
# File 'flashsdk/lib/flashsdk/compiler_base.rb', line 1063 def library_added path if(path =~ /\.swc$/) self.library_path << path else self.source_path << path end path end |
- (Object) prepare (protected)
override
1074 1075 1076 1077 |
# File 'flashsdk/lib/flashsdk/compiler_base.rb', line 1074 def prepare update_fcsh if use_fcsh.nil? super end |
- (Object) update_fcsh (protected)
1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 |
# File 'flashsdk/lib/flashsdk/compiler_base.rb', line 1042 def update_fcsh # Check for USE_FCSH on the environment # variable hash, update instance value # if found to be true: if ENV['USE_FCSH'].to_s == 'true' self.use_fcsh = true end if !ENV['FCSH_PORT'].nil? self.fcsh_port = ENV['FCSH_PORT'] end end |