sprout-as3-bundle 0.1.27

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) 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/project/project_generator.rb +26 -0
  12. data/lib/sprout/generators/project/templates/DefaultSkin.as +7 -0
  13. data/lib/sprout/generators/project/templates/MainClass.as +12 -0
  14. data/lib/sprout/generators/project/templates/ProjectSprouts.jpg +0 -0
  15. data/lib/sprout/generators/project/templates/README.txt +56 -0
  16. data/lib/sprout/generators/project/templates/TestRunner.as +15 -0
  17. data/lib/sprout/generators/project/templates/generate +21 -0
  18. data/lib/sprout/generators/project/templates/rakefile.rb +91 -0
  19. data/lib/sprout/generators/suite/USAGE +0 -0
  20. data/lib/sprout/generators/suite/suite_generator.rb +17 -0
  21. data/lib/sprout/generators/suite/templates/TestSuite.as +18 -0
  22. data/lib/sprout/generators/test/USAGE +37 -0
  23. data/lib/sprout/generators/test/templates/TestCase.as +30 -0
  24. data/lib/sprout/generators/test/templates/TestSuite.as +18 -0
  25. data/lib/sprout/generators/test/test_generator.rb +20 -0
  26. data/lib/sprout/tasks/asdoc_task.rb +39 -0
  27. data/lib/sprout/tasks/asunit_task.rb +44 -0
  28. data/lib/sprout/tasks/compc_doc.rb +508 -0
  29. data/lib/sprout/tasks/compc_task.rb +100 -0
  30. data/lib/sprout/tasks/fcsh_task.rb +13 -0
  31. data/lib/sprout/tasks/fdb_task.rb +0 -0
  32. data/lib/sprout/tasks/mxmlc_doc.rb +484 -0
  33. data/lib/sprout/tasks/mxmlc_task.rb +657 -0
  34. data/rakefile.rb +66 -0
  35. metadata +128 -0
@@ -0,0 +1,657 @@
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.description = "Defines the default application size, in pixels for example: default_size = '800 600'. This is an advanced option."
168
+ end
169
+
170
+ add_param(:default_css_url, :url) do |p|
171
+ p.description =<<EOF
172
+ 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.
173
+
174
+ 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.
175
+
176
+ This is an advanced option.
177
+ EOF
178
+ end
179
+
180
+ add_param(:description, :string) do |p|
181
+ 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)."
182
+ end
183
+
184
+ add_param(:dump_config, :file) do |p|
185
+ p.description =<<EOF
186
+ Outputs the compiler options in the flex-config.xml file to the target path; for example:
187
+
188
+ mxmlc -dump-config myapp-config.xml
189
+
190
+ This is an advanced option.
191
+ EOF
192
+ end
193
+
194
+ # TODO: Add parameter interactions to ensure
195
+ # valid state?
196
+ add_param(:es, :boolean) do |p|
197
+ p.description =<<EOF
198
+ 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.
199
+
200
+ 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.
201
+
202
+ The default value is false. If you set this option to true, you must set the es3 option to false.
203
+
204
+ This is an advanced option.
205
+ EOF
206
+ end
207
+
208
+ add_param(:externs, :symbols) do |p|
209
+ p.description =<<EOF
210
+ Sets a list of symbols to exclude from linking when compiling a SWF file.
211
+
212
+ This option provides compile-time link checking for external references that are dynamically linked.
213
+
214
+ For more information about dynamic linking, see About linking (http://livedocs.adobe.com/flex/2/docs/00001521.html#205852).
215
+
216
+ This is an advanced option.
217
+ EOF
218
+ end
219
+
220
+ add_param(:external_library_path, :files) do |p|
221
+ p.description =<<EOF
222
+ 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.
223
+
224
+ For more information about dynamic linking, see About linking (http://livedocs.adobe.com/flex/2/docs/00001521.html#205852).
225
+
226
+ You can use the += operator to append the new SWC file to the list of external libraries.
227
+
228
+ This parameter has been aliased as +el+.
229
+ EOF
230
+ end
231
+
232
+ add_param_alias(:el, :external_library_path)
233
+
234
+ add_param(:file_specs, :files) do |p|
235
+ p.description = "Specifies source files to compile. This is the default option for the mxmlc compiler."
236
+ end
237
+
238
+ add_param(:fonts_languages_language_range, :string) do |p|
239
+ p.description =<<EOF
240
+ 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.
241
+
242
+ This is an advanced option.
243
+ EOF
244
+ end
245
+
246
+ add_param(:fonts_managers, :symbols) do |p|
247
+ p.description =<<EOF
248
+ 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).
249
+
250
+ This is an advanced option.
251
+ EOF
252
+ end
253
+
254
+ add_param(:fonts_max_cached_fonts, :number) do |p|
255
+ p.description =<<EOF
256
+ 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).
257
+
258
+ This is an advanced option.
259
+ EOF
260
+ end
261
+
262
+ add_param(:fonts_max_glyphs_per_face, :number) do |p|
263
+ p.description =<<EOF
264
+ 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).
265
+
266
+ This is an advanced option.
267
+ EOF
268
+ end
269
+
270
+ add_param(:frames_frame, :string) do |p|
271
+ p.description =<<EOF
272
+ Specifies a SWF file frame label with a sequence of class names that are linked onto the frame.
273
+
274
+ For example: frames_frame = 'someLabel MyProject OtherProject FoodProject'
275
+
276
+ This is an advanced option.
277
+ EOF
278
+ end
279
+
280
+ add_param(:generate_frame_loader, :boolean) do |p|
281
+ p.description =<<EOF
282
+ Toggles the generation of an IFlexBootstrap-derived loader class.
283
+
284
+ This is an advanced option.
285
+ EOF
286
+ end
287
+
288
+ add_param(:headless_server, :boolean) do |p|
289
+ p.description =<<EOF
290
+ Enables the headless implementation of the Flex compiler. This sets the following:
291
+
292
+ System.setProperty('java.awt.headless', 'true')
293
+
294
+ The headless setting (java.awt.headless=true) is required to use fonts and SVG on UNIX systems without X Windows.
295
+
296
+ This is an advanced option.
297
+ EOF
298
+ end
299
+
300
+ add_param(:include_libraries, :files) do |p|
301
+ p.description =<<EOF
302
+ Links all classes inside a SWC file to the resulting application SWF file, regardless of whether or not they are used.
303
+
304
+ Contrast this option with the library-path option that includes only those classes that are referenced at compile time.
305
+
306
+ To link one or more classes whether or not they are used and not an entire SWC file, use the includes option.
307
+
308
+ This option is commonly used to specify resource bundles.
309
+ EOF
310
+ end
311
+
312
+ add_param(:includes, :symbols) do |p|
313
+ p.description =<<EOF
314
+ Links one or more classes to the resulting application SWF file, whether or not those classes are required at compile time.
315
+
316
+ To link an entire SWC file rather than individual classes, use the include-libraries option.
317
+ EOF
318
+ end
319
+
320
+ add_param(:incremental, :boolean) do |p|
321
+ p.description =<<EOF
322
+ Enables incremental compilation. For more information, see About incremental compilation (http://livedocs.adobe.com/flex/2/docs/00001506.html#153980).
323
+
324
+ 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.
325
+ EOF
326
+ end
327
+
328
+ add_param(:keep_generated_actionscript, :boolean) do |p|
329
+ p.description =<<EOF
330
+ Determines whether to keep the generated ActionScript class files.
331
+
332
+ The generated class files include stubs and classes that are generated by the compiler and used to build the SWF file.
333
+
334
+ 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.
335
+
336
+ The default names of the primary generated class files are filename-generated.as and filename-interface.as.
337
+
338
+ The default value is false.\nThis is an advanced option.
339
+ EOF
340
+ end
341
+
342
+ add_param(:language, :string) do |p|
343
+ 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)."
344
+ end
345
+
346
+ add_param(:lazy_init, :boolean) do |p|
347
+ p.description =<<EOF
348
+ Enables ABC bytecode lazy initialization.
349
+
350
+ The default value is false.
351
+
352
+ This is an advanced option.
353
+ EOF
354
+ end
355
+
356
+ add_param(:library_path, :files) do |p|
357
+ p.description =<<EOF
358
+ Links SWC files to the resulting application SWF file. The compiler only links in those classes for the SWC file that are required.
359
+
360
+ The default value of the library-path option includes all SWC files in the libs directory and the current locale. These are required.
361
+
362
+ To point to individual classes or packages rather than entire SWC files, use the source-path option.
363
+
364
+ 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.
365
+
366
+ You can use the += operator to append the new argument to the list of existing SWC files.
367
+
368
+ 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.
369
+ EOF
370
+ end
371
+
372
+ add_param_alias(:l, :library_path)
373
+
374
+ add_param(:link_report, :file) do |p|
375
+ p.description =<<EOF
376
+ 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.
377
+
378
+ The file format output by this command can be used to write a file for input to the load-externs option.
379
+
380
+ For more information on the report, see Examining linker dependencies (http://livedocs.adobe.com/flex/2/docs/00001394.html#211202).
381
+
382
+ This is an advanced option.
383
+ EOF
384
+ end
385
+
386
+ add_param(:load_config, :file) do |p|
387
+ p.description =<<EOF
388
+ Specifies the location of the configuration file that defines compiler options.
389
+
390
+ If you specify a configuration file, you can override individual options by setting them on the command line.
391
+
392
+ All relative paths in the configuration file are relative to the location of the configuration file itself.
393
+
394
+ Use the += operator to chain this configuration file to other configuration files.
395
+
396
+ 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).
397
+ EOF
398
+ end
399
+
400
+ add_param(:load_externs, :file) do |p|
401
+ p.description =<<EOF
402
+ 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).
403
+
404
+ This option provides compile-time link checking for external components that are dynamically linked.
405
+
406
+ For more information about dynamic linking, see About linking (http://livedocs.adobe.com/flex/2/docs/00001521.html#205852).
407
+
408
+ This is an advanced option.
409
+ EOF
410
+ end
411
+
412
+ add_param(:locale, :string) do |p|
413
+ p.description =<<EOF
414
+ 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.
415
+
416
+ You must also include the parent directory of the individual locale directories, plus the token {locale}, in the source-path; for example:
417
+
418
+ mxmlc -locale en_EN -source-path locale/{locale} -file-specs MainApp.mxml
419
+
420
+ For more information, see Localizing Flex Applicationsin (http://livedocs.adobe.com/flex/2/docs/00000898.html#129288) Flex 2 Developer's Guide.
421
+ EOF
422
+ end
423
+
424
+ add_param(:localized_description, :string) do |p|
425
+ 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)."
426
+ end
427
+
428
+ add_param(:localized_title, :string) do |p|
429
+ 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)."
430
+ end
431
+
432
+ add_param(:namespaces_namespace, :string) do |p|
433
+ p.description =<<EOF
434
+ 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.
435
+
436
+ For more information about manifest files, see About manifest files (http://livedocs.adobe.com/flex/2/docs/00001519.html#134676).
437
+ EOF
438
+ end
439
+
440
+ add_param(:optimize, :boolean) do |p|
441
+ p.description =<<EOF
442
+ Enables the ActionScript optimizer. This optimizer reduces file size and increases performance by optimizing the SWF file's bytecode.
443
+
444
+ The default value is false.
445
+ EOF
446
+ end
447
+
448
+ add_param(:output, :file) do |p|
449
+ p.description =<<EOF
450
+ 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.
451
+
452
+ The default SWF filename matches the target filename, but with a SWF file extension.
453
+
454
+ 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.
455
+
456
+ The compiler creates extra directories based on the specified filename if those directories are not present.
457
+
458
+ When using this option with the component compiler, the output is a SWC file rather than a SWF file.
459
+ EOF
460
+ end
461
+
462
+ add_param(:publisher, :string) do |p|
463
+ 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)."
464
+ end
465
+
466
+ add_param(:resource_bundle_list, :file) do |p|
467
+ p.description =<<EOF
468
+ 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.
469
+
470
+ For more information, see Localizing Flex Applications (http://livedocs.adobe.com/flex/2/docs/00000898.html#129288) in Flex 2 Developer's Guide.
471
+ EOF
472
+ end
473
+
474
+ add_param(:runtime_shared_libraries, :urls) do |p|
475
+ p.description =<<EOF
476
+ Specifies a list of run-time shared libraries (RSLs) to use for this application. RSLs are dynamically-linked at run time.
477
+
478
+ 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.
479
+
480
+ For more information about RSLs, see Using Runtime Shared Libraries. (http://livedocs.adobe.com/flex/2/docs/00001520.html#168690)
481
+ EOF
482
+ end
483
+
484
+ add_param_alias(:rsl, :runtime_shared_libraries)
485
+
486
+ add_param(:services, :file) do |p|
487
+ p.description = "Specifies the location of the services-config.xml file. This file is used by Flex Data Services."
488
+ end
489
+
490
+ add_param(:show_binding_warnings, :boolean) do |p|
491
+ p.value = true
492
+ p.show_on_false = true
493
+ p.description =<<EOF
494
+ Shows a warning when Flash Player cannot detect changes to a bound property.
495
+
496
+ The default value is true.
497
+
498
+ For more information about compiler warnings, see Using SWC files (http://livedocs.adobe.com/flex/2/docs/00001505.html#158337).
499
+ EOF
500
+ end
501
+
502
+ add_param(:show_actionscript_warnings, :boolean) do |p|
503
+ p.value = true
504
+ p.show_on_false = true
505
+ p.description =<<EOF
506
+ Shows warnings for ActionScript classes.
507
+
508
+ The default value is true.
509
+
510
+ For more information about viewing warnings and errors, see Viewing warnings and errors (http://livedocs.adobe.com/flex/2/docs/00001517.html#182413).
511
+ EOF
512
+ end
513
+
514
+ add_param(:show_deprecation_warnings, :boolean) do |p|
515
+ p.value = true
516
+ p.show_on_false = true
517
+ p.description =<<EOF
518
+ Shows deprecation warnings for Flex components. To see warnings for ActionScript classes, use the show-actionscript-warnings option.
519
+
520
+ The default value is true.
521
+
522
+ For more information about viewing warnings and errors, see Viewing warnings and errors.
523
+ EOF
524
+ end
525
+
526
+ add_param(:source_path, :paths) do |p|
527
+ p.description =<<EOF
528
+ 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.
529
+
530
+ You can use wildcards to include all files and subdirectories of a directory.
531
+
532
+ To link an entire library SWC file and not individual classes or directories, use the library-path option.
533
+
534
+ The source path is also used as the search path for the component compiler's include-classes and include-resource-bundles options.
535
+
536
+ You can also use the += operator to append the new argument to the list of existing source path entries.
537
+ EOF
538
+ end
539
+
540
+ add_param_alias(:sp, :source_path)
541
+
542
+ add_param(:strict, :boolean) do |p|
543
+ p.value = true
544
+ p.show_on_false = true
545
+ p.description =<<EOF
546
+ Prints undefined property and function calls; also performs compile-time type checking on assignments and options supplied to method calls.
547
+
548
+ The default value is true.
549
+
550
+ For more information about viewing warnings and errors, see Viewing warnings and errors (http://livedocs.adobe.com/flex/2/docs/00001517.html#182413).
551
+ EOF
552
+ end
553
+
554
+ add_param(:theme, :files) do |p|
555
+ p.description =<<EOF
556
+ 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.
557
+
558
+ 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.
559
+ EOF
560
+ end
561
+
562
+ add_param(:title, :string) do |p|
563
+ 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)."
564
+ end
565
+
566
+ add_param(:use_network, :boolean) do |p|
567
+ p.value = true
568
+ p.show_on_false = true
569
+ p.description =<<EOF
570
+ Specifies that the current application uses network services.
571
+
572
+ The default value is true.
573
+
574
+ 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.
575
+
576
+ For more information about the use-network property, see Applying Flex Security (http://livedocs.adobe.com/flex/2/docs/00001328.html#137544).
577
+ EOF
578
+ end
579
+
580
+ add_param(:verbose_stacktraces, :boolean) do |p|
581
+ p.description =<<EOF
582
+ Generates source code that includes line numbers. When a run-time error occurs, the stacktrace shows these line numbers.
583
+
584
+ Enabling this option generates larger SWF files.\nThe default value is false.
585
+ EOF
586
+ end
587
+
588
+ add_param(:warn_warning_type, :boolean) do |p|
589
+ p.description = "Enables specified warnings. For more information, see Viewing warnings and errors (http://livedocs.adobe.com/flex/2/docs/00001517.html#182413)."
590
+ end
591
+
592
+ add_param(:warnings, :boolean) do |p|
593
+ p.description =<<EOF
594
+ Enables all warnings. Set to false to disable all warnings. This option overrides the warn-warning_type options.
595
+
596
+ The default value is true.
597
+ EOF
598
+ end
599
+
600
+ # This must be the last item in this list
601
+ add_param(:input, :file) do |p|
602
+ p.hidden_name = true
603
+ p.description = "Main source file to send compiler"
604
+ end
605
+
606
+ end
607
+
608
+ def define # :nodoc:
609
+ super
610
+
611
+ if(!output)
612
+ self.output = name
613
+ end
614
+
615
+ source_path << File.dirname(input)
616
+
617
+ CLEAN.add(output)
618
+ if(incremental)
619
+ CLEAN.add(FileList['**/**/*.cache'])
620
+ end
621
+ end
622
+
623
+ protected
624
+
625
+ # Use the swc path if possible
626
+ # Otherwise add to source
627
+ def resolve_library(library_task)
628
+ #TODO: Add support for libraries that don't get
629
+ # copied into the project
630
+ path = library_task.project_path
631
+ if(path.match(/.swc$/))
632
+ library_path << library_task.project_path
633
+ else
634
+ source_path << library_task.project_path
635
+ end
636
+ end
637
+
638
+ def execute(*args)
639
+ begin
640
+ super
641
+ rescue ExecutionError => e
642
+ if(e.message.index('Warning:'))
643
+ # MXMLC sends warnings to stderr....
644
+ Log.puts(e.message.gsub('[ERROR]', '[WARNING]'))
645
+ else
646
+ raise e
647
+ end
648
+ end
649
+ end
650
+
651
+ end
652
+ end
653
+
654
+ # Helper method for definining and accessing MXMLCTask instances in a rakefile
655
+ def mxmlc(args, &block)
656
+ Sprout::MXMLCTask.define_task(args, &block)
657
+ end