lib/flashsdk/compiler_base.rb in flashsdk-1.0.13.pre vs lib/flashsdk/compiler_base.rb in flashsdk-1.0.14.pre
- old
+ new
@@ -1,17 +1,23 @@
module FlashSDK
- class CompilerBase
- include Sprout::Executable
+ ##
+ # This is the abstract base class that defines common fields for ActionScript compilers like {FlashSDK::MXMLC} and {FlashSDK::COMPC}.
+ #
+ # @abstract
+ #
+ class CompilerBase < Sprout::Executable::Base
##
# Enables accessibility features when compiling the Flex application or SWC file. The default value is false.
#
+ # t.accessible = true
+ #
add_param :accessible, Boolean, { :hidden_value => true }
##
- # Sets the file encoding for ActionScript files. For more information see: http://livedocs.adobe.com/flex/2/docs/00001503.html#149244
+ # Sets the file encoding for ActionScript files.
#
add_param :actionscript_file_encoding, String
##
# Checks if a source-path entry is a subdirectory of another source-path entry. It helps make the package names of MXML components unambiguous. This is an advanced option.
@@ -32,26 +38,24 @@
add_param :benchmark, Boolean, { :default => true, :show_on_false => true }
##
# Sets the value of the {context.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.
#
- # For more information on using the {context.root} token, see http://livedocs.adobe.com/flex/2/docs/00001446.html#205687.
- #
add_param :context_root, Path
##
- # Sets metadata in the resulting SWF file. For more information, see Adding metadata to SWF files (http://livedocs.adobe.com/flex/2/docs/00001502.html#145380).
+ # Sets metadata in the resulting SWF file.
#
add_param :contributor, String
##
- # Sets metadata in the resulting SWF file. For more information, see Adding metadata to SWF files. (http://livedocs.adobe.com/flex/2/docs/00001502.html#145380)
+ # Sets metadata in the resulting SWF file.
#
add_param :creator, String
##
- # Sets metadata in the resulting SWF file. For more information, see Adding metadata to SWF files. (http://livedocs.adobe.com/flex/2/docs/00001502.html#145380)
+ # Sets metadata in the resulting SWF file.
#
add_param :date, String
##
# 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.
@@ -74,11 +78,11 @@
##
# Sets the application's background color. You use the 0x notation to set the color, as the following example shows:
#
# -default-background-color=0xCCCCFF
#
- # The default value is null. The default background of a Flex application is an image of a gray gradient. You must override this image for the value of the default-background-color option to be visible. For more information, see Editing application settings (http://livedocs.adobe.com/flex/2/docs/00001504.html#138781).
+ # The default value is null. The default background of a Flex application is an image of a gray gradient. You must override this image for the value of the default-background-color option to be visible.
#
# This is an advanced option.
#
add_param :default_background_color, String
@@ -120,25 +124,21 @@
add_param :default_size, String
##
# 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.
#
- # For more information on the defaults.css file, see Using Styles and Themes (http://livedocs.adobe.com/flex/2/docs/00000751.html#241755) in Flex 2 Developer's Guide.
- #
- # This is an advanced option.
- #
add_param :default_css_url, Url
##
# This parameter is normally called 'define' but thanks to scoping issues with Sprouts and Rake, we needed to rename it and chose: 'define_conditional'.
#
# Define a global AS3 conditional compilation definition, e.g. -define=CONFIG::debugging,true or -define+=CONFIG::debugging,true (to append to existing definitions in flex-config.xml) (advanced, repeatable)
#
add_param :define_conditional, Strings, { :shell_name => "-define" }
##
- # Sets metadata in the resulting SWF file. For more information, see Adding metadata to SWF files (http://livedocs.adobe.com/flex/2/docs/00001502.html#145380).
+ # Sets metadata in the resulting SWF file.
#
add_param :description, String
##
# Outputs the compiler options in the flex-config.xml file to the target path; for example:
@@ -163,21 +163,17 @@
##
# 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.
#
- # For more information about dynamic linking, see About linking (http://livedocs.adobe.com/flex/2/docs/00001521.html#205852).
- #
# This is an advanced option.
#
add_param :externs, Strings
##
# 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.
#
- # For more information about dynamic linking, see About linking (http://livedocs.adobe.com/flex/2/docs/00001521.html#205852).
- #
# You can use the += operator to append the new SWC file to the list of external libraries.
#
# This parameter has been aliased as +el+.
#
add_param :external_library_path, Files
@@ -191,32 +187,32 @@
# Specifies source files to compile. This is the default option for the mxmlc compiler.
#
add_param :file_specs, Files
##
- # Specifies the range of Unicode settings for that language. For more information, see Using Styles and Themes (http://livedocs.adobe.com/flex/2/docs/00000751.html#241755) in Flex 2 Developer's Guide.
+ # Specifies the range of Unicode settings for that language.
#
# This is an advanced option.
#
add_param :fonts_languages_language_range, String, { :shell_name => "-compiler.fonts.languages.language-range" }
##
- # Defines the font manager. The default is flash.fonts.JREFontManager. You can also use the flash.fonts.BatikFontManager. For more information, see Using Styles and Themes in Flex 2 Developer's Guide (http://livedocs.adobe.com/flex/2/docs/00000751.html#241755).
+ # Defines the font manager. The default is flash.fonts.JREFontManager. You can also use the flash.fonts.BatikFontManager.
#
# This is an advanced option.
#
add_param :fonts_managers, Strings
##
- # Sets the maximum number of fonts to keep in the server cache. For more information, see Caching fonts and glyphs (http://livedocs.adobe.com/flex/2/docs/00001469.html#208457).
+ # Sets the maximum number of fonts to keep in the server cache.
#
# This is an advanced option.
#
add_param :fonts_max_cached_fonts, Number
##
- # Sets the maximum number of character glyph-outlines to keep in the server cache for each font face. For more information, see Caching fonts and glyphs (http://livedocs.adobe.com/flex/2/docs/00001469.html#208457).
+ # Sets the maximum number of character glyph-outlines to keep in the server cache for each font face.
#
# This is an advanced option.
#
add_param :fonts_max_glyphs_per_face, Number
@@ -269,11 +265,11 @@
# 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 imported or not.
add_param :include_path, Paths
##
- # Enables incremental compilation. For more information, see About incremental compilation (http://livedocs.adobe.com/flex/2/docs/00001506.html#153980).
+ # 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.
#
add_param :incremental, Boolean
@@ -309,11 +305,11 @@
# The default value is false.\nThis is an advanced option.
#
add_param :keep_generated_actionscript, Boolean
##
- # Sets metadata in the resulting SWF file. For more information, see Adding metadata to SWF files (http://livedocs.adobe.com/flex/2/docs/00001502.html#145380).
+ # Sets metadata in the resulting SWF file.
#
add_param :language, String
##
# Enables ABC bytecode lazy initialization.
@@ -373,12 +369,10 @@
#
# 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.
#
- # For more information on the report, see Examining linker dependencies (http://livedocs.adobe.com/flex/2/docs/00001394.html#211202).
- #
# This is an advanced option.
#
add_param :link_report, File
##
@@ -388,12 +382,10 @@
#
# All relative paths in the configuration file are relative to the location of the configuration file itself.
#
# Use the += operator to chain this configuration file to other configuration files.
#
- # For more information on using configuration files to provide options to the command-line compilers, see About configuration files (http://livedocs.adobe.com/flex/2/docs/00001490.html#138195).
- #
add_param :load_config, Files
##
# Specifies the location of an XML file that contains
#
@@ -401,18 +393,12 @@
#
# 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.
#
- # For more information on the report, see Examining linker dependencies (http://livedocs.adobe.com/flex/2/docs/00001394.html#211202).
- #
# This option provides compile-time link checking for external components that are dynamically linked.
#
- # For more information about dynamic linking, see About linking (http://livedocs.adobe.com/flex/2/docs/00001521.html#205852).
- #
- # This is an advanced option.
- #
add_param :load_externs, File
##
# Specifies the locale that should be packaged in the SWF file (for example, en_EN).
#
@@ -422,29 +408,25 @@
# You must also include the parent directory of the individual locale directories,
# plus the token {locale}, in the source-path; for example:
#
# mxmlc -locale en_EN -source-path locale/{locale} -file-specs MainApp.mxml
#
- # For more information, see Localizing Flex Applicationsin (http://livedocs.adobe.com/flex/2/docs/00000898.html#129288) Flex 2 Developer's Guide.
- #
add_param :locale, String
##
- # Sets metadata in the resulting SWF file. For more information, see Adding metadata to SWF files (http://livedocs.adobe.com/flex/2/docs/00001502.html#145380).
+ # Sets metadata in the resulting SWF file.
#
add_param :localized_description, String
##
- # Sets metadata in the resulting SWF file. For more information, see Adding metadata to SWF files (http://livedocs.adobe.com/flex/2/docs/00001502.html#145380)."
+ # Sets metadata in the resulting SWF file.
#
add_param :localized_title, String
##
# 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.
#
- # For more information about manifest files, see About manifest files (http://livedocs.adobe.com/flex/2/docs/00001519.html#134676).
- #
add_param :namespaces_namespace, String
##
# Enables the ActionScript optimizer. This optimizer reduces file size and increases performance by optimizing the SWF file's bytecode.
#
@@ -464,11 +446,11 @@
# When using this option with the component compiler, the output is a SWC file rather than a SWF file.
#
add_param :output, File, { :file_task_name => true }
##
- # Sets metadata in the resulting SWF file. For more information, see Adding metadata to SWF files (http://livedocs.adobe.com/flex/2/docs/00001502.html#145380).
+ # Sets metadata in the resulting SWF file.
#
add_param :publisher, String
##
# XML text to store in the SWF metadata (overrides metadata.* configuration) (advanced)
@@ -476,32 +458,31 @@
add_param :raw_metadata, String
##
# 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.
#
- # For more information, see Localizing Flex Applications (http://livedocs.adobe.com/flex/2/docs/00000898.html#129288) in Flex 2 Developer's Guide.
- #
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.
#
- # For more information about RSLs, see Using Runtime Shared Libraries. (http://livedocs.adobe.com/flex/2/docs/00001520.html#168690)
- #
add_param :runtime_shared_libraries, Strings
##
# Alias for runtime_shared_libraries
#
add_param_alias :rsl, :runtime_shared_libraries
##
- # [path-element] [rsl-url] [policy-file-url] [rsl-url] [policy-file-url]
- # alias -rslp
- # (repeatable)
+ # Runtime shared library path.
+ #
+ # t.runtime_shared_library_path << "[path-element] [rsl-url] [policy-file-url]"
+ #
+ # @see Sprout::MXMLC#rslp
+ #
add_param :runtime_shared_library_path, Strings
##
# Alias for runtime_shared_library_path
#
@@ -515,30 +496,24 @@
##
# Shows warnings for ActionScript classes.
#
# The default value is true.
#
- # For more information about viewing warnings and errors, see Viewing warnings and errors (http://livedocs.adobe.com/flex/2/docs/00001517.html#182413).
- #
add_param :show_actionscript_warnings, Boolean, { :default => true, :show_on_false => true }
##
# Shows a warning when Flash Player cannot detect changes to a bound property.
#
# The default value is true.
#
- # For more information about compiler warnings, see Using SWC files (http://livedocs.adobe.com/flex/2/docs/00001505.html#158337).
- #
add_param :show_binding_warnings, Boolean, { :default => true, :show_on_false => true }
##
# Shows deprecation warnings for Flex components. To see warnings for ActionScript classes, use the show-actionscript-warnings option.
#
# The default value is true.
#
- # For more information about viewing warnings and errors, see Viewing warnings and errors.
- #
add_param :show_deprecation_warnings, Boolean, { :default => true, :show_on_false => true }
##
# Adds directories or files to the source path. The Flex compiler searches directories in the source path for MXML or AS source files that are used in your Flex applications and includes those that are required at compile time.
#
@@ -569,12 +544,10 @@
##
# Prints undefined property and function calls; also performs compile-time type checking on assignments and options supplied to method calls.
#
# The default value is true.
#
- # For more information about viewing warnings and errors, see Viewing warnings and errors (http://livedocs.adobe.com/flex/2/docs/00001517.html#182413).
- #
add_param :strict, Boolean, { :default => true, :show_on_false => true }
##
# Specifies the version of the player the application is targeting.
#
@@ -588,23 +561,21 @@
# For information on compiling a SWC theme file, see Using Styles and Themes (http://livedocs.adobe.com/flex/2/docs/00000751.html#241755) in Flex 2 Developer's Guide.
#
add_param :theme, Files
##
- # Sets metadata in the resulting SWF file. For more information, see Adding metadata to SWF files (http://livedocs.adobe.com/flex/2/docs/00001502.html#145380).
+ # Sets metadata in the resulting SWF file.
#
add_param :title, String
-
+
##
# 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.
#
- # For more information about the use-network property, see Applying Flex Security (http://livedocs.adobe.com/flex/2/docs/00001328.html#137544).
- #
add_param :use_network, Boolean, { :default => true, :show_on_false => true }
##
# Generates source code that includes line numbers. When a run-time error occurs, the stacktrace shows these line numbers.
#
@@ -616,26 +587,105 @@
# Verifies the libraries loaded at runtime are the correct ones.
#
add_param :verify_digests, Boolean
##
- # Enables specified warnings. For more information, see Viewing warnings and errors (http://livedocs.adobe.com/flex/2/docs/00001517.html#182413).
+ # Enables specified warnings.
#
add_param :warn_warning_type, Boolean
##
# Enables all warnings. Set to false to disable all warnings. This option overrides the warn-warning_type options.
#
# The default value is true.
#
add_param :warnings, Boolean
+ ##
+ # 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
+ #
+ attr_accessor :use_fcsh
+
+ ##
+ # Temporary override while waiting for integration of next version!
+ # TODO: Remove this method override.
+ def execute
+ prepare
+ super
+ end
+
+ protected
+
+ ##
+ # Template method called by {Sprout::Executable} when
+ # a {Sprout::Library} is found in the Rake::Task prerequisite list.
+ #
+ # @param path [File] The path within the project where the library was copied.
+ #
+ # @return [File] The path that was provided.
+ #
def library_added path
if(path =~ /\.swc$/)
self.library_path << path
else
self.source_path << path
end
+ path
+ end
+
+ ##
+ # @override
+ def prepare
+ # 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
+ super
+ end
+
+ ##
+ # @override
+ def execute_delegate
+ (use_fcsh) ? execute_with_fcsh : super
+ end
+
+ def execute_with_fcsh
+ #puts "[execute_with_fcsh] #{executable} #{to_shell}"
end
end
end