sprout-as3-puremvc-bundle 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. data/README +48 -0
  2. data/lib/sprout/as3.rb +5 -0
  3. data/lib/sprout/as3/version.rb +12 -0
  4. data/lib/sprout/as3_tasks.rb +7 -0
  5. data/lib/sprout/generators/class/USAGE +42 -0
  6. data/lib/sprout/generators/class/class_generator.rb +20 -0
  7. data/lib/sprout/generators/class/templates/Class.as +8 -0
  8. data/lib/sprout/generators/class/templates/Component.mxml +8 -0
  9. data/lib/sprout/generators/class/templates/TestCase.as +30 -0
  10. data/lib/sprout/generators/class/templates/TestSuite.as +18 -0
  11. data/lib/sprout/generators/component/component_generator.rb +18 -0
  12. data/lib/sprout/generators/component/templates/Component.mxml +3 -0
  13. data/lib/sprout/generators/component/templates/TestSuite.as +18 -0
  14. data/lib/sprout/generators/component/templates/VisualTestCase.as +32 -0
  15. data/lib/sprout/generators/project/project_generator.rb +163 -0
  16. data/lib/sprout/generators/project/templates/MainClass.as +139 -0
  17. data/lib/sprout/generators/project/templates/README.txt +56 -0
  18. data/lib/sprout/generators/project/templates/TestRunner.as +15 -0
  19. data/lib/sprout/generators/project/templates/deploy/assets/css/main.css +5 -0
  20. data/lib/sprout/generators/project/templates/deploy/assets/js/swfobject.js +5 -0
  21. data/lib/sprout/generators/project/templates/deploy/assets/swf/express_install.swf +0 -0
  22. data/lib/sprout/generators/project/templates/deploy/index.html +30 -0
  23. data/lib/sprout/generators/project/templates/embed/fonts/arial.ttf +0 -0
  24. data/lib/sprout/generators/project/templates/embed/fonts/fonts.xml +42 -0
  25. data/lib/sprout/generators/project/templates/embed/template/AssetEmbedTemplate.as +15 -0
  26. data/lib/sprout/generators/project/templates/embed/template/FontTemplate.as +20 -0
  27. data/lib/sprout/generators/project/templates/generate +21 -0
  28. data/lib/sprout/generators/project/templates/lib/PureMVC_AS3_2_0_3.swc +0 -0
  29. data/lib/sprout/generators/project/templates/lib/com_ffsys_utils_font.swc +0 -0
  30. data/lib/sprout/generators/project/templates/lib/com_ffsys_utils_locale.swc +0 -0
  31. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_core.swc +0 -0
  32. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_effects.swc +0 -0
  33. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_effects_tween.swc +0 -0
  34. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_errors.swc +0 -0
  35. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_events.swc +0 -0
  36. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_io.swc +0 -0
  37. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils.swc +0 -0
  38. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_address.swc +0 -0
  39. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_array.swc +0 -0
  40. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_assert.swc +0 -0
  41. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_bezier.swc +0 -0
  42. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_boolean.swc +0 -0
  43. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_byte.swc +0 -0
  44. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_collections.swc +0 -0
  45. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_display.swc +0 -0
  46. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_flex.swc +0 -0
  47. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_font.swc +0 -0
  48. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_history.swc +0 -0
  49. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_identifier.swc +0 -0
  50. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_inspector.swc +0 -0
  51. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_locale.swc +0 -0
  52. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_number.swc +0 -0
  53. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_object.swc +0 -0
  54. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_random.swc +0 -0
  55. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_reflection.swc +0 -0
  56. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_reflection_members.swc +0 -0
  57. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_reflection_meta.swc +0 -0
  58. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_reflection_parser.swc +0 -0
  59. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_regex.swc +0 -0
  60. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_string.swc +0 -0
  61. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_substitution.swc +0 -0
  62. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_time.swc +0 -0
  63. data/lib/sprout/generators/project/templates/lib/opt/ffsys/com_ffsys_utils_xml.swc +0 -0
  64. data/lib/sprout/generators/project/templates/rakeassets.rb +77 -0
  65. data/lib/sprout/generators/project/templates/rakefile.rb +112 -0
  66. data/lib/sprout/generators/project/templates/rakefonts.rb +170 -0
  67. data/lib/sprout/generators/suite/USAGE +0 -0
  68. data/lib/sprout/generators/suite/suite_generator.rb +17 -0
  69. data/lib/sprout/generators/suite/templates/TestSuite.as +18 -0
  70. data/lib/sprout/generators/test/USAGE +37 -0
  71. data/lib/sprout/generators/test/templates/TestCase.as +30 -0
  72. data/lib/sprout/generators/test/templates/TestSuite.as +18 -0
  73. data/lib/sprout/generators/test/test_generator.rb +20 -0
  74. data/lib/sprout/tasks/asdoc_doc.rb +155 -0
  75. data/lib/sprout/tasks/asdoc_rdoc.rb +155 -0
  76. data/lib/sprout/tasks/asdoc_task.rb +276 -0
  77. data/lib/sprout/tasks/asunit_task.rb +148 -0
  78. data/lib/sprout/tasks/compc_doc.rb +543 -0
  79. data/lib/sprout/tasks/compc_rdoc.rb +543 -0
  80. data/lib/sprout/tasks/compc_task.rb +130 -0
  81. data/lib/sprout/tasks/fcsh_task.rb +13 -0
  82. data/lib/sprout/tasks/fdb_task.rb +0 -0
  83. data/lib/sprout/tasks/mxmlc_doc.rb +484 -0
  84. data/lib/sprout/tasks/mxmlc_rdoc.rb +484 -0
  85. data/lib/sprout/tasks/mxmlc_task.rb +659 -0
  86. data/rakefile.rb +73 -0
  87. metadata +192 -0
@@ -0,0 +1,659 @@
1
+ =begin
2
+ Copyright (c) 2007 Pattern Park
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining
5
+ a copy of this software and associated documentation files (the
6
+ "Software"), to deal in the Software without restriction, including
7
+ without limitation the rights to use, copy, modify, merge, publish,
8
+ distribute, sublicense, and/or sell copies of the Software, and to
9
+ permit persons to whom the Software is furnished to do so, subject to
10
+ the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+
23
+ TODO: Investigate jruby support, especially:
24
+ http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Book_Parts&file=compilers_123_09.html
25
+ =end
26
+
27
+ module Sprout
28
+ class MXMLCError < StandardError #:nodoc:
29
+ end
30
+ class ExecutionError < StandardError #:nodoc:
31
+ end
32
+
33
+ # The MXMLC task provides a rake front end to the Flex MXMLC command line compiler.
34
+ # This task is integrated with the LibraryTask so that if any dependencies are
35
+ # library tasks, they will be automatically added to the library_path or source_path
36
+ # depending on whether they provide a swc or sources.
37
+ #
38
+ # The entire MXMLC advanced interface has been provided here. All parameter names should be
39
+ # identical to what is available on the regular compiler except dashes have been replaced
40
+ # by underscores.
41
+ #
42
+ # The following example can be pasted in a file named 'rakefile.rb' which should be placed in
43
+ # the same folder as an ActionScript 3.0 class named 'SomeProject.as' that extends
44
+ # flash.display.Sprite.
45
+ #
46
+ # # Create a remote library dependency on the corelib swc.
47
+ # library :corelib
48
+ #
49
+ # # Alias the compilation task with one that is easier to type
50
+ # # task :compile => 'SomeProject.swf'
51
+ #
52
+ # # Create an MXMLCTask named for the output file that it creates. This task depends on the
53
+ # # corelib library and will automatically add the corelib.swc to it's library_path
54
+ # mxmlc 'SomeProject.swf' => :corelib do |t|
55
+ # t.input = 'SomeProject.as'
56
+ # t.default_size = '800 600'
57
+ # t.default_background_color = "#FFFFFF"
58
+ # end
59
+ #
60
+ class MXMLCTask < ToolTask
61
+
62
+ # Interface and descriptions found here:
63
+ # http://livedocs.adobe.com/flex/2/docs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00001481.html
64
+ def initialize_task
65
+ @default_gem_name = 'sprout-flex2sdk-tool'
66
+ @default_gem_path = 'bin/mxmlc'
67
+
68
+ add_param(:accessible, :boolean) do |p|
69
+ p.hidden_value = true
70
+ p.description = "Enables accessibility features when compiling the Flex application or SWC file. The default value is false."
71
+ end
72
+
73
+ add_param(:actionscript_file_encoding, :string) do |p|
74
+ p.description = "Sets the file encoding for ActionScript files. For more information see: http://livedocs.adobe.com/flex/2/docs/00001503.html#149244"
75
+ end
76
+
77
+ add_param(:allow_source_path_overlap, :boolean) do |p|
78
+ p.hidden_value = true
79
+ p.description = "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."
80
+ end
81
+
82
+ # multiline strings won't work in stupid aptana!
83
+ add_param(:as3, :boolean) do |p|
84
+ p.value = true
85
+ p.show_on_false = true
86
+ p.description =<<EOF
87
+ 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.
88
+
89
+ The default value is true. If you set this value to false, you must set the es option to true.
90
+
91
+ This is an advanced option.
92
+ EOF
93
+ end
94
+
95
+ add_param(:benchmark, :boolean) do |p|
96
+ p.value = true
97
+ p.show_on_false = true
98
+ p.description = "Prints detailed compile times to the standard output. The default value is true."
99
+ end
100
+
101
+ add_param(:context_root, :path) do |p|
102
+ p.description =<<EOF
103
+ 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.
104
+
105
+ For more information on using the {context.root} token, see http://livedocs.adobe.com/flex/2/docs/00001446.html#205687.
106
+ EOF
107
+ end
108
+
109
+ add_param(:contributor, :string) do |p|
110
+ p.description = "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)."
111
+ end
112
+
113
+ add_param(:creator, :string) do |p|
114
+ p.description = "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)"
115
+ end
116
+
117
+ add_param(:date, :string) do |p|
118
+ p.description = "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)"
119
+ end
120
+
121
+ add_param(:debug, :boolean) do |p|
122
+ p.hidden_value = true
123
+ p.description =<<EOF
124
+ 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.
125
+
126
+ For the mxmlc compiler, the default value is false. For the compc compiler, the default value is true.
127
+
128
+ 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.
129
+
130
+ For information about the command-line debugger, see Using the Command-Line Debugger (http://livedocs.adobe.com/flex/2/docs/00001540.html#181846).
131
+
132
+ Flex also uses the verbose-stacktraces setting to determine whether line numbers are added to the stacktrace.
133
+ EOF
134
+ end
135
+
136
+ add_param(:debug_password, :string) do |p|
137
+ p.description = "Lets you engage in remote debugging sessions with the Flash IDE. This is an advanced option."
138
+ end
139
+
140
+ add_param(:default_background_color, :string) do |p|
141
+ p.description =<<EOF
142
+ Sets the application's background color. You use the 0x notation to set the color, as the following example shows:
143
+
144
+ -default-background-color=0xCCCCFF
145
+
146
+ 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).
147
+
148
+ This is an advanced option.
149
+ EOF
150
+ end
151
+
152
+ add_param(:default_frame_rate, :number) do |p|
153
+ p.description = "Sets the application's frame rate. The default value is 24. This is an advanced option."
154
+ end
155
+
156
+ # TODO: Based on this description, I don't understand how to set these values:
157
+ # add_param(:default_script_limits, :number) do |p|
158
+ # p.description = "Defines the application's script execution limits.
159
+ #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.
160
+ #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.
161
+ #You can override these settings in the application.
162
+ #This is an advanced option.
163
+ #end
164
+
165
+ add_param(:default_size, :string) do |p|
166
+ p.delimiter = ' '
167
+ p.value = '950 550'
168
+ p.description = "Defines the default application size, in pixels for example: default_size = '950 550'. This is an advanced option."
169
+ end
170
+
171
+ add_param(:default_css_url, :url) do |p|
172
+ p.description =<<EOF
173
+ 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.
174
+
175
+ 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.
176
+
177
+ This is an advanced option.
178
+ EOF
179
+ end
180
+
181
+ add_param(:description, :string) do |p|
182
+ p.description = "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)."
183
+ end
184
+
185
+ add_param(:dump_config, :file) do |p|
186
+ p.description =<<EOF
187
+ Outputs the compiler options in the flex-config.xml file to the target path; for example:
188
+
189
+ mxmlc -dump-config myapp-config.xml
190
+
191
+ This is an advanced option.
192
+ EOF
193
+ end
194
+
195
+ # TODO: Add parameter interactions to ensure
196
+ # valid state?
197
+ add_param(:es, :boolean) do |p|
198
+ p.description =<<EOF
199
+ 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.
200
+
201
+ 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.
202
+
203
+ The default value is false. If you set this option to true, you must set the es3 option to false.
204
+
205
+ This is an advanced option.
206
+ EOF
207
+ end
208
+
209
+ add_param(:externs, :symbols) do |p|
210
+ p.description =<<EOF
211
+ Sets a list of symbols to exclude from linking when compiling a SWF file.
212
+
213
+ This option provides compile-time link checking for external references that are dynamically linked.
214
+
215
+ For more information about dynamic linking, see About linking (http://livedocs.adobe.com/flex/2/docs/00001521.html#205852).
216
+
217
+ This is an advanced option.
218
+ EOF
219
+ end
220
+
221
+ add_param(:external_library_path, :files) do |p|
222
+ p.description =<<EOF
223
+ 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.
224
+
225
+ For more information about dynamic linking, see About linking (http://livedocs.adobe.com/flex/2/docs/00001521.html#205852).
226
+
227
+ You can use the += operator to append the new SWC file to the list of external libraries.
228
+
229
+ This parameter has been aliased as +el+.
230
+ EOF
231
+ end
232
+
233
+ add_param_alias(:el, :external_library_path)
234
+
235
+ add_param(:file_specs, :files) do |p|
236
+ p.description = "Specifies source files to compile. This is the default option for the mxmlc compiler."
237
+ end
238
+
239
+ add_param(:fonts_languages_language_range, :string) do |p|
240
+ p.shell_name = '-compiler.fonts.languages.language-range'
241
+ p.description =<<EOF
242
+ 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.
243
+
244
+ This is an advanced option.
245
+ EOF
246
+ end
247
+
248
+ add_param(:fonts_managers, :symbols) do |p|
249
+ p.description =<<EOF
250
+ 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).
251
+
252
+ This is an advanced option.
253
+ EOF
254
+ end
255
+
256
+ add_param(:fonts_max_cached_fonts, :number) do |p|
257
+ p.description =<<EOF
258
+ 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).
259
+
260
+ This is an advanced option.
261
+ EOF
262
+ end
263
+
264
+ add_param(:fonts_max_glyphs_per_face, :number) do |p|
265
+ p.description =<<EOF
266
+ 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).
267
+
268
+ This is an advanced option.
269
+ EOF
270
+ end
271
+
272
+ add_param(:frames_frame, :string) do |p|
273
+ p.description =<<EOF
274
+ Specifies a SWF file frame label with a sequence of class names that are linked onto the frame.
275
+
276
+ For example: frames_frame = 'someLabel MyProject OtherProject FoodProject'
277
+
278
+ This is an advanced option.
279
+ EOF
280
+ end
281
+
282
+ add_param(:generate_frame_loader, :boolean) do |p|
283
+ p.description =<<EOF
284
+ Toggles the generation of an IFlexBootstrap-derived loader class.
285
+
286
+ This is an advanced option.
287
+ EOF
288
+ end
289
+
290
+ add_param(:headless_server, :boolean) do |p|
291
+ p.description =<<EOF
292
+ Enables the headless implementation of the Flex compiler. This sets the following:
293
+
294
+ System.setProperty('java.awt.headless', 'true')
295
+
296
+ The headless setting (java.awt.headless=true) is required to use fonts and SVG on UNIX systems without X Windows.
297
+
298
+ This is an advanced option.
299
+ EOF
300
+ end
301
+
302
+ add_param(:include_libraries, :files) do |p|
303
+ p.description =<<EOF
304
+ Links all classes inside a SWC file to the resulting application SWF file, regardless of whether or not they are used.
305
+
306
+ Contrast this option with the library-path option that includes only those classes that are referenced at compile time.
307
+
308
+ To link one or more classes whether or not they are used and not an entire SWC file, use the includes option.
309
+
310
+ This option is commonly used to specify resource bundles.
311
+ EOF
312
+ end
313
+
314
+ add_param(:includes, :symbols) do |p|
315
+ p.description =<<EOF
316
+ Links one or more classes to the resulting application SWF file, whether or not those classes are required at compile time.
317
+
318
+ To link an entire SWC file rather than individual classes, use the include-libraries option.
319
+ EOF
320
+ end
321
+
322
+ add_param(:incremental, :boolean) do |p|
323
+ p.description =<<EOF
324
+ Enables incremental compilation. For more information, see About incremental compilation (http://livedocs.adobe.com/flex/2/docs/00001506.html#153980).
325
+
326
+ 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.
327
+ EOF
328
+ end
329
+
330
+ add_param(:keep_generated_actionscript, :boolean) do |p|
331
+ p.description =<<EOF
332
+ Determines whether to keep the generated ActionScript class files.
333
+
334
+ The generated class files include stubs and classes that are generated by the compiler and used to build the SWF file.
335
+
336
+ 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.
337
+
338
+ The default names of the primary generated class files are filename-generated.as and filename-interface.as.
339
+
340
+ The default value is false.\nThis is an advanced option.
341
+ EOF
342
+ end
343
+
344
+ add_param(:language, :string) do |p|
345
+ p.description = "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)."
346
+ end
347
+
348
+ add_param(:lazy_init, :boolean) do |p|
349
+ p.description =<<EOF
350
+ Enables ABC bytecode lazy initialization.
351
+
352
+ The default value is false.
353
+
354
+ This is an advanced option.
355
+ EOF
356
+ end
357
+
358
+ add_param(:library_path, :files) do |p|
359
+ p.description =<<EOF
360
+ Links SWC files to the resulting application SWF file. The compiler only links in those classes for the SWC file that are required.
361
+
362
+ The default value of the library-path option includes all SWC files in the libs directory and the current locale. These are required.
363
+
364
+ To point to individual classes or packages rather than entire SWC files, use the source-path option.
365
+
366
+ If you set the value of the library-path as an option of the command-line compiler, you must also explicitly add the framework.swc and locale SWC files. Your new entry is not appended to the library-path but replaces it.
367
+
368
+ You can use the += operator to append the new argument to the list of existing SWC files.
369
+
370
+ 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.
371
+ EOF
372
+ end
373
+
374
+ add_param_alias(:l, :library_path)
375
+
376
+ add_param(:link_report, :file) do |p|
377
+ p.description =<<EOF
378
+ 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.
379
+
380
+ The file format output by this command can be used to write a file for input to the load-externs option.
381
+
382
+ For more information on the report, see Examining linker dependencies (http://livedocs.adobe.com/flex/2/docs/00001394.html#211202).
383
+
384
+ This is an advanced option.
385
+ EOF
386
+ end
387
+
388
+ add_param(:load_config, :file) do |p|
389
+ p.description =<<EOF
390
+ Specifies the location of the configuration file that defines compiler options.
391
+
392
+ If you specify a configuration file, you can override individual options by setting them on the command line.
393
+
394
+ All relative paths in the configuration file are relative to the location of the configuration file itself.
395
+
396
+ Use the += operator to chain this configuration file to other configuration files.
397
+
398
+ 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).
399
+ EOF
400
+ end
401
+
402
+ add_param(:load_externs, :file) do |p|
403
+ p.description =<<EOF
404
+ 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. For more information on the report, see Examining linker dependencies (http://livedocs.adobe.com/flex/2/docs/00001394.html#211202).
405
+
406
+ This option provides compile-time link checking for external components that are dynamically linked.
407
+
408
+ For more information about dynamic linking, see About linking (http://livedocs.adobe.com/flex/2/docs/00001521.html#205852).
409
+
410
+ This is an advanced option.
411
+ EOF
412
+ end
413
+
414
+ add_param(:locale, :string) do |p|
415
+ p.description =<<EOF
416
+ 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.
417
+
418
+ You must also include the parent directory of the individual locale directories, plus the token {locale}, in the source-path; for example:
419
+
420
+ mxmlc -locale en_EN -source-path locale/{locale} -file-specs MainApp.mxml
421
+
422
+ For more information, see Localizing Flex Applicationsin (http://livedocs.adobe.com/flex/2/docs/00000898.html#129288) Flex 2 Developer's Guide.
423
+ EOF
424
+ end
425
+
426
+ add_param(:localized_description, :string) do |p|
427
+ p.description = "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)."
428
+ end
429
+
430
+ add_param(:localized_title, :string) do |p|
431
+ p.description = "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)."
432
+ end
433
+
434
+ add_param(:namespaces_namespace, :string) do |p|
435
+ p.description =<<EOF
436
+ 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.
437
+
438
+ For more information about manifest files, see About manifest files (http://livedocs.adobe.com/flex/2/docs/00001519.html#134676).
439
+ EOF
440
+ end
441
+
442
+ add_param(:optimize, :boolean) do |p|
443
+ p.description =<<EOF
444
+ Enables the ActionScript optimizer. This optimizer reduces file size and increases performance by optimizing the SWF file's bytecode.
445
+
446
+ The default value is false.
447
+ EOF
448
+ end
449
+
450
+ add_param(:output, :file) do |p|
451
+ p.description =<<EOF
452
+ 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.
453
+
454
+ The default SWF filename matches the target filename, but with a SWF file extension.
455
+
456
+ If you use a relative path to define the filename, it is always relative to the current working directory, not the target MXML application root.
457
+
458
+ The compiler creates extra directories based on the specified filename if those directories are not present.
459
+
460
+ When using this option with the component compiler, the output is a SWC file rather than a SWF file.
461
+ EOF
462
+ end
463
+
464
+ add_param(:publisher, :string) do |p|
465
+ p.description = "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)."
466
+ end
467
+
468
+ add_param(:resource_bundle_list, :file) do |p|
469
+ p.description =<<EOF
470
+ 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.
471
+
472
+ For more information, see Localizing Flex Applications (http://livedocs.adobe.com/flex/2/docs/00000898.html#129288) in Flex 2 Developer's Guide.
473
+ EOF
474
+ end
475
+
476
+ add_param(:runtime_shared_libraries, :urls) do |p|
477
+ p.description =<<EOF
478
+ Specifies a list of run-time shared libraries (RSLs) to use for this application. RSLs are dynamically-linked at run time.
479
+
480
+ 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.
481
+
482
+ For more information about RSLs, see Using Runtime Shared Libraries. (http://livedocs.adobe.com/flex/2/docs/00001520.html#168690)
483
+ EOF
484
+ end
485
+
486
+ add_param_alias(:rsl, :runtime_shared_libraries)
487
+
488
+ add_param(:services, :file) do |p|
489
+ p.description = "Specifies the location of the services-config.xml file. This file is used by Flex Data Services."
490
+ end
491
+
492
+ add_param(:show_binding_warnings, :boolean) do |p|
493
+ p.value = true
494
+ p.show_on_false = true
495
+ p.description =<<EOF
496
+ Shows a warning when Flash Player cannot detect changes to a bound property.
497
+
498
+ The default value is true.
499
+
500
+ For more information about compiler warnings, see Using SWC files (http://livedocs.adobe.com/flex/2/docs/00001505.html#158337).
501
+ EOF
502
+ end
503
+
504
+ add_param(:show_actionscript_warnings, :boolean) do |p|
505
+ p.value = true
506
+ p.show_on_false = true
507
+ p.description =<<EOF
508
+ Shows warnings for ActionScript classes.
509
+
510
+ The default value is true.
511
+
512
+ For more information about viewing warnings and errors, see Viewing warnings and errors (http://livedocs.adobe.com/flex/2/docs/00001517.html#182413).
513
+ EOF
514
+ end
515
+
516
+ add_param(:show_deprecation_warnings, :boolean) do |p|
517
+ p.value = true
518
+ p.show_on_false = true
519
+ p.description =<<EOF
520
+ Shows deprecation warnings for Flex components. To see warnings for ActionScript classes, use the show-actionscript-warnings option.
521
+
522
+ The default value is true.
523
+
524
+ For more information about viewing warnings and errors, see Viewing warnings and errors.
525
+ EOF
526
+ end
527
+
528
+ add_param(:source_path, :paths) do |p|
529
+ p.description =<<EOF
530
+ 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.
531
+
532
+ You can use wildcards to include all files and subdirectories of a directory.
533
+
534
+ To link an entire library SWC file and not individual classes or directories, use the library-path option.
535
+
536
+ The source path is also used as the search path for the component compiler's include-classes and include-resource-bundles options.
537
+
538
+ You can also use the += operator to append the new argument to the list of existing source path entries.
539
+ EOF
540
+ end
541
+
542
+ add_param_alias(:sp, :source_path)
543
+
544
+ add_param(:strict, :boolean) do |p|
545
+ p.value = true
546
+ p.show_on_false = true
547
+ p.description =<<EOF
548
+ Prints undefined property and function calls; also performs compile-time type checking on assignments and options supplied to method calls.
549
+
550
+ The default value is true.
551
+
552
+ For more information about viewing warnings and errors, see Viewing warnings and errors (http://livedocs.adobe.com/flex/2/docs/00001517.html#182413).
553
+ EOF
554
+ end
555
+
556
+ add_param(:theme, :files) do |p|
557
+ p.description =<<EOF
558
+ 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.
559
+
560
+ 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.
561
+ EOF
562
+ end
563
+
564
+ add_param(:title, :string) do |p|
565
+ p.description = "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)."
566
+ end
567
+
568
+ add_param(:use_network, :boolean) do |p|
569
+ p.value = true
570
+ p.show_on_false = true
571
+ p.description =<<EOF
572
+ Specifies that the current application uses network services.
573
+
574
+ The default value is true.
575
+
576
+ 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.
577
+
578
+ For more information about the use-network property, see Applying Flex Security (http://livedocs.adobe.com/flex/2/docs/00001328.html#137544).
579
+ EOF
580
+ end
581
+
582
+ add_param(:verbose_stacktraces, :boolean) do |p|
583
+ p.description =<<EOF
584
+ Generates source code that includes line numbers. When a run-time error occurs, the stacktrace shows these line numbers.
585
+
586
+ Enabling this option generates larger SWF files.\nThe default value is false.
587
+ EOF
588
+ end
589
+
590
+ add_param(:warn_warning_type, :boolean) do |p|
591
+ p.description = "Enables specified warnings. For more information, see Viewing warnings and errors (http://livedocs.adobe.com/flex/2/docs/00001517.html#182413)."
592
+ end
593
+
594
+ add_param(:warnings, :boolean) do |p|
595
+ p.description =<<EOF
596
+ Enables all warnings. Set to false to disable all warnings. This option overrides the warn-warning_type options.
597
+
598
+ The default value is true.
599
+ EOF
600
+ end
601
+
602
+ # This must be the last item in this list
603
+ add_param(:input, :file) do |p|
604
+ p.hidden_name = true
605
+ p.description = "Main source file to send compiler"
606
+ end
607
+
608
+ end
609
+
610
+ def define # :nodoc:
611
+ super
612
+
613
+ if(!output)
614
+ self.output = name
615
+ end
616
+
617
+ source_path << File.dirname(input)
618
+
619
+ CLEAN.add(output)
620
+ if(incremental)
621
+ CLEAN.add(FileList['**/**/*.cache'])
622
+ end
623
+ end
624
+
625
+ protected
626
+
627
+ # Use the swc path if possible
628
+ # Otherwise add to source
629
+ def resolve_library(library_task)
630
+ #TODO: Add support for libraries that don't get
631
+ # copied into the project
632
+ path = library_task.project_path
633
+ if(path.match(/.swc$/))
634
+ library_path << library_task.project_path
635
+ else
636
+ source_path << library_task.project_path
637
+ end
638
+ end
639
+
640
+ def execute(*args)
641
+ begin
642
+ super
643
+ rescue ExecutionError => e
644
+ if(e.message.index('Warning:'))
645
+ # MXMLC sends warnings to stderr....
646
+ Log.puts(e.message.gsub('[ERROR]', '[WARNING]'))
647
+ else
648
+ raise e
649
+ end
650
+ end
651
+ end
652
+
653
+ end
654
+ end
655
+
656
+ # Helper method for definining and accessing MXMLCTask instances in a rakefile
657
+ def mxmlc(args, &block)
658
+ Sprout::MXMLCTask.define_task(args, &block)
659
+ end