buildr-as3 0.1.20 → 0.1.28

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.
@@ -0,0 +1,23 @@
1
+ #
2
+ # Copyright (C) 2011 by Dominic Graefen / http://devboy.org
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ # of this software and associated documentation files (the "Software"), to deal
6
+ # in the Software without restriction, including without limitation the rights
7
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ # copies of the Software, and to permit persons to whom the Software is
9
+ # furnished to do so, subject to the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be included in
12
+ # all copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
+ # THE SOFTWARE.
21
+ #
22
+
23
+ require "#{File.dirname(__FILE__)}/ide/fdt4"
@@ -39,7 +39,7 @@ module Buildr
39
39
 
40
40
  after_define("as3:fdt4:generate" => :package) do |project|
41
41
  project.task("as3:fdt4:generate") do
42
- fail("Cannot create fdt4 projects on Windows machines, no support for symlinks.") unless !Buildr::Util.win_os?
42
+ fail("Cannot create fdt4 projects on Windows machines, no support for symlinks.") if Buildr::Util.win_os?
43
43
  if [:mxmlc, :compc, :airmxmlc, :aircompc].include? project.compile.compiler
44
44
  output = project.base_dir + "/.settings/com.powerflasher.fdt.classpath"
45
45
  puts "Writing FDT4 classpath file: #{output}"
@@ -19,195 +19,11 @@
19
19
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
20
  # THE SOFTWARE.
21
21
  #
22
- require File.dirname(__FILE__)+"/compiler"
23
- require "buildr/packaging"
24
- require "ftools"
25
- module Buildr
26
- module AS3
27
- module Packaging
28
- class SwcTask < Rake::FileTask
22
+ require File.dirname(__FILE__)+"/packaging/swf"
23
+ require File.dirname(__FILE__)+"/packaging/swc"
24
+ require File.dirname(__FILE__)+"/packaging/air"
25
+ require File.dirname(__FILE__)+"/packaging/airi"
29
26
 
30
- include Extension
31
- include Buildr::AS3::Compiler::CompilerUtils
32
-
33
- attr_writer :target_swc, :src_swc
34
- attr_reader :target_swc, :src_swc
35
-
36
- def initialize(*args) #:nodoc:
37
- super
38
- enhance do
39
- fail "File not found: #{src_swc}" unless File.exists? src_swc
40
- File.copy(src_swc, target_swc)
41
- end
42
- end
43
-
44
- def needed?
45
- is_output_outdated? target_swc, src_swc
46
- end
47
-
48
- first_time do
49
- desc 'create swc package task'
50
- Project.local_task('package_swc')
51
- end
52
-
53
- before_define do |project|
54
- SwcTask.define_task('package_swc').tap do |package_swc|
55
- package_swc
56
- end
57
- end
58
-
59
- end
60
-
61
- class SwfTask < Rake::FileTask
62
-
63
- include Extension
64
- include Buildr::AS3::Compiler::CompilerUtils
65
-
66
- attr_writer :target_swf, :src_swf
67
- attr_reader :target_swf, :src_swf
68
-
69
- def initialize(*args) #:nodoc:
70
- super
71
- enhance do
72
- fail "File not found: #{src_swf}" unless File.exists? src_swf
73
- File.copy(src_swf, target_swf)
74
- end
75
- end
76
-
77
- def needed?
78
- is_output_outdated? target_swf, src_swf
79
- end
80
-
81
- first_time do
82
- desc 'create swf package task'
83
- Project.local_task('package_swf')
84
- end
85
-
86
- before_define do |project|
87
- SwfTask.define_task('package_swf').tap do |package_swf|
88
- package_swf
89
- end
90
- end
91
-
92
- end
93
-
94
- class AirTask < Rake::FileTask
95
-
96
- include Extension
97
- include Buildr::AS3::Compiler::CompilerUtils
98
-
99
- attr_writer :target_air, :src_swf, :flexsdk
100
- attr_reader :target_air, :src_swf, :storetype, :keystore, :storepass, :appdescriptor, :libs, :flexsdk
101
-
102
- def initialize(*args) #:nodoc:
103
- super
104
- enhance do
105
- fail "File not found: #{src_swf}" unless File.exists? src_swf
106
- cmd_args = []
107
- cmd_args << "-jar" << flexsdk.adt_jar
108
- cmd_args << "-package"
109
- cmd_args << "-storetype" << storetype
110
- cmd_args << "-keystore" << keystore
111
- cmd_args << "-storepass" << storepass
112
- cmd_args << target_air
113
- cmd_args << appdescriptor
114
- cmd_args << "-C" << File.dirname(src_swf) << File.basename(src_swf)
115
- # puts libs unless libs.nil?
116
- libs.each do |key, value|
117
- puts "key,value", key, value
118
- cmd_args << "-C" << key << value
119
- end unless libs.nil?
120
-
121
- puts cmd_args.join " "
122
-
123
- unless Buildr.application.options.dryrun
124
- Java::Commands.java cmd_args
125
- end
126
- end
127
- end
128
-
129
- def needed?
130
- is_output_outdated? target_air, src_swf
131
- end
132
-
133
- first_time do
134
- desc 'create air package task'
135
- Project.local_task('package_air')
136
- end
137
-
138
- before_define do |project|
139
- AirTask.define_task('package_air').tap do |package_air|
140
- package_air
141
- end
142
- end
143
-
144
- def sign(*args)
145
- args.each do |arg|
146
- @storetype = arg[:storetype] if arg.has_key? :storetype
147
- @keystore = arg[:keystore] if arg.has_key? :keystore
148
- @storepass = arg[:storepass] if arg.has_key? :storepass
149
- @appdescriptor = arg[:appdescriptor] if arg.has_key? :appdescriptor
150
- end
151
- self
152
- end
153
-
154
- def with(*args)
155
- @libs ||= Hash.new
156
- args.each do |arg|
157
- case arg
158
- when Hash
159
- arg.each do |key, value|
160
- @libs[key] = value
161
- end
162
- end
163
- end
164
- self
165
- end
166
-
167
- end
168
-
169
- def package_swc(&block)
170
- task("package_swc").enhance &block
171
- end
172
-
173
- def package_swf(&block)
174
- task("package_swf").enhance &block
175
- end
176
-
177
- def package_air(&block)
178
- task("package_air").enhance &block
179
- end
180
-
181
- protected
182
-
183
- def package_as_swc(file_name)
184
- fail("Package types don't match! :swc vs. :#{compile.packaging.to_s}") unless compile.packaging == :swc
185
- SwcTask.define_task(file_name).tap do |swc|
186
- swc.src_swc = Buildr::AS3::Compiler::CompilerUtils::get_output(project, compile.target, :swc, compile.options)
187
- swc.target_swc = file_name
188
- end
189
- end
190
-
191
- def package_as_swf(file_name)
192
- fail("Package types don't match! :swf vs. :#{compile.packaging.to_s}") unless compile.packaging == :swf
193
- SwfTask.define_task(file_name).tap do |swf|
194
- swf.src_swf = Buildr::AS3::Compiler::CompilerUtils::get_output(project, compile.target, :swf, compile.options)
195
- swf.target_swf = file_name
196
- end
197
- end
198
-
199
- def package_as_air(file_name)
200
- fail("Package types don't match! :swf vs. :#{compile.packaging.to_s}") unless compile.packaging == :swf
201
- AirTask.define_task(file_name).tap do |swf|
202
- swf.src_swf = Buildr::AS3::Compiler::CompilerUtils::get_output(project, compile.target, :swf, compile.options)
203
- swf.target_air = file_name
204
- swf.flexsdk = compile.options[:flexsdk]
205
- end
206
- end
207
-
208
- end
209
- end
210
- end
211
27
  class Buildr::Project
212
28
  include Buildr::AS3::Packaging
213
29
  end
@@ -0,0 +1,120 @@
1
+ #
2
+ # Copyright (C) 2011 by Dominic Graefen / http://devboy.org
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ # of this software and associated documentation files (the "Software"), to deal
6
+ # in the Software without restriction, including without limitation the rights
7
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ # copies of the Software, and to permit persons to whom the Software is
9
+ # furnished to do so, subject to the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be included in
12
+ # all copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
+ # THE SOFTWARE.
21
+ #
22
+
23
+ require 'buildr'
24
+
25
+ module Buildr
26
+ module AS3
27
+ module Packaging
28
+
29
+ class AirTask < Rake::FileTask
30
+
31
+ include Extension
32
+
33
+ attr_writer :target_air, :src_swf, :flexsdk
34
+ attr_reader :target_air, :src_swf, :storetype, :keystore, :storepass, :appdescriptor, :libs, :flexsdk
35
+
36
+ def initialize(*args) #:nodoc:
37
+ super
38
+ enhance do
39
+ fail "File not found: #{src_swf}" unless File.exists? src_swf
40
+ cmd_args = []
41
+ cmd_args << "-jar" << flexsdk.adt_jar
42
+ cmd_args << "-package"
43
+ cmd_args << "-storetype" << storetype
44
+ cmd_args << "-keystore" << keystore
45
+ cmd_args << "-storepass" << storepass
46
+ cmd_args << target_air
47
+ cmd_args << appdescriptor
48
+ cmd_args << "-C" << File.dirname(src_swf) << File.basename(src_swf)
49
+ libs.each do |key, value|
50
+ puts "key,value", key, value
51
+ cmd_args << "-C" << key << value
52
+ end unless libs.nil?
53
+
54
+ puts cmd_args.join " "
55
+
56
+ unless Buildr.application.options.dryrun
57
+ Java::Commands.java cmd_args
58
+ end
59
+ end
60
+ end
61
+
62
+ def needed?
63
+ return true unless File.exists?(target_air)
64
+ File.stat(src_swf).mtime > File.stat(target_air).mtime
65
+ end
66
+
67
+ first_time do
68
+ desc 'create air package task'
69
+ Project.local_task('package_air')
70
+ end
71
+
72
+ before_define do |project|
73
+ AirTask.define_task('package_air').tap do |package_air|
74
+ package_air
75
+ end
76
+ end
77
+
78
+ def sign(*args)
79
+ args.each do |arg|
80
+ @storetype = arg[:storetype] if arg.has_key? :storetype
81
+ @keystore = arg[:keystore] if arg.has_key? :keystore
82
+ @storepass = arg[:storepass] if arg.has_key? :storepass
83
+ @appdescriptor = arg[:appdescriptor] if arg.has_key? :appdescriptor
84
+ end
85
+ self
86
+ end
87
+
88
+ def with(*args)
89
+ @libs ||= Hash.new
90
+ args.each do |arg|
91
+ case arg
92
+ when Hash
93
+ arg.each do |key, value|
94
+ @libs[key] = value
95
+ end
96
+ end
97
+ end
98
+ self
99
+ end
100
+
101
+ end
102
+
103
+ def package_air(&block)
104
+ task("package_air").enhance &block
105
+ end
106
+
107
+ protected
108
+
109
+ def package_as_air(file_name)
110
+ fail("Package types don't match! :swf vs. :#{compile.packaging.to_s}") unless compile.packaging == :swf
111
+ AirTask.define_task(file_name).tap do |swf|
112
+ swf.src_swf = get_as3_output(compile.target,compile.options)
113
+ swf.target_air = file_name
114
+ swf.flexsdk = compile.options[:flexsdk]
115
+ end
116
+ end
117
+
118
+ end
119
+ end
120
+ end
@@ -0,0 +1,114 @@
1
+ #
2
+ # Copyright (C) 2011 by Dominic Graefen / http://devboy.org
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ # of this software and associated documentation files (the "Software"), to deal
6
+ # in the Software without restriction, including without limitation the rights
7
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ # copies of the Software, and to permit persons to whom the Software is
9
+ # furnished to do so, subject to the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be included in
12
+ # all copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
+ # THE SOFTWARE.
21
+ #
22
+
23
+ require 'buildr'
24
+
25
+ module Buildr
26
+ module AS3
27
+ module Packaging
28
+
29
+ class AiriTask < Rake::FileTask
30
+
31
+ include Extension
32
+
33
+ attr_writer :target_air, :src_swf, :flexsdk
34
+ attr_reader :target_air, :src_swf, :storetype, :keystore, :storepass, :appdescriptor, :libs, :flexsdk
35
+
36
+ def initialize(*args) #:nodoc:
37
+ super
38
+ enhance do
39
+ fail "File not found: #{src_swf}" unless File.exists? src_swf
40
+ cmd_args = []
41
+ cmd_args << "-jar" << flexsdk.adt_jar
42
+ cmd_args << "-prepare"
43
+ cmd_args << target_air
44
+ cmd_args << appdescriptor
45
+ cmd_args << "-C" << File.dirname(src_swf) << File.basename(src_swf)
46
+ libs.each do |key, value|
47
+ puts "key,value", key, value
48
+ cmd_args << "-C" << key << value
49
+ end unless libs.nil?
50
+
51
+ puts cmd_args.join " "
52
+
53
+ unless Buildr.application.options.dryrun
54
+ Java::Commands.java cmd_args
55
+ end
56
+ end
57
+ end
58
+
59
+ def needed?
60
+ return true unless File.exists?(target_air)
61
+ File.stat(src_swf).mtime > File.stat(target_air).mtime
62
+ end
63
+
64
+ first_time do
65
+ desc 'create airi package task'
66
+ Project.local_task('package_airi')
67
+ end
68
+
69
+ before_define do |project|
70
+ AiriTask.define_task('package_airi').tap do |package_air|
71
+ package_air
72
+ end
73
+ end
74
+
75
+ def sign(*args)
76
+ args.each do |arg|
77
+ @appdescriptor = arg[:appdescriptor] if arg.has_key? :appdescriptor
78
+ end
79
+ self
80
+ end
81
+
82
+ def with(*args)
83
+ @libs ||= Hash.new
84
+ args.each do |arg|
85
+ case arg
86
+ when Hash
87
+ arg.each do |key, value|
88
+ @libs[key] = value
89
+ end
90
+ end
91
+ end
92
+ self
93
+ end
94
+
95
+ end
96
+
97
+ def package_airi(&block)
98
+ task("package_airi").enhance &block
99
+ end
100
+
101
+ protected
102
+
103
+ def package_as_airi(file_name)
104
+ fail("Package types don't match! :swf vs. :#{compile.packaging.to_s}") unless compile.packaging == :swf
105
+ AiriTask.define_task(file_name).tap do |swf|
106
+ swf.src_swf = get_as3_output(compile.target,compile.options)
107
+ swf.target_air = file_name
108
+ swf.flexsdk = compile.options[:flexsdk]
109
+ end
110
+ end
111
+
112
+ end
113
+ end
114
+ end