Class: FlashSDK::COMPC

Inherits:
CompilerBase
  • Object
show all
Defined in:
lib/flashsdk/compc.rb

Overview

The COMPC compiler is a tool that creates SWC libraries from source code.

Following is an example of the creation of a simple SWC file:

compc 'bin/SomeProject.swc' do |t|
  t.include_classes << 'SomeProject'
  t.source_path << 'src'
end

desc 'Compile the SWC'
task :swc => 'bin/SomeProject.swc'

Direct Known Subclasses

ACOMPC

Instance Attribute Summary

Attributes inherited from CompilerBase

#fcsh_port, #use_fcsh

Instance Method Summary collapse

Methods inherited from CompilerBase

#accessible, #actionscript_file_encoding, #allow_source_path_overlap, #as3, #benchmark, #context_root, #contributor, #creator, #date, #debug, #debug_password, #default_background_color, #default_css_url, #default_frame_rate, #default_script_limits, #default_size, #define_conditional, #description, #dump_config, #el, #es, #execute, #external_library_path, #externs, #file_specs, #fonts_languages_language_range, #fonts_managers, #fonts_max_cached_fonts, #fonts_max_glyphs_per_face, #frames_frame, #generate_frame_loader, #headless_server, #include_libraries, #include_path, #includes, #incremental, #keep_as3_metadata, #keep_generated_actionscript, #l, #language, #lazy_init, #library_path, #license, #link_report, #load_config, #load_externs, #locale, #localized_description, #localized_title, #namespaces_namespace, #optimize, #output, #publisher, #raw_metadata, #resource_bundle_list, #rsl, #rslp, #runtime_shared_libraries, #runtime_shared_library_path, #services, #show_actionscript_warnings, #show_binding_warnings, #show_deprecation_warnings, #show_shadowed_device_font_warnings, #show_unused_type_selector_warnings, #source_path, #static_link_runtime_shared_libraries, #static_rsls, #strict, #target_player, #theme, #title, #use_network, #use_resource_bundle_metadata, #verbose_stacktraces, #verify_digests, #warn_warning_type, #warnings

Instance Method Details

#directoryObject

Outputs the SWC content as a SWF into an open directory format rather than a SWC file.

This is especially useful for creating Runtime Shared Libraries.

compc "bin/rsls/foo" do |t|
  t.directory = true
  t.include_sources = 'src'
end

See Also:

  • Sprout::COMPC#include_sources


30
# File 'lib/flashsdk/compc.rb', line 30

add_param :directory, Boolean

#executableObject

The default executable target.



115
# File 'lib/flashsdk/compc.rb', line 115

set :executable, :compc

#include_classesObject

Specifies classes to include in the SWC file. You provide the class name (for example, MyClass) rather than the file name (for example, MyClass.as) to the file for this option. As a result, all classes specified with this option must be in the compiler’s source path. You specify this by using the source-path compiler option.

You can use packaged and unpackaged classes. To use components in namespaces, use the include-namespaces option.

If the components are in packages, ensure that you use dot-notation rather than slashes to separate package levels.

This is the default option for the component compiler.



41
# File 'lib/flashsdk/compc.rb', line 41

add_param :include_classes, Strings

#include_fileObject

Adds the file to the SWC file. This option does not embed files inside the library.swf file. This is useful for skinning and theming, where you want to add non-compiled files that can be referenced in a style sheet or embedded as assets in MXML files.

If you use the [Embed] syntax to add a resource to your application, you are not required to use this option to also link it into the SWC file.

For more information, see Adding nonsource classes (livedocs.adobe.com/flex/201/html/compilers_123_39.html#158900).



53
# File 'lib/flashsdk/compc.rb', line 53

add_param :include_file, Files

#include_namespacesObject

Specifies namespace-style components in the SWC file. You specify a list of URIs to include in the SWC file. The uri argument must already be defined with the namespace option.

To use components in packages, use the include-classes option.



62
# File 'lib/flashsdk/compc.rb', line 62

add_param :include_namespaces, Strings

#include_resource_bundlesObject

Specifies the resource bundles to include in this SWC file. All resource bundles specified with this option must be in the compiler’s source path. You specify this using the source-path compiler option.

For more information on using resource bundles, see Localizing Flex Applications (livedocs.adobe.com/flex/201/html/l10n_076_1.html#129288) in Flex 2 Developer’s Guide.



69
# File 'lib/flashsdk/compc.rb', line 69

add_param :include_resource_bundles, Files

#include_sourcesObject

Specifies classes or directories to add to the SWC file. When specifying classes, you specify the path to the class file (for example, MyClass.as) rather than the class name itself (for example, MyClass). This lets you add classes to the SWC file that are not in the source path. In general, though, use the include-classes option, which lets you add classes that are in the source path.

If you specify a directory, this option includes all files with an MXML or AS extension, and ignores all other files.

compc "bin/SomeProject.swc" do |t|
  t.include_sources << 'src'
  t.library_path << 'lib/somelib.swc'
end

You’ll need to be sure your source path and library path are both set up properly for this work.



83
# File 'lib/flashsdk/compc.rb', line 83

add_param :include_sources, Paths

#input_classObject

Main source Class to send compiler. If used, this should be the last item in the list



96
# File 'lib/flashsdk/compc.rb', line 96

add_param :input_class, String, { :hidden_name => true }

#namespaceObject

Defines the mapping between your namespaces and the manifest.xml file describing the classes in that namespace.

compc "bin/SomeProject.swc" do |t|
  t.namespace = 'http://sprouts.org/ui sprouts-manifest.xml'
end


91
# File 'lib/flashsdk/compc.rb', line 91

add_param :namespace, String

#pkg_nameObject

The the Ruby file that will load the expected Sprout::Specification.

Default value is ‘flex4’



105
# File 'lib/flashsdk/compc.rb', line 105

set :pkg_name, 'flex4'

#pkg_versionObject

The default pkg version



110
# File 'lib/flashsdk/compc.rb', line 110

set :pkg_version, ">= #{FlashSDK::VERSION}"