flashsdk_sqe 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. data/Gemfile +3 -0
  2. data/Gemfile.lock +41 -0
  3. data/POSTINSTALL.rdoc +81 -0
  4. data/README.textile +79 -0
  5. data/VERSION +1 -0
  6. data/bin/flashlog +8 -0
  7. data/bin/flashplayer +9 -0
  8. data/bin/sprout-as3 +9 -0
  9. data/bin/sprout-flex +8 -0
  10. data/ext/CloseFlashPlayerForDumbassOSX.scpt +6 -0
  11. data/ext/OpenFlashPlayerForDumbassOSX.scpt +12 -0
  12. data/flashsdk_sqe.gemspec +25 -0
  13. data/lib/flashplayer.rb +9 -0
  14. data/lib/flashplayer/errors.rb +12 -0
  15. data/lib/flashplayer/executable.rb +142 -0
  16. data/lib/flashplayer/log_file.rb +100 -0
  17. data/lib/flashplayer/mm_config.rb +96 -0
  18. data/lib/flashplayer/module.rb +51 -0
  19. data/lib/flashplayer/specification.rb +45 -0
  20. data/lib/flashplayer/system_mixins.rb +98 -0
  21. data/lib/flashplayer/task.legacy.rb +293 -0
  22. data/lib/flashplayer/task.rb +62 -0
  23. data/lib/flashplayer/trust.rb +45 -0
  24. data/lib/flashsdk.rb +24 -0
  25. data/lib/flashsdk/acompc.rb +29 -0
  26. data/lib/flashsdk/adl.rb +83 -0
  27. data/lib/flashsdk/adt.rb +276 -0
  28. data/lib/flashsdk/amxmlc.rb +28 -0
  29. data/lib/flashsdk/asdoc.rb +164 -0
  30. data/lib/flashsdk/compc.rb +124 -0
  31. data/lib/flashsdk/compiler_base.rb +1131 -0
  32. data/lib/flashsdk/fcsh.rb +173 -0
  33. data/lib/flashsdk/fcsh_socket.rb +167 -0
  34. data/lib/flashsdk/fdb.rb +833 -0
  35. data/lib/flashsdk/generators/class_generator.rb +87 -0
  36. data/lib/flashsdk/generators/flash_helper.rb +234 -0
  37. data/lib/flashsdk/generators/flex_project_generator.rb +30 -0
  38. data/lib/flashsdk/generators/project_generator.rb +31 -0
  39. data/lib/flashsdk/generators/templates/ActionScript3Class.as +9 -0
  40. data/lib/flashsdk/generators/templates/ActionScript3MainClass.as +11 -0
  41. data/lib/flashsdk/generators/templates/ActionScript3RunnerClass.as +19 -0
  42. data/lib/flashsdk/generators/templates/DefaultProjectImage.png +0 -0
  43. data/lib/flashsdk/generators/templates/Flex4Application.mxml +45 -0
  44. data/lib/flashsdk/generators/templates/Flex4Main.css +7 -0
  45. data/lib/flashsdk/generators/templates/Flex4Rakefile.rb +34 -0
  46. data/lib/flashsdk/generators/templates/Flex4RunnerClass.mxml +29 -0
  47. data/lib/flashsdk/generators/templates/FlexTestRunner.mxml +0 -0
  48. data/lib/flashsdk/generators/templates/Gemfile +5 -0
  49. data/lib/flashsdk/generators/templates/rakefile.rb +79 -0
  50. data/lib/flashsdk/module.rb +107 -0
  51. data/lib/flashsdk/mxmlc.rb +160 -0
  52. data/lib/flex3.rb +54 -0
  53. data/lib/flex4.rb +115 -0
  54. data/pkg/flashsdk_sqe-0.0.1.gem +0 -0
  55. data/rakefile.rb +42 -0
  56. data/test/fixtures/acompc/simple/SomeAirFile.as +11 -0
  57. data/test/fixtures/air/simple/SomeProject.apk +1 -0
  58. data/test/fixtures/air/simple/SomeProject.as +11 -0
  59. data/test/fixtures/air/simple/SomeProject.mxml +9 -0
  60. data/test/fixtures/air/simple/SomeProject.pfx +0 -0
  61. data/test/fixtures/air/simple/SomeProject.swf +0 -0
  62. data/test/fixtures/air/simple/SomeProject.xml +13 -0
  63. data/test/fixtures/asdoc/lib/OtherFile.as +17 -0
  64. data/test/fixtures/asdoc/src/SomeFile.as +11 -0
  65. data/test/fixtures/compc/simple/SomeFile.as +11 -0
  66. data/test/fixtures/flashplayer/AsUnit Runner.swf +0 -0
  67. data/test/fixtures/mxmlc/broken/SomeFile.as +10 -0
  68. data/test/fixtures/mxmlc/simple/SomeFile.as +11 -0
  69. data/test/fixtures/sdk/fdb +90 -0
  70. data/test/fixtures/sdk/mxmlc +56 -0
  71. data/test/unit/acompc_test.rb +37 -0
  72. data/test/unit/adl_test.rb +32 -0
  73. data/test/unit/adt_test.rb +185 -0
  74. data/test/unit/amxmlc_test.rb +55 -0
  75. data/test/unit/asdoc_test.rb +45 -0
  76. data/test/unit/class_generator_test.rb +56 -0
  77. data/test/unit/compc_test.rb +37 -0
  78. data/test/unit/fake_flashplayer_system.rb +11 -0
  79. data/test/unit/fcsh_socket_test.rb +53 -0
  80. data/test/unit/fcsh_test.rb +55 -0
  81. data/test/unit/fdb_test.rb +54 -0
  82. data/test/unit/flash_helper_test.rb +43 -0
  83. data/test/unit/flashplayer_executable_test.rb +69 -0
  84. data/test/unit/flashplayer_log_file_test.rb +47 -0
  85. data/test/unit/flashplayer_mm_config_test.rb +74 -0
  86. data/test/unit/flashplayer_module_test.rb +56 -0
  87. data/test/unit/flashplayer_task_test.rb +91 -0
  88. data/test/unit/flashplayer_trust_test.rb +30 -0
  89. data/test/unit/flex_compiler_options_test.rb +213 -0
  90. data/test/unit/flex_generator_test.rb +37 -0
  91. data/test/unit/mxmlc_test.rb +65 -0
  92. data/test/unit/project_generator_test.rb +57 -0
  93. data/test/unit/test_helper.rb +18 -0
  94. metadata +200 -0
@@ -0,0 +1,28 @@
1
+ module FlashSDK
2
+
3
+ ##
4
+ # This is a wrapper for the AIR MXMLC compiler.
5
+ class AMXMLC < MXMLC
6
+
7
+ ##
8
+ # The default executable target.
9
+ #
10
+ set :executable, :amxmlc
11
+
12
+ ##
13
+ # TODO: Remove this method once this bug is fixed:
14
+ # http://www.pivotaltracker.com/story/show/4194771
15
+ #
16
+ def execute *args
17
+ self.executable = :amxmlc
18
+ super
19
+ end
20
+ end
21
+ end
22
+
23
+ def amxmlc *args, &block
24
+ exe = FlashSDK::AMXMLC.new
25
+ exe.to_rake *args, &block
26
+ exe
27
+ end
28
+
@@ -0,0 +1,164 @@
1
+ module FlashSDK
2
+
3
+ ##
4
+ # The AsDoc executable is a wrapper around the Flex SDK binary of the same name.
5
+ #
6
+ # Following is a simple example of the asdoc Rake task:
7
+ #
8
+ # desc "Generate documentation at <%= doc %>/"
9
+ # asdoc 'doc' do |t|
10
+ # t.doc_sources << 'src'
11
+ #
12
+ # # Exclude test main file
13
+ # t.exclude_sources << 'src/SomeProjectRunner.as'
14
+ # end
15
+ #
16
+ # @see CompilerBase
17
+ #
18
+ class AsDoc < CompilerBase
19
+
20
+ ##
21
+ # The default prefix for shell params.
22
+ set :default_prefix, '-'
23
+
24
+ ##
25
+ # The the Ruby file that will load the expected
26
+ # Sprout::Specification.
27
+ #
28
+ # Default value is 'flex4'
29
+ #
30
+ set :pkg_name, 'flex4'
31
+
32
+ ##
33
+ # The default pkg version
34
+ #
35
+ set :pkg_version, ">= #{FlashSDK::VERSION}"
36
+
37
+ ##
38
+ # The default executable target.
39
+ #
40
+ set :executable, :asdoc
41
+
42
+ ##
43
+ # Boolean specifies whether to include the date in the footer.
44
+ add_param :date_in_footer, Boolean
45
+
46
+ ##
47
+ # List of source file to include in the documentation.
48
+ add_param :doc_sources, Files
49
+ add_param_alias :ds, :doc_sources
50
+
51
+ ##
52
+ # List of classes to include in the documentation.
53
+ add_param :doc_classes, Strings
54
+
55
+ ##
56
+ # List of namespaces to include in the documentation.
57
+ add_param :doc_namespaces, Strings
58
+
59
+ ##
60
+ # Path to look for the example files.
61
+ add_param :examples_path, Paths
62
+
63
+ ##
64
+ # Classes to exclude from documentation.
65
+ add_param :exclude_classes, Strings
66
+
67
+ ##
68
+ # Boolean specifying whether to exclude dependencies.
69
+ add_param :exclude_dependencies, Boolean
70
+
71
+ ##
72
+ # List of source files to exclude form the documentation.
73
+ add_param :exclude_sources, Files
74
+
75
+ ##
76
+ # Footer string to be displayed in the documentation.
77
+ add_param :footer, String
78
+
79
+ add_param :include_all_for_asdoc, Boolean
80
+
81
+ ##
82
+ # If true, manifest entries with lookupOnly=true are included in SWC
83
+ # catalog. Default is false. (advanced)
84
+ add_param :include_lookup_only, Boolean, { :default => false }
85
+
86
+ ##
87
+ # Width of the left frame.
88
+ add_param :left_frameset_width, Number
89
+
90
+ ##
91
+ # Report well-formed HTML errors as warnings.
92
+ add_param :lenient, Boolean
93
+
94
+ ##
95
+ # Title to be displayed in the title bar.
96
+ add_param :main_title, String
97
+
98
+ ##
99
+ # File containing description for packages.
100
+ add_param :package_description_file, Files
101
+
102
+ ##
103
+ # Specifies a description for a package name.
104
+ add_param :package, Strings, { :delimiter => ' ' }
105
+
106
+ ##
107
+ # Path for custom templates.
108
+ add_param :templates_path, Path
109
+
110
+ ##
111
+ # Title to be displayed in the browser window.
112
+ add_param :window_title, String
113
+
114
+ # TODO: Possibly remove the following from the CompilerBase
115
+ #
116
+ # include_resource_bundles
117
+
118
+ def execute
119
+ # Never use fcsh for asdoc
120
+ # (overused inheritance smell)
121
+ self.use_fcsh = false
122
+ duration = Benchmark.measure { super }
123
+ Sprout.stdout.puts "[ASDOC] Creation complete in #{duration} seconds."
124
+ end
125
+
126
+ protected
127
+
128
+ ##
129
+ # Override the default behavior that creates a file task,
130
+ # and create a 'task' instead. This will force the docs
131
+ # to get recreated with every run, instead of failing to
132
+ # create when the outer folder still exists.
133
+ def create_outer_task *args
134
+ Rake::Task.define_task *args do
135
+ execute
136
+ end
137
+ end
138
+ end
139
+ end
140
+
141
+ ##
142
+ # Create a new Rake::File task that will execute {FlashSDK::AsDoc}.
143
+ #
144
+ # @return [FlashSDK::AsDoc]
145
+ #
146
+ # @example The following is a simple AsDoc task:
147
+ #
148
+ # desc "Compile the SWF"
149
+ # mxmlc 'bin/SomeProject.swf' do |t|
150
+ # t.library_path << 'lib/corelib.swc'
151
+ # t.input = 'src/SomeProject.as'
152
+ # end
153
+ #
154
+ # desc "Generate documentation"
155
+ # asdoc 'docs/' do |t|
156
+ # t.doc_sources << 'src'
157
+ # end
158
+ #
159
+ def asdoc args, &block
160
+ exe = FlashSDK::AsDoc.new
161
+ exe.to_rake args, &block
162
+ exe
163
+ end
164
+
@@ -0,0 +1,124 @@
1
+ module FlashSDK
2
+
3
+ ##
4
+ # The COMPC compiler is a tool that creates SWC libraries from source code.
5
+ #
6
+ # Following is an example of the creation of a simple SWC file:
7
+ #
8
+ # compc 'bin/SomeProject.swc' do |t|
9
+ # t.include_classes << 'SomeProject'
10
+ # t.source_path << 'src'
11
+ # end
12
+ #
13
+ # desc 'Compile the SWC'
14
+ # task :swc => 'bin/SomeProject.swc'
15
+ #
16
+ class COMPC < CompilerBase
17
+
18
+ ##
19
+ # Outputs the SWC content as a SWF into an open directory format rather than a SWC file.
20
+ #
21
+ # This is especially useful for creating Runtime Shared Libraries.
22
+ #
23
+ # compc "bin/rsls/foo" do |t|
24
+ # t.directory = true
25
+ # t.include_sources = 'src'
26
+ # end
27
+ #
28
+ # @see Sprout::COMPC#include_sources
29
+ #
30
+ add_param :directory, Boolean
31
+
32
+ ##
33
+ # 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.
34
+ #
35
+ # You can use packaged and unpackaged classes. To use components in namespaces, use the include-namespaces option.
36
+ #
37
+ # If the components are in packages, ensure that you use dot-notation rather than slashes to separate package levels.
38
+ #
39
+ # This is the default option for the component compiler.
40
+ #
41
+ add_param :include_classes, Strings
42
+
43
+ add_param_alias :ic, :include_classes
44
+
45
+
46
+ ##
47
+ # 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.
48
+ #
49
+ # 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.
50
+ #
51
+ # For more information, see Adding nonsource classes (http://livedocs.adobe.com/flex/201/html/compilers_123_39.html#158900).
52
+ #
53
+ add_param :include_file, Files
54
+
55
+ add_param :include_lookup_only, Boolean
56
+
57
+ ##
58
+ # 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.
59
+ #
60
+ # To use components in packages, use the include-classes option.
61
+ #
62
+ add_param :include_namespaces, Strings
63
+
64
+ ##
65
+ # 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.
66
+ #
67
+ # For more information on using resource bundles, see Localizing Flex Applications (http://livedocs.adobe.com/flex/201/html/l10n_076_1.html#129288) in Flex 2 Developer's Guide.
68
+ #
69
+ add_param :include_resource_bundles, Files
70
+
71
+ ##
72
+ # 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.
73
+ #
74
+ # If you specify a directory, this option includes all files with an MXML or AS extension, and ignores all other files.
75
+ #
76
+ # compc "bin/SomeProject.swc" do |t|
77
+ # t.include_sources << 'src'
78
+ # t.library_path << 'lib/somelib.swc'
79
+ # end
80
+ #
81
+ # You'll need to be sure your source path and library path are both set up properly for this work.
82
+ #
83
+ add_param :include_sources, Paths
84
+
85
+ ##
86
+ # Defines the mapping between your namespaces and the manifest.xml file describing the classes in that namespace.
87
+ #
88
+ # compc "bin/SomeProject.swc" do |t|
89
+ # t.namespace = 'http://sprouts.org/ui sprouts-manifest.xml'
90
+ # end
91
+ add_param :namespace, String
92
+
93
+ ##
94
+ # Main source Class to send compiler.
95
+ # If used, this should be the last item in the list
96
+ add_param :input_class, String, { :hidden_name => true }
97
+
98
+
99
+ ##
100
+ # The the Ruby file that will load the expected
101
+ # Sprout::Specification.
102
+ #
103
+ # Default value is 'flex4'
104
+ #
105
+ set :pkg_name, 'flex4'
106
+
107
+ ##
108
+ # The default pkg version
109
+ #
110
+ set :pkg_version, ">= #{FlashSDK::VERSION}"
111
+
112
+ ##
113
+ # The default executable target.
114
+ #
115
+ set :executable, :compc
116
+ end
117
+ end
118
+
119
+ def compc args, &block
120
+ exe = FlashSDK::COMPC.new
121
+ exe.to_rake(args, &block)
122
+ exe
123
+ end
124
+
@@ -0,0 +1,1131 @@
1
+ module FlashSDK
2
+
3
+ ##
4
+ # This is the abstract base class that defines common fields for ActionScript compilers like {FlashSDK::MXMLC} and {FlashSDK::COMPC}.
5
+ #
6
+ # Examples provided below will assume {MXMLC} is being used, but should generally be applicable for any subclass.
7
+ #
8
+ # @abstract
9
+ #
10
+ class CompilerBase < Sprout::Executable::Base
11
+
12
+ ##
13
+ # Enables accessibility features when compiling the Flex application or SWC file. The default value is false.
14
+ #
15
+ # desc "Compile the Application"
16
+ # mxmlc 'bin/SomeProject.swf' do |t|
17
+ # t.input = 'src/SomeProject.as'
18
+ # t.source_path << 'src'
19
+ # t.accessible = true
20
+ # end
21
+ #
22
+ add_param :accessible, Boolean, { :hidden_value => true }
23
+
24
+ ##
25
+ # Sets the file encoding for ActionScript files.
26
+ #
27
+ add_param :actionscript_file_encoding, String
28
+
29
+ ##
30
+ # Checks if a source-path entry is a subdirectory of another source-path entry. It helps make the package names of MXML components unambiguous.
31
+ #
32
+ # desc "Compile the Application"
33
+ # mxmlc 'bin/SomeProject.swf' do |t|
34
+ # t.input = 'src/SomeProject.as'
35
+ # t.source_path << 'src'
36
+ # t.source_path << 'src/com/foo'
37
+ # t.allow_source_path_overlap = true
38
+ # end
39
+ #
40
+ add_param :allow_source_path_overlap, Boolean, { :hidden_value => true }
41
+
42
+ ##
43
+ # 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.
44
+ #
45
+ # Setting this value to false will switch the compiler into a more ECMA-compatible mode.
46
+ #
47
+ # The default value is true. If you set this value to false, you must set the es option to true.
48
+ #
49
+ # desc "Compile the Application"
50
+ # mxmlc 'bin/SomeProject.swf' do |t|
51
+ # t.input = 'src/SomeProject.as'
52
+ # t.source_path << 'src'
53
+ # t.as3 = false
54
+ # end
55
+ #
56
+ add_param :as3, Boolean, { :default => true, :show_on_false => true, :hidden_value => false, :delimiter => '=' }
57
+
58
+ ##
59
+ # Prints detailed compile times to the standard output. The default value is true.
60
+ #
61
+ # desc "Compile the Application"
62
+ # mxmlc 'bin/SomeProject.swf' do |t|
63
+ # t.input = 'src/SomeProject.as'
64
+ # t.source_path << 'src'
65
+ # t.benchmark = true
66
+ # end
67
+ #
68
+ add_param :benchmark, Boolean, { :default => true, :show_on_false => true, :hidden_value => false, :delimiter => '=' }
69
+
70
+ ##
71
+ # 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.
72
+ #
73
+ add_param :context_root, Path
74
+
75
+ ##
76
+ # Sets metadata in the resulting SWF file.
77
+ #
78
+ add_param :contributor, String
79
+
80
+ ##
81
+ # Sets metadata in the resulting SWF file.
82
+ #
83
+ add_param :creator, String
84
+
85
+ ##
86
+ # Sets metadata in the resulting SWF file.
87
+ #
88
+ add_param :date, String
89
+
90
+ ##
91
+ # 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.
92
+ #
93
+ # For the mxmlc compiler, the default value is false. For the compc compiler, the default value is true.
94
+ #
95
+ # 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.
96
+ #
97
+ # For information about the command-line debugger, see Using the Command-Line Debugger (http://livedocs.adobe.com/flex/2/docs/00001540.html#181846).
98
+ #
99
+ # Flex also uses the verbose-stacktraces setting to determine whether line numbers are added to the stacktrace.
100
+ #
101
+ # desc "Compile the Application"
102
+ # mxmlc 'bin/SomeProject.swf' do |t|
103
+ # t.input = 'src/SomeProject.as'
104
+ # t.source_path << 'src'
105
+ # t.debug = true
106
+ # end
107
+ #
108
+ # @see #optimize
109
+ # @see #verbose_stacktraces
110
+ #
111
+ add_param :debug, Boolean, { :hidden_value => true }
112
+
113
+ ##
114
+ # Lets you engage in remote debugging sessions with the Flash IDE.
115
+ #
116
+ add_param :debug_password, String
117
+
118
+ ##
119
+ # Sets the SWF background color.
120
+ #
121
+ # If you're using the Flex framework, the default background IMAGE is that sickly, horrendous, blue-green-grey gradient.
122
+ #
123
+ # If you want to see the background color that you set here, you will also need to override the +backgroundImage+ property
124
+ # in your Flex Application document.
125
+ #
126
+ # You can also set the background color (and other values) using the +[Embed]+ metadata directive directly in your Document Root class.
127
+ #
128
+ # [SWF(width='400', height='300', backgroundColor='#ffffff', frameRate='30')]
129
+ #
130
+ # To set the background color from a Rake task, use the 0x notation, as the following example shows:
131
+ #
132
+ # desc "Compile the Application"
133
+ # mxmlc 'bin/SomeProject.swf' do |t|
134
+ # t.input = 'src/SomeProject.as'
135
+ # t.source_path << 'src'
136
+ # t.default_background_color = '0xffcc00'
137
+ # end
138
+ #
139
+ add_param :default_background_color, String
140
+
141
+ ##
142
+ # Sets the application's frame rate. The default value is 24.
143
+ #
144
+ # desc "Compile the Application"
145
+ # mxmlc 'bin/SomeProject.swf' do |t|
146
+ # t.input = 'src/SomeProject.as'
147
+ # t.source_path << 'src'
148
+ # t.default_frame_rate = 24
149
+ # end
150
+ #
151
+ add_param :default_frame_rate, Number
152
+
153
+ ##
154
+ # Defines the application's script execution limits.
155
+ #
156
+ # 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.
157
+ #
158
+ # 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.
159
+ #
160
+ # Example:
161
+ #
162
+ # desc "Compile the Application"
163
+ # mxmlc 'bin/SomeProject.swf' do |t|
164
+ # t.input = 'src/SomeProject.as'
165
+ # t.source_path << 'src'
166
+ # # 900 is new max-recursion-depth
167
+ # # 20 is new max-execution-time
168
+ # t.default_script_limits = '900 20'
169
+ # end
170
+ #
171
+ # You can override these settings in the application.
172
+ #
173
+ add_param :default_script_limits, String
174
+
175
+ ##
176
+ # Defines the default application size, in pixels as a String.
177
+ #
178
+ # If you're using the Flex 4 SDK, these values should be comma-delimited like:
179
+ #
180
+ # desc "Compile the Application"
181
+ # mxmlc 'bin/SomeProject.swf' do |t|
182
+ # t.input = 'src/SomeProject.as'
183
+ # t.source_path << 'src'
184
+ # t.default_size = '950,550'
185
+ # end
186
+ #
187
+ # If you're using the Flex 3 SDK, these values should be space-delimited like:
188
+ #
189
+ # desc "Compile the Application"
190
+ # mxmlc 'bin/SomeProject.swf' do |t|
191
+ # t.input = 'src/SomeProject.as'
192
+ # t.source_path << 'src'
193
+ # t.default_size = '950 550'
194
+ # end
195
+ #
196
+ add_param :default_size, String
197
+
198
+ ##
199
+ # 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.
200
+ #
201
+ add_param :default_css_url, Url
202
+
203
+ ##
204
+ # This parameter is normally called 'define' but thanks to scoping issues
205
+ # with Sprouts and Rake, we needed to rename it and chose: 'define_conditional'.
206
+ #
207
+ # The format of each String value is "namespace::variable_name,value", for
208
+ # example, if I wanted an Environment named 'production' available to
209
+ # conditional compilation statements, I might do the following:
210
+ #
211
+ # Define a global AS3 conditional compilation definition:
212
+ #
213
+ # desc "Compile the Application"
214
+ # mxmlc 'bin/SomeProject.swf' do |t|
215
+ # t.input = 'src/SomeProject.as'
216
+ # t.source_path << 'src'
217
+ # t.define_conditional << 'CONFIG::environment,production'
218
+ # end
219
+ #
220
+ # Then, in any given ActionScript class, we might add the following:
221
+ #
222
+ # public static const environent:String = CONFIG::environment
223
+ #
224
+ # This value would be available to code at runtime where we can then
225
+ # branch on different environments.
226
+ #
227
+ # We can also use IFDEF like statements to completely remove or add code based
228
+ # on a conditional value. This is (sadly) done with Boolean conditionals as follows:
229
+ #
230
+ # desc "Compile the Application"
231
+ # mxmlc 'bin/SomeProject.swf' do |t|
232
+ # t.input = 'src/SomeProject.as'
233
+ # t.source_path << 'src'
234
+ # t.define_conditional << 'CONFIG::release,true'
235
+ # t.define_conditional << 'CONFIG::debug,false'
236
+ # end
237
+ #
238
+ # Then, in any given ActionScript class, we might add the following:
239
+ #
240
+ # CONFIG::release
241
+ # public function getValue():String {
242
+ # return value;
243
+ # }
244
+ #
245
+ # CONFIG::debug
246
+ # public function getValue():String {
247
+ # return value + " : " + debugInfo;
248
+ # }
249
+ #
250
+ # Note how the CONFIG::[name] statement precedes an ActionScript statement, but doesn't need to enclose it brackets or anything. This can
251
+ # go in front of any ActionScript statement (functions, classes, variables, etc).
252
+ #
253
+ # For more information, please read {Adobe's documentation}[http://livedocs.adobe.com/flex/3/html/compilers_21.html] on conditional compilation.
254
+ #
255
+ add_param :define_conditional, Strings, { :shell_name => "-define" }
256
+
257
+ ##
258
+ # Sets metadata in the resulting SWF file.
259
+ #
260
+ # desc "Compile the Application"
261
+ # mxmlc 'bin/SomeProject.swf' do |t|
262
+ # t.input = 'src/SomeProject.as'
263
+ # t.source_path << 'src'
264
+ # t.description = "This SWF was built with Project Sprouts!"
265
+ # end
266
+ #
267
+ add_param :description, String
268
+
269
+ ##
270
+ # Outputs the compiler options in the flex-config.xml file to the target path; for example:
271
+ #
272
+ # desc "Compile the Application"
273
+ # mxmlc 'bin/SomeProject.swf' do |t|
274
+ # t.input = 'src/SomeProject.as'
275
+ # t.source_path << 'src'
276
+ # t.dump_config = 'mxmlc-config.xml'
277
+ # end
278
+ #
279
+ # @see #load_config
280
+ #
281
+ add_param :dump_config, File
282
+
283
+ ##
284
+ # 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.
285
+ #
286
+ # 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.
287
+ #
288
+ # The default value is false. If you set this option to true, you must set the as3 option to false.
289
+ #
290
+ # desc "Compile the Application"
291
+ # mxmlc 'bin/SomeProject.swf' do |t|
292
+ # t.input = 'src/SomeProject.as'
293
+ # t.source_path << 'src'
294
+ # t.es = true
295
+ # t.as3 = false
296
+ # end
297
+ #
298
+ add_param :es, Boolean
299
+
300
+ ##
301
+ # Sets a list of symbols to exclude from linking when compiling a SWF file.
302
+ #
303
+ # This option provides compile-time link checking for external references that are dynamically linked.
304
+ #
305
+ # desc "Compile the Application"
306
+ # mxmlc 'bin/SomeProject.swf' do |t|
307
+ # t.input = 'src/SomeProject.as'
308
+ # t.source_path << 'src'
309
+ # t.externs << 'com.somedomain.SomeClass'
310
+ # t.externs << 'com.otherdomain.OtherClass'
311
+ # end
312
+ #
313
+ # To dynamically link against files, folders or SWCs instead of classes, see {#external_library_path}.
314
+ #
315
+ add_param :externs, Strings
316
+
317
+ ##
318
+ # Specifies a list of SWC files or directories to exclude from linking when compiling a SWF file.
319
+ #
320
+ # This option provides compile-time link checking for external components that are dynamically linked.
321
+ #
322
+ # desc "Compile the Application"
323
+ # mxmlc 'bin/SomeProject.swf' do |t|
324
+ # t.input = 'src/SomeProject.as'
325
+ # t.source_path << 'src'
326
+ # t.external_library_path << 'src/com/domain/project/SomeClass.as'
327
+ # t.external_library_path << 'lib/somelib/'
328
+ # t.external_library_path << 'lib/otherlib/OtherLibrary.swc'
329
+ # end
330
+ #
331
+ # To dynamically link against classes instead of files, folders or SWCs, see {#externs}.
332
+ #
333
+ add_param :external_library_path, Files
334
+
335
+ ##
336
+ # Alias for {#external_library_path}
337
+ #
338
+ add_param_alias :el, :external_library_path
339
+
340
+ ##
341
+ # Specifies source files to compile. This is the default option for the mxmlc compiler.
342
+ #
343
+ add_param :file_specs, Files
344
+
345
+ ##
346
+ # Specifies the range of Unicode settings for that language.
347
+ #
348
+ add_param :fonts_languages_language_range, String, { :shell_name => "-compiler.fonts.languages.language-range" }
349
+
350
+ ##
351
+ # Defines the font manager. The default is flash.fonts.JREFontManager. You can also use the flash.fonts.BatikFontManager.
352
+ #
353
+ add_param :fonts_managers, Strings, { :shell_name => "-compiler.fonts.managers" }
354
+
355
+ ##
356
+ # Sets the maximum number of fonts to keep in the server cache.
357
+ #
358
+ add_param :fonts_max_cached_fonts, Number, { :shell_name => "-compiler.fonts.max.cached.fonts" }
359
+
360
+ ##
361
+ # Sets the maximum number of character glyph-outlines to keep in the server cache for each font face.
362
+ #
363
+ add_param :fonts_max_glyphs_per_face, Number, { :shell_name => "-compiler.fonts.max.glyphs.per.face" }
364
+
365
+ ##
366
+ # Specifies a SWF file frame label with a sequence of one or more class names that will be linked onto the frame.
367
+ #
368
+ # desc "Compile the Application"
369
+ # mxmlc 'bin/SomeProject.swf' do |t|
370
+ # t.input = 'src/SomeProject.as'
371
+ # t.source_path << 'src'
372
+ # t.frames_frame << 'someFrameLabel SomeClass OtherClass AnotherClass'
373
+ # t.frames_frame << 'anotherFrameLabel YetAnotherClass'
374
+ # end
375
+ #
376
+ add_param :frames_frame, Strings, { :shell_name => '-frames.frame' }
377
+
378
+ ##
379
+ # Toggles the generation of an IFlexBootstrap-derived loader class.
380
+ #
381
+ # desc "Compile the Application"
382
+ # mxmlc 'bin/SomeProject.swf' do |t|
383
+ # t.input = 'src/SomeProject.as'
384
+ # t.source_path << 'src'
385
+ # t.generate_frame_loader = false
386
+ # end
387
+ #
388
+ # * Might be deprecated?
389
+ #
390
+ add_param :generate_frame_loader, Boolean
391
+
392
+ ##
393
+ # Enables the headless implementation of the Flex compiler.
394
+ #
395
+ # This sets the following (in Java):
396
+ #
397
+ # System.setProperty('java.awt.headless', 'true')
398
+ #
399
+ # The headless setting (java.awt.headless=true) is required to
400
+ # compile SWFs that use fonts and SVG on UNIX systems that aren't
401
+ # running X Windows.
402
+ #
403
+ add_param :headless_server, Boolean
404
+
405
+ ##
406
+ # Links all classes inside a SWC file to the resulting application SWF file, regardless of whether or not they are used.
407
+ #
408
+ # Contrast this option with the {#library_path} option that includes only those classes that are referenced at compile time.
409
+ #
410
+ # To link one or more classes whether or not they are used and not an entire SWC file, use the {#includes} option.
411
+ #
412
+ # This option is commonly used to specify resource bundles.
413
+ #
414
+ # desc "Compile the Application"
415
+ # mxmlc 'bin/SomeProject.swf' do |t|
416
+ # t.input = 'src/SomeProject.as'
417
+ # t.source_path << 'src'
418
+ # t.include_libraries << 'lib/somelib/SomeLib.swc'
419
+ # end
420
+ #
421
+ # @see #include_path
422
+ # @see #includes
423
+ # @see #library_path
424
+ #
425
+ add_param :include_libraries, Files
426
+
427
+ ##
428
+ # Links one or more classes to the resulting application SWF file, whether or not those classes are required at compile time.
429
+ #
430
+ # To link an entire SWC file rather than individual classes, use the {#include_libraries} option.
431
+ #
432
+ # desc "Compile the Application"
433
+ # mxmlc 'bin/SomeProject.swf' do |t|
434
+ # t.input = 'src/SomeProject.as'
435
+ # t.source_path << 'src'
436
+ # t.source_path << 'lib/somelib'
437
+ # t.includes << 'com.domain.SomeClass'
438
+ # end
439
+ #
440
+ # @see #include_libraries
441
+ # @see #include_path
442
+ # @see #library_path
443
+ #
444
+ add_param :includes, Strings
445
+
446
+ ##
447
+ # 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
448
+ # be included in the SWF regardless of whether they are referenced elsewhere.
449
+ #
450
+ # desc "Compile the Application"
451
+ # mxmlc 'bin/SomeProject.swf' do |t|
452
+ # t.input = 'src/SomeProject.as'
453
+ # t.source_path << 'src'
454
+ # t.source_path << 'lib/somelib'
455
+ # t.include_path << 'lib/somelib/com/somelib/net'
456
+ # end
457
+ #
458
+ # @see #include_libraries
459
+ # @see #includes
460
+ # @see #library_path
461
+ #
462
+ add_param :include_path, Paths
463
+
464
+ ##
465
+ # Enables incremental compilation.
466
+ #
467
+ # This option is true by default for the Flex Builder application compiler.
468
+ #
469
+ # For the command-line compiler, the default is false.
470
+ #
471
+ # The web-tier compiler does not support incremental compilation.
472
+ #
473
+ add_param :incremental, Boolean
474
+
475
+ ##
476
+ # Keep the specified metadata in the SWF (advanced, repeatable). This parameter must be set
477
+ # if you attempt to define new metadata tags.
478
+ #
479
+ # If you define metadata tags and use this parameter to include them when building a SWC,
480
+ # consumers of your SWC library will not also need to re-include the same metadata tags.
481
+ #
482
+ # Following is an example Rakefile that is setting this property:
483
+ #
484
+ # desc "Compile the Application"
485
+ # mxmlc 'bin/SomeProject.swf' do |t|
486
+ # t.input = 'src/SomeProject.as'
487
+ # t.source_path << 'src'
488
+ # t.keep_as3_metadata << 'Orange'
489
+ # end
490
+ #
491
+ # There could be a class somewhere that defines this metadata tag:
492
+ #
493
+ # [Orange(isTasty=true)]
494
+ # public function eatOranges():void {
495
+ # // do something
496
+ # }
497
+ #
498
+ # There would normally be another class that does some kind of reflection to perform
499
+ # some special operation on all entities that declare themselves as [Orange].
500
+ #
501
+ add_param :keep_as3_metadata, Strings
502
+
503
+ ##
504
+ # Determines whether to keep the generated ActionScript class files.
505
+ #
506
+ # The generated class files include stubs and classes that are generated by the compiler and used to build the SWF file.
507
+ #
508
+ # 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.
509
+ #
510
+ # The default names of the primary generated class files are filename-generated.as and filename-interface.as.
511
+ #
512
+ # The default value is false.
513
+ #
514
+ add_param :keep_generated_actionscript, Boolean
515
+
516
+ ##
517
+ # Sets metadata in the resulting SWF file.
518
+ #
519
+ add_param :language, String
520
+
521
+ ##
522
+ # Enables ABC bytecode lazy initialization.
523
+ #
524
+ # The default value is false.
525
+ #
526
+ add_param :lazy_init, Boolean
527
+
528
+
529
+ ##
530
+ # <product> <serial-number>
531
+ #
532
+ # Specifies a product and a serial number. (repeatable)
533
+ #
534
+ add_param :license, String
535
+
536
+ ##
537
+ # Links SWC files to the resulting application SWF file. The compiler only links in those classes for the SWC file that are referenced from
538
+ # your Document Root, or another class that it references.
539
+ #
540
+ # The default value of the {#library_path} option includes all SWC files in the libs directory and the current locale. These are required.
541
+ #
542
+ # To point to individual classes or packages rather than entire SWC files, use the {#source_path} option.
543
+ #
544
+ # You can use the << operator to append the new argument to the list of existing library paths:
545
+ #
546
+ # desc "Compile the Application"
547
+ # mxmlc 'bin/SomeProject.swf' do |t|
548
+ # t.input = 'src/SomeProject.as'
549
+ # t.library_path << 'lib/somelib/SomeLib.swc'
550
+ # end
551
+ #
552
+ # If you set the value of the library_path using the '=' operator, you must set the entire Array.
553
+ #
554
+ # You may also need to explicitly add the framework.swc and locale SWC files. Your new entry is
555
+ # not appended to the {#library_path} but replaces it. Once the value has been set, you can use
556
+ # the '<<' operator for subsequent applications.
557
+ #
558
+ # desc "Compile the Application"
559
+ # mxmlc 'bin/SomeProject.swf' do |t|
560
+ # t.input = 'src/SomeProject.as'
561
+ # t.source_path << 'src'
562
+ # t.library_path = ['lib/somelib/SomeLib.swc']
563
+ # end
564
+ #
565
+ # 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.
566
+ #
567
+ # @see {#source_path}
568
+ #
569
+ add_param :library_path, Files
570
+
571
+ ##
572
+ # Alias to library_path
573
+ #
574
+ add_param_alias :l, :library_path
575
+
576
+ ##
577
+ # Prints linking information to the specified output file.
578
+ # This file is an XML file that contains
579
+ #
580
+ # <def>, <pre>, and <ext>
581
+ #
582
+ # Symbols showing linker dependencies in the final SWF file.
583
+ #
584
+ # The file format output by this command can be used to write a file for input to the {#load_externs} option.
585
+ #
586
+ # desc "Compile the Application"
587
+ # mxmlc 'bin/SomeProject.swf' do |t|
588
+ # t.input = 'src/SomeProject.as'
589
+ # t.source_path << 'src'
590
+ # t.link_report = 'ext/link-report.xml'
591
+ # end
592
+ #
593
+ # @see #load_externs
594
+ #
595
+ add_param :link_report, String # SHOULD be a String - File types become prerequisites.
596
+
597
+ ##
598
+ # Specifies the location of the configuration file that defines compiler options.
599
+ #
600
+ # If you specify a configuration file, you can still override individual options by setting them on the command line.
601
+ #
602
+ # All relative paths in the configuration file are relative to the location of the configuration file itself.
603
+ #
604
+ # desc "Compile the Application"
605
+ # mxmlc 'bin/SomeProject.swf' do |t|
606
+ # t.input = 'src/SomeProject.as'
607
+ # t.source_path << 'src'
608
+ # t.load_config << 'mxmlc-config.xml'
609
+ # end
610
+ #
611
+ # If you would like to see this file for your current configuration, you can set the {#dump_config} parameter and run your rake task.
612
+ #
613
+ # @see #dump_config
614
+ #
615
+ add_param :load_config, Files
616
+
617
+ ##
618
+ # Specifies the location of an XML file that contains
619
+ #
620
+ # <def>, <pre>, and <ext>
621
+ #
622
+ # symbols to omit from linking when compiling a SWF file.
623
+ #
624
+ # The XML file uses the same syntax as the one produced by the link-report option.
625
+ #
626
+ # This option provides compile-time link checking for external components that are dynamically linked.
627
+ #
628
+ # desc "Compile the Application"
629
+ # mxmlc 'bin/SomeProject.swf' do |t|
630
+ # t.input = 'src/SomeProject.as'
631
+ # t.source_path << 'src'
632
+ # t.load_externs = 'framework-link-report.xml'
633
+ # end
634
+ #
635
+ # The input for this parameter is often the output of another build task that is set up to emit a {#link_report},
636
+ # for example, the previous example might be loading a {#link_report} from a task that looks like:
637
+ #
638
+ # desc "Compile the Application"
639
+ # compc 'bin/rsls' do |t|
640
+ # t.directory = true
641
+ # t.include_sources << 'lib/framework'
642
+ # t.link_report = 'framework-link-report.xml'
643
+ # end
644
+ #
645
+ # @see #link_report
646
+ #
647
+ add_param :load_externs, File
648
+
649
+ ##
650
+ # Specifies the locale that should be packaged in the SWF file (for example, en_EN).
651
+ #
652
+ # You run the mxmlc compiler multiple times to create SWF files for more than one locale,
653
+ # with only the locale option changing.
654
+ #
655
+ # You must also include the parent directory of the individual locale directories,
656
+ # plus the token \{locale\}, in the source-path.
657
+ #
658
+ # One way to do this with Rake might be as follows:
659
+ #
660
+ # # Create a new, empty task to asseble the locale-specific
661
+ # # build tasks:
662
+ # desc 'Build localized SWF files'
663
+ # task :build_locales
664
+ #
665
+ # # For each supported locale, create a new build task:
666
+ # ['en_US', 'en_EN', 'es_ES'].each do |locale|
667
+ #
668
+ # swf = "bin/SomeProject-#{locale}.swf"
669
+ #
670
+ # mxmlc swf do |t|
671
+ # t.input = 'src/SomeProject.as'
672
+ # t.source_path << 'src'
673
+ # t.source_path << "locale/#{locale}"
674
+ # t.locale = locale
675
+ # end
676
+ #
677
+ # # Add the localized build task as a prerequisite
678
+ # # to the aggregate task:
679
+ # task :build_locales => swf
680
+ # end
681
+ #
682
+ # If the previous code was in a Rake file, you could
683
+ # build all localized SWFs with:
684
+ #
685
+ # rake build_locales
686
+ #
687
+ # You could also build a single locale with:
688
+ #
689
+ # rake bin/SomeProject-en_US.swf
690
+ #
691
+ add_param :locale, String
692
+
693
+ ##
694
+ # Sets metadata in the resulting SWF file.
695
+ #
696
+ add_param :localized_description, String
697
+
698
+ ##
699
+ # Sets metadata in the resulting SWF file.
700
+ #
701
+ add_param :localized_title, String
702
+
703
+ ##
704
+ # 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.
705
+ #
706
+ add_param :namespaces_namespace, String
707
+
708
+ ##
709
+ # Enables the ActionScript optimizer. This optimizer reduces file size and increases performance by optimizing the SWF file's bytecode, but
710
+ # takes slightly longer to compile. This should usually be set to true for any SWF files that are headed to production.
711
+ #
712
+ # desc "Compile the Application"
713
+ # mxmlc 'bin/SomeProject.swf' do |t|
714
+ # t.input = 'src/SomeProject.as'
715
+ # t.source_path << 'src'
716
+ # t.optimize = true
717
+ # end
718
+ #
719
+ # @see #debug
720
+ #
721
+ add_param :optimize, Boolean, { :default => true, :show_on_false => true, :hidden_value => false, :delimiter => '=' }
722
+
723
+ ##
724
+ # Specifies the output path and filename for the resulting file.
725
+ #
726
+ # If you omit this option, the compiler saves the SWF file to the
727
+ # directory where the target file is located. The default SWF
728
+ # filename matches the target filename, but with a SWF file extension. When
729
+ # using this option with the component compiler (compc), the output is a
730
+ # SWC file rather than a SWF file.
731
+ #
732
+ # The compiler creates extra directories based on the specified filename
733
+ # if those directories are not present.
734
+ #
735
+ # The {#mxmlc} Rake task uses a Rake::File task under the covers, and
736
+ # will automatically set this value with the string passed into the task name.
737
+ #
738
+ add_param :output, File, { :file_task_name => true }
739
+
740
+ ##
741
+ # Sets metadata in the resulting SWF file.
742
+ #
743
+ add_param :publisher, String
744
+
745
+ ##
746
+ # XML text to store in the SWF metadata (overrides metadata.* configuration) (advanced)
747
+ #
748
+ add_param :raw_metadata, String
749
+
750
+ ##
751
+ # 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.
752
+ #
753
+ add_param :resource_bundle_list, File
754
+
755
+ ##
756
+ # Specifies a list of run-time shared libraries (RSLs)
757
+ # to use for this application. RSLs are dynamically-linked at run time.
758
+ #
759
+ # You specify the location of the SWF file relative to the deployment
760
+ # location of the application. For example, if you store a file named
761
+ # library.swf file in the web_root/libraries directory on the web server,
762
+ # and the application in the web root, you specify libraries/library.swf.
763
+ #
764
+ add_param :runtime_shared_libraries, Strings
765
+
766
+ ##
767
+ # Alias for {#runtime_shared_libraries}
768
+ #
769
+ add_param_alias :rsl, :runtime_shared_libraries
770
+
771
+ ##
772
+ # Setting up Runtime Shared Libraries (RSLs) is extremely complicated and usually
773
+ # not worth doing unless you're using the Flex framework.
774
+ #
775
+ # Following are some URLs where you might learn more about using RSLs:
776
+ #
777
+ # * http://www.newtriks.com/?p=802
778
+ # * http://blogs.adobe.com/rgonzalez/2006/06/modular_applications_part_2.html
779
+ # * http://code.google.com/p/maashaack/wiki/Metadata
780
+ # * http://flexscript.wordpress.com/2008/11/15/using-runtime-shared-libraries-utilizing-flash-player-cache/
781
+ #
782
+ # If you're not using the Flex framework, the most difficult thing you'll need to do
783
+ # is set up a Preloader and figure out how to determine which urls to load the RSLs from.
784
+ #
785
+ # If you are setting up RSLs with the Flex framework, you should be able to create
786
+ # a build task something like the following:
787
+ #
788
+ # version = '4.1.0.16076'
789
+ # rsls_dir = 'lib/rsls'
790
+ # crossdomain = ''
791
+ # host = 'http://yourdomain.com'
792
+ #
793
+ # desc "Compile the Application"
794
+ # mxmlc "bin/SomeProject.swf" do |t|
795
+ # t.source_path << 'src'
796
+ # t.input = 'src/SomeProject.mxml'
797
+ # t.pkg_version = version
798
+ # t.runtime_shared_library_path << "lib/framework_#{version}.swc,#{host}#{rsls_dir}/framework_#{version}.swz,#{crossdomain},#{host}#{rsls_dir}/framework_#{version}.swf"
799
+ # t.runtime_shared_library_path << "lib/rpc_#{version}.swc,#{host}#{rsls_dir}/rpc_#{version}.swz,#{crossdomain},#{host}#{rsls_dir}/rpc_#{version}.swf"
800
+ # end
801
+ #
802
+ add_param :runtime_shared_library_path, Strings
803
+
804
+ ##
805
+ # Alias for {#runtime_shared_library_path}
806
+ #
807
+ add_param_alias :rslp, :runtime_shared_library_path
808
+
809
+ ##
810
+ # Specifies the location of the services-config.xml file. This file is used by Flex Data Services.
811
+ #
812
+ add_param :services, File
813
+
814
+ ##
815
+ # Shows warnings for ActionScript classes.
816
+ #
817
+ # The default value is true.
818
+ #
819
+ # desc "Compile the Application"
820
+ # mxmlc 'bin/SomeProject.swf' do |t|
821
+ # t.input = 'src/SomeProject.as'
822
+ # t.source_path << 'src'
823
+ # t.show_actionscript_warnings = false
824
+ # end
825
+ #
826
+ add_param :show_actionscript_warnings, Boolean, { :default => true, :show_on_false => true, :hidden_value => false, :delimiter => '=' }
827
+
828
+ ##
829
+ # Shows a warning when Flash Player cannot detect changes to a bound property.
830
+ #
831
+ # The default value is true.
832
+ #
833
+ # desc "Compile the Application"
834
+ # mxmlc 'bin/SomeProject.swf' do |t|
835
+ # t.input = 'src/SomeProject.mxml'
836
+ # t.source_path << 'src'
837
+ # t.show_binding_warnings = false
838
+ # end
839
+ #
840
+ add_param :show_binding_warnings, Boolean, { :default => true, :show_on_false => true, :hidden_value => false, :delimiter => '=' }
841
+
842
+ ##
843
+ # Shows warnings when you try to embed a font with a family name that is the same as the operating system font name.
844
+ # The compiler normally warns you that you are shadowing a system font. Set this option to false to disable the warnings.
845
+ #
846
+ # The default value is true.
847
+ #
848
+ # desc "Compile the Application"
849
+ # mxmlc 'bin/SomeProject.swf' do |t|
850
+ # t.input = 'src/SomeProject.mxml'
851
+ # t.source_path << 'src'
852
+ # t.show_shadowed_device_font_warnings = false
853
+ # end
854
+ #
855
+ add_param :show_shadowed_device_font_warnings, Boolean, { :default => true, :show_on_false => true, :hidden_value => false, :delimiter => '=' }
856
+
857
+ ##
858
+ # Shows warnings when a type selector in a style sheet or <mx:Style> block is not used by any components in the application.
859
+ #
860
+ # The default value is true.
861
+ #
862
+ # desc "Compile the Application"
863
+ # mxmlc 'bin/SomeProject.swf' do |t|
864
+ # t.input = 'src/SomeProject.mxml'
865
+ # t.source_path << 'src'
866
+ # t.show_unused_type_selector_warnings = false
867
+ # end
868
+ #
869
+ add_param :show_unused_type_selector_warnings, Boolean, { :default => true, :show_on_false => true, :hidden_value => false, :delimiter => '=' }
870
+
871
+ ##
872
+ # Shows deprecation warnings for Flex components. To see warnings for ActionScript classes, use the show-actionscript-warnings option.
873
+ #
874
+ # The default value is true.
875
+ #
876
+ # desc "Compile the Application"
877
+ # mxmlc 'bin/SomeProject.swf' do |t|
878
+ # t.input = 'src/SomeProject.mxml'
879
+ # t.source_path << 'src'
880
+ # t.show_deprecation_warnings = false
881
+ # end
882
+ #
883
+ add_param :show_deprecation_warnings, Boolean, { :default => true, :show_on_false => true }
884
+
885
+ ##
886
+ # Adds directories to the source path. The compiler
887
+ # searches directories in the source path for MXML or AS source
888
+ # files based on import statements and type references.
889
+ #
890
+ # Only those files that have been referenced will be included
891
+ # in a compiled SWF or SWC file.
892
+ #
893
+ # To add the contents of a SWC file to the entity search, use
894
+ # the {#library_path} option.
895
+ #
896
+ # The source path is also used as the search path for the component
897
+ # compiler's {#includes} and {#resource_bundle_list} options.
898
+ #
899
+ # desc "Compile the Application"
900
+ # mxmlc 'bin/SomeProject.swf' do |t|
901
+ # t.input = 'src/SomeProject.mxml'
902
+ # t.source_path << 'src'
903
+ # t.source_path << 'lib/othersrc'
904
+ # t.source_path << 'lib/anothersrc'
905
+ # end
906
+ #
907
+ add_param :source_path, Paths
908
+
909
+ add_param_alias :sp, :source_path
910
+
911
+ ##
912
+ # Statically link the libraries specified by the {#runtime_shared_libraries} option.
913
+ #
914
+ # Default changed to false in Flex 4: http://opensource.adobe.com/wiki/display/flexsdk/Linking+RSLs+by+Default
915
+ #
916
+ # We respect this new default.
917
+ #
918
+ # @see #runtime_shared_libraries
919
+ #
920
+ add_param :static_link_runtime_shared_libraries, Boolean, { :default => false, :hidden_value => false, :delimiter => '=' }
921
+
922
+
923
+ ##
924
+ # Alias for {#static_link_runtime_shared_libraries}
925
+ #
926
+ add_param_alias :static_rsls, :static_link_runtime_shared_libraries
927
+
928
+ ##
929
+ # Prints undefined property and function calls; also performs compile-time type checking on assignments and options supplied to method calls.
930
+ #
931
+ # Turning of strict typing will essentially enable Duck-Typing in the Flash Player.
932
+ #
933
+ # The default value is true.
934
+ #
935
+ # desc "Compile the Application"
936
+ # mxmlc 'bin/SomeProject.swf' do |t|
937
+ # t.input = 'src/SomeProject.mxml'
938
+ # t.source_path << 'src'
939
+ # t.strict = false
940
+ # end
941
+ #
942
+ add_param :strict, Boolean, { :default => true, :show_on_false => true, :hidden_value => false, :delimiter => '=' }
943
+
944
+ ##
945
+ # Specifies the version of the player the application is targeting.
946
+ #
947
+ # Features requiring a later version will not be compiled into the application. The minimum value supported is "9.0.0".
948
+ #
949
+ # Be aware that this value is a String.
950
+ #
951
+ # desc "Compile the Application"
952
+ # mxmlc 'bin/SomeProject.swf' do |t|
953
+ # t.input = 'src/SomeProject.mxml'
954
+ # t.source_path << 'src'
955
+ # t.target_player = '10'
956
+ # end
957
+ #
958
+ add_param :target_player, String
959
+
960
+ ##
961
+ # 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.
962
+ #
963
+ # 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.
964
+ #
965
+ add_param :theme, Files
966
+
967
+ ##
968
+ # Sets metadata in the resulting SWF file.
969
+ #
970
+ add_param :title, String
971
+
972
+ ##
973
+ # Specifies that the current application uses network services.
974
+ #
975
+ # The default value is true.
976
+ #
977
+ # When the use-network property is set to false, the application can
978
+ # access the local filesystem (for example, use the XML.load() method
979
+ # with file: URLs) but not network services. In most circumstances, the
980
+ # value of this property should be true.
981
+ #
982
+ add_param :use_network, Boolean, { :default => true, :show_on_false => true, :hidden_value => false, :delimiter => '=' }
983
+
984
+ ##
985
+ # Enables resource bundles. Set to true to instruct the compiler to process the contents of the [ResourceBundle] metadata tag.
986
+ #
987
+ # The default value is true.
988
+ #
989
+ add_param :use_resource_bundle_metadata, Boolean, { :default => true, :show_on_false => true, :hidden_value => false, :delimiter => '=' }
990
+
991
+ ##
992
+ # Generates source code that includes source files and line numbers. When
993
+ # a run-time error occurs, the stacktrace shows these line numbers.
994
+ #
995
+ # Enabling this option generates larger SWF files.
996
+ #
997
+ # The default value is false.
998
+ #
999
+ # @see #debug
1000
+ #
1001
+ add_param :verbose_stacktraces, Boolean
1002
+
1003
+ ##
1004
+ # Verifies the libraries loaded at runtime are the correct ones.
1005
+ #
1006
+ add_param :verify_digests, Boolean
1007
+
1008
+ ##
1009
+ # Enables specified warnings.
1010
+ #
1011
+ add_param :warn_warning_type, Boolean
1012
+
1013
+ ##
1014
+ # Enables all warnings. Set to false to disable all warnings. This option overrides the warn-warning_type options.
1015
+ #
1016
+ # The default value is true.
1017
+ #
1018
+ add_param :warnings, Boolean, { :default => true, :show_on_false => true, :hidden_value => false, :delimiter => '=' }
1019
+
1020
+ ##
1021
+ # Set to true in order to compile with the Flex Compiler Shell (FCSH).
1022
+ #
1023
+ # You can set this value directly on a single compiler instance like:
1024
+ #
1025
+ # mxmlc 'bin/SomeProject.swf' do |t|
1026
+ # t.input = 'src/SomeProject.as'
1027
+ # t.use_fcsh = true
1028
+ # end
1029
+ #
1030
+ # This value can also be set to true by sending it into Ruby as
1031
+ # an environment variable like:
1032
+ #
1033
+ # rake test USE_FCSH=true
1034
+ #
1035
+ # If you always want to use FCSH, you can set this value in your .bashrc
1036
+ # or .bash_profile like:
1037
+ #
1038
+ # export USE_FCSH=true
1039
+ #
1040
+ # There is also an :fcsh helper rake task that will set this value
1041
+ # simply by executing it before your build tasks. You can do this
1042
+ # from the terminal like:
1043
+ #
1044
+ # rake fcsh test
1045
+ #
1046
+ # Or:
1047
+ #
1048
+ # rake fcsh debug
1049
+ #
1050
+ # Or you can make it a prerequisite to any other build task like:
1051
+ #
1052
+ # mxmlc 'bin/SomeProject.swf' => :fcsh do |t|
1053
+ # ...
1054
+ # end
1055
+ #
1056
+ attr_accessor :use_fcsh
1057
+
1058
+ ##
1059
+ # The FCSH port to use for connections. If you are building from
1060
+ # multiple different directories, you will need to start up the
1061
+ # FCSH servers on different ports. This can be done like:
1062
+ #
1063
+ # rake fcsh:start FCSH_PORT=12322
1064
+ #
1065
+ # and in another terminal:
1066
+ #
1067
+ # rake fcsh mxmlc FCSH_PORT=12322
1068
+ #
1069
+ attr_accessor :fcsh_port
1070
+
1071
+ ##
1072
+ # Temporary override while waiting for integration of next version!
1073
+ # TODO: Remove this method override.
1074
+ def execute
1075
+ prepare
1076
+ super
1077
+ end
1078
+
1079
+ protected
1080
+
1081
+ def update_fcsh
1082
+ # Check for USE_FCSH on the environment
1083
+ # variable hash, update instance value
1084
+ # if found to be true:
1085
+ if ENV['USE_FCSH'].to_s == 'true'
1086
+ self.use_fcsh = true
1087
+ end
1088
+
1089
+ if !ENV['FCSH_PORT'].nil?
1090
+ self.fcsh_port = ENV['FCSH_PORT']
1091
+ end
1092
+ end
1093
+
1094
+ ##
1095
+ # Template method called by {Sprout::Executable} when
1096
+ # a {Sprout::Library} is found in the Rake::Task prerequisite list.
1097
+ #
1098
+ # @param path [File] The path within the project where the library was copied.
1099
+ #
1100
+ # @return [File] The path that was provided.
1101
+ #
1102
+ def library_added path
1103
+ if(path =~ /\.swc$/)
1104
+ self.library_path << path
1105
+ else
1106
+ self.source_path << path
1107
+ end
1108
+ path
1109
+ end
1110
+
1111
+ ##
1112
+ # override
1113
+ def prepare
1114
+ update_fcsh if use_fcsh.nil?
1115
+ super
1116
+ end
1117
+
1118
+ ##
1119
+ # override
1120
+ def execute_delegate
1121
+ (use_fcsh) ? execute_with_fcsh : super
1122
+ end
1123
+
1124
+ def execute_with_fcsh
1125
+ client = FlashSDK::FCSHSocket.new
1126
+ client.execute "#{executable.to_s} #{to_shell}", ENV['FCSH_PORT']
1127
+ end
1128
+
1129
+ end
1130
+ end
1131
+