h4oflashsdk 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +3 -0
- data/Gemfile.lock +41 -0
- data/POSTINSTALL.rdoc +79 -0
- data/README.textile +79 -0
- data/VERSION +1 -0
- data/bin/flashlog +8 -0
- data/bin/flashplayer +9 -0
- data/bin/sprout-as3 +9 -0
- data/bin/sprout-flex +8 -0
- data/ext/CloseFlashPlayerForDumbassOSX.scpt +6 -0
- data/ext/OpenFlashPlayerForDumbassOSX.scpt +12 -0
- data/flashsdk.gemspec +25 -0
- data/flashsdk.komodoproject +4 -0
- data/lib/flashplayer/errors.rb +12 -0
- data/lib/flashplayer/executable.rb +143 -0
- data/lib/flashplayer/log_file.rb +94 -0
- data/lib/flashplayer/mm_config.rb +96 -0
- data/lib/flashplayer/module.rb +51 -0
- data/lib/flashplayer/specification.rb +45 -0
- data/lib/flashplayer/system_mixins.rb +98 -0
- data/lib/flashplayer/task.legacy.rb +293 -0
- data/lib/flashplayer/task.rb +62 -0
- data/lib/flashplayer/trust.rb +45 -0
- data/lib/flashplayer.rb +9 -0
- data/lib/flashsdk/acompc.rb +29 -0
- data/lib/flashsdk/adl.rb +83 -0
- data/lib/flashsdk/adt.rb +276 -0
- data/lib/flashsdk/amxmlc.rb +28 -0
- data/lib/flashsdk/asdoc.rb +164 -0
- data/lib/flashsdk/compc.rb +124 -0
- data/lib/flashsdk/compiler_base.rb +1131 -0
- data/lib/flashsdk/fcsh.rb +173 -0
- data/lib/flashsdk/fcsh_socket.rb +167 -0
- data/lib/flashsdk/fdb.rb +833 -0
- data/lib/flashsdk/generators/class_generator.rb +87 -0
- data/lib/flashsdk/generators/flash_helper.rb +234 -0
- data/lib/flashsdk/generators/flex_project_generator.rb +30 -0
- data/lib/flashsdk/generators/project_generator.rb +31 -0
- data/lib/flashsdk/generators/templates/ActionScript3Class.as +9 -0
- data/lib/flashsdk/generators/templates/ActionScript3MainClass.as +11 -0
- data/lib/flashsdk/generators/templates/ActionScript3RunnerClass.as +19 -0
- data/lib/flashsdk/generators/templates/DefaultProjectImage.png +0 -0
- data/lib/flashsdk/generators/templates/Flex4Application.mxml +45 -0
- data/lib/flashsdk/generators/templates/Flex4Main.css +7 -0
- data/lib/flashsdk/generators/templates/Flex4Rakefile.rb +34 -0
- data/lib/flashsdk/generators/templates/Flex4RunnerClass.mxml +29 -0
- data/lib/flashsdk/generators/templates/FlexTestRunner.mxml +0 -0
- data/lib/flashsdk/generators/templates/Gemfile +5 -0
- data/lib/flashsdk/generators/templates/rakefile.rb +79 -0
- data/lib/flashsdk/module.rb +107 -0
- data/lib/flashsdk/mxmlc.rb +160 -0
- data/lib/flashsdk.rb +24 -0
- data/lib/flex3.rb +54 -0
- data/lib/flex4.rb +115 -0
- data/rakefile.rb +42 -0
- data/test/fixtures/acompc/simple/SomeAirFile.as +11 -0
- data/test/fixtures/air/simple/SomeProject.apk +1 -0
- data/test/fixtures/air/simple/SomeProject.as +11 -0
- data/test/fixtures/air/simple/SomeProject.mxml +9 -0
- data/test/fixtures/air/simple/SomeProject.pfx +0 -0
- data/test/fixtures/air/simple/SomeProject.swf +0 -0
- data/test/fixtures/air/simple/SomeProject.xml +13 -0
- data/test/fixtures/asdoc/lib/OtherFile.as +17 -0
- data/test/fixtures/asdoc/src/SomeFile.as +11 -0
- data/test/fixtures/compc/simple/SomeFile.as +11 -0
- data/test/fixtures/flashplayer/AsUnit Runner.swf +0 -0
- data/test/fixtures/mxmlc/broken/SomeFile.as +10 -0
- data/test/fixtures/mxmlc/simple/SomeFile.as +11 -0
- data/test/fixtures/sdk/fdb +90 -0
- data/test/fixtures/sdk/mxmlc +56 -0
- data/test/unit/acompc_test.rb +37 -0
- data/test/unit/adl_test.rb +32 -0
- data/test/unit/adt_test.rb +185 -0
- data/test/unit/amxmlc_test.rb +55 -0
- data/test/unit/asdoc_test.rb +45 -0
- data/test/unit/class_generator_test.rb +56 -0
- data/test/unit/compc_test.rb +37 -0
- data/test/unit/fake_flashplayer_system.rb +11 -0
- data/test/unit/fcsh_socket_test.rb +53 -0
- data/test/unit/fcsh_test.rb +55 -0
- data/test/unit/fdb_test.rb +54 -0
- data/test/unit/flash_helper_test.rb +43 -0
- data/test/unit/flashplayer_executable_test.rb +69 -0
- data/test/unit/flashplayer_log_file_test.rb +47 -0
- data/test/unit/flashplayer_mm_config_test.rb +74 -0
- data/test/unit/flashplayer_module_test.rb +56 -0
- data/test/unit/flashplayer_task_test.rb +91 -0
- data/test/unit/flashplayer_trust_test.rb +30 -0
- data/test/unit/flex_compiler_options_test.rb +213 -0
- data/test/unit/flex_generator_test.rb +37 -0
- data/test/unit/mxmlc_test.rb +65 -0
- data/test/unit/project_generator_test.rb +57 -0
- data/test/unit/test_helper.rb +18 -0
- metadata +284 -0
data/lib/flashsdk/adt.rb
ADDED
@@ -0,0 +1,276 @@
|
|
1
|
+
module FlashSDK
|
2
|
+
|
3
|
+
##
|
4
|
+
# Creates AIR certificates and compiles AIR packages for distribution.
|
5
|
+
#
|
6
|
+
# Following is an example of how this tool might be used to create
|
7
|
+
# a certificate and AIR package:
|
8
|
+
#
|
9
|
+
# mxmlc 'bin/SomeProject.swf' do |t|
|
10
|
+
# t.input = 'src/SomeProject.as'
|
11
|
+
# end
|
12
|
+
#
|
13
|
+
# adt 'cert/SomeProject.pfx' do |t|
|
14
|
+
# t.certificate = true
|
15
|
+
# t.cn = 'SelfCertificate'
|
16
|
+
# t.key_type = '2048-RSA'
|
17
|
+
# t.pfx_file = 'cert/SomeProject.pfx'
|
18
|
+
# # Don't check the .password file into version control:
|
19
|
+
# t.password = File.read('cert/.password')
|
20
|
+
# end
|
21
|
+
#
|
22
|
+
# adt 'bin/SomeProject.air' => ['bin/SomeProject.swf', 'cert/SomeProject.pfx'] do |t|
|
23
|
+
# t.package = true
|
24
|
+
# t.package_input = 'SomeProject.xml'
|
25
|
+
# t.package_output = 'bin/SomeProject.air'
|
26
|
+
# t.storetype = 'PKCS12'
|
27
|
+
# t.keystore = 'cert/SomeProject.pfx'
|
28
|
+
# # Don't check the .password file into version control:
|
29
|
+
# t.storepass = File.read('cert/.password')
|
30
|
+
# t.included_files << 'bin/SomeProject.swf'
|
31
|
+
# end
|
32
|
+
#
|
33
|
+
# desc "Compile, certify and package the AIR application"
|
34
|
+
# task package => 'bin/SomeProject.air'
|
35
|
+
#
|
36
|
+
class ADT < Sprout::Executable::Base
|
37
|
+
#NOTE:
|
38
|
+
# The order of these parameters is important!
|
39
|
+
# Please do not alphabetize or rearrange unless you're
|
40
|
+
# fixing a bug related to how ADT actually expects
|
41
|
+
# the arguments...
|
42
|
+
|
43
|
+
##
|
44
|
+
# Install an app on a device
|
45
|
+
#
|
46
|
+
add_param :installApp, Boolean, { :hidden_value => true }
|
47
|
+
|
48
|
+
##
|
49
|
+
# Uninstall an app from a device
|
50
|
+
#
|
51
|
+
add_param :uninstallApp, Boolean, { :hidden_value => true }
|
52
|
+
|
53
|
+
##
|
54
|
+
# Launch an app on a device
|
55
|
+
#
|
56
|
+
add_param :launchApp, Boolean, { :hidden_value => true }
|
57
|
+
|
58
|
+
##
|
59
|
+
# The platform to use (ex: android)
|
60
|
+
#
|
61
|
+
add_param :platform, String, { :delimiter => ' ' }
|
62
|
+
|
63
|
+
##
|
64
|
+
# The appid of the app being installed/uninstalled (ex: com.foo.Bar)
|
65
|
+
#
|
66
|
+
add_param :appid, String, { :delimiter => ' ' }
|
67
|
+
|
68
|
+
##
|
69
|
+
# Create an AIR package.
|
70
|
+
#
|
71
|
+
add_param :package, Boolean, { :hidden_value => true }
|
72
|
+
|
73
|
+
##
|
74
|
+
# Set true to create a certificate.
|
75
|
+
#
|
76
|
+
# If this value is true, you can optionally set org_unit, org_name and country.
|
77
|
+
#
|
78
|
+
# If this value is true, you MUST set +cn+, +key_type+, and +pfx_file+.
|
79
|
+
#
|
80
|
+
# adt 'cert/SampleCert.pfx' do |t|
|
81
|
+
# t.certificate = true
|
82
|
+
# t.cn = 'SelfCertificate'
|
83
|
+
# t.key_type = '1024-RSA'
|
84
|
+
# t.pfx_file = 'cert/SampleCert.pfx'
|
85
|
+
# t.password = 'samplepassword'
|
86
|
+
# end
|
87
|
+
#
|
88
|
+
add_param :certificate, Boolean, { :hidden_value => true }
|
89
|
+
|
90
|
+
##
|
91
|
+
# A Signing Option
|
92
|
+
#
|
93
|
+
add_param :storetype, String, { :delimiter => ' ' }
|
94
|
+
|
95
|
+
|
96
|
+
##
|
97
|
+
# A Signing Option
|
98
|
+
#
|
99
|
+
add_param :keystore, String, { :delimiter => ' ' }
|
100
|
+
|
101
|
+
##
|
102
|
+
# Provide the password directly to the ADT task
|
103
|
+
# so that it doesn't attempt to prompt.
|
104
|
+
#
|
105
|
+
add_param :storepass, String, { :delimiter => ' ' }
|
106
|
+
|
107
|
+
|
108
|
+
##
|
109
|
+
# A Signing Option
|
110
|
+
#
|
111
|
+
add_param :keypass, String, { :delimiter => ' ' }
|
112
|
+
|
113
|
+
|
114
|
+
##
|
115
|
+
# A Signing Option
|
116
|
+
#
|
117
|
+
add_param :providername, String, { :delimiter => ' ' }
|
118
|
+
|
119
|
+
|
120
|
+
##
|
121
|
+
# A Signing Option
|
122
|
+
#
|
123
|
+
add_param :tsa, String
|
124
|
+
|
125
|
+
##
|
126
|
+
# Check Store Signing options
|
127
|
+
#
|
128
|
+
add_param :checkstore, String
|
129
|
+
|
130
|
+
##
|
131
|
+
# Provisioning profile for iOS apps
|
132
|
+
#
|
133
|
+
add_param :provisioning_profile, String, { :delimiter => ' ' }
|
134
|
+
|
135
|
+
##
|
136
|
+
# Expects two files:
|
137
|
+
#
|
138
|
+
# 1) The Airi file (?)
|
139
|
+
# 2) The application description
|
140
|
+
#add_param :prepare, Files
|
141
|
+
|
142
|
+
##
|
143
|
+
# Expects two files:
|
144
|
+
#
|
145
|
+
# 1) The Airi file (?)
|
146
|
+
# 2) The Air file
|
147
|
+
add_param :sign, Files, { :delimiter => ' ' }
|
148
|
+
|
149
|
+
|
150
|
+
##
|
151
|
+
# The AIR runtime version to use.
|
152
|
+
add_param :version, String, { :delimiter => ' ' }
|
153
|
+
|
154
|
+
|
155
|
+
##
|
156
|
+
# Use a specific target, like apk-debug for Android or ipa-debug for iOS
|
157
|
+
#
|
158
|
+
add_param :target, String, { :delimiter => ' ' }
|
159
|
+
|
160
|
+
##
|
161
|
+
# The AIR file that should be created
|
162
|
+
# after packaging is complete.
|
163
|
+
#
|
164
|
+
add_param :package_output, String, { :hidden_name => true }
|
165
|
+
|
166
|
+
##
|
167
|
+
# The XML application descriptor that
|
168
|
+
# should be used to create an AIR
|
169
|
+
# application.
|
170
|
+
#
|
171
|
+
add_param :package_input, File, { :hidden_name => true }
|
172
|
+
|
173
|
+
##
|
174
|
+
# Organization unit, follows certificate.
|
175
|
+
#
|
176
|
+
add_param :org_unit, String
|
177
|
+
|
178
|
+
##
|
179
|
+
# Organization name, follows certificate.
|
180
|
+
#
|
181
|
+
add_param :org_name, String
|
182
|
+
|
183
|
+
##
|
184
|
+
# Country, follows certificate.
|
185
|
+
#
|
186
|
+
add_param :country, String
|
187
|
+
|
188
|
+
##
|
189
|
+
# The Certificate name.
|
190
|
+
#
|
191
|
+
add_param :cn, String, { :delimiter => ' ' }
|
192
|
+
|
193
|
+
##
|
194
|
+
# Key Type, follows certificate.
|
195
|
+
#
|
196
|
+
add_param :key_type, String, { :hidden_name => true }
|
197
|
+
|
198
|
+
##
|
199
|
+
# PFX File
|
200
|
+
#
|
201
|
+
add_param :pfx_file, String, { :hidden_name => true }
|
202
|
+
|
203
|
+
##
|
204
|
+
# When creating a certificate, this is the file
|
205
|
+
# where the password can be found.
|
206
|
+
#
|
207
|
+
add_param :password, String, { :hidden_name => true, :delimiter => ' ' }
|
208
|
+
|
209
|
+
##
|
210
|
+
# Expects Signing Options, plus
|
211
|
+
# two files:
|
212
|
+
#
|
213
|
+
# 1) The Air file in
|
214
|
+
# 2) The Air file out
|
215
|
+
#
|
216
|
+
add_param :migrate, Files
|
217
|
+
|
218
|
+
##
|
219
|
+
# A list of files to include in the
|
220
|
+
#
|
221
|
+
add_param :included_files, Files, { :hidden_name => true }
|
222
|
+
|
223
|
+
##
|
224
|
+
# A list of paths (directories) to search
|
225
|
+
# for contents that will be included in the
|
226
|
+
# packaged AIR application.
|
227
|
+
#
|
228
|
+
# If files are hidden from the file system,
|
229
|
+
# they will not be included.
|
230
|
+
#
|
231
|
+
add_param :included_paths, Paths, { :hidden_name => true }
|
232
|
+
|
233
|
+
##
|
234
|
+
# Allows file options in the form of -C <dir> <fileOrDir>+
|
235
|
+
#
|
236
|
+
# For example if you defined:
|
237
|
+
#
|
238
|
+
# t.file_options << 'dir path/to/asset.xml'
|
239
|
+
#
|
240
|
+
# In your adt task defintion, then:
|
241
|
+
#
|
242
|
+
# -C dir path/to/asset.xml
|
243
|
+
#
|
244
|
+
# Would be appended to your arguments.
|
245
|
+
#
|
246
|
+
add_param :file_options, Strings, { :shell_name => '-C', :delimiter => ' ' }
|
247
|
+
|
248
|
+
##
|
249
|
+
# The the Ruby file that will load the expected
|
250
|
+
# Sprout::Specification.
|
251
|
+
#
|
252
|
+
# Default value is 'flex4'
|
253
|
+
#
|
254
|
+
set :pkg_name, 'flex4'
|
255
|
+
|
256
|
+
##
|
257
|
+
# The default pkg version
|
258
|
+
#
|
259
|
+
set :pkg_version, ">= #{FlashSDK::VERSION}"
|
260
|
+
|
261
|
+
##
|
262
|
+
# The default executable target.
|
263
|
+
#
|
264
|
+
set :executable, :adt
|
265
|
+
|
266
|
+
##
|
267
|
+
# Ensure the default prefix is '-'
|
268
|
+
set :default_prefix, '-'
|
269
|
+
end
|
270
|
+
end
|
271
|
+
|
272
|
+
def adt *args, &block
|
273
|
+
exe = FlashSDK::ADT.new
|
274
|
+
exe.to_rake(*args, &block)
|
275
|
+
exe
|
276
|
+
end
|
@@ -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
|
+
|