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.
- data/README.rdoc +14 -0
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/bin/buildr-as3 +27 -0
- data/buildr-as3.gemspec +29 -10
- data/lib/buildr/as3.rb +7 -8
- data/lib/buildr/as3/compiler.rb +9 -260
- data/lib/buildr/as3/compiler/aircompc.rb +52 -0
- data/lib/buildr/as3/compiler/airmxmlc.rb +54 -0
- data/lib/buildr/as3/compiler/base.rb +78 -0
- data/lib/buildr/as3/compiler/compc.rb +64 -0
- data/lib/buildr/as3/compiler/mxmlc.rb +73 -0
- data/lib/buildr/as3/doc.rb +5 -41
- data/lib/buildr/as3/doc/asdoc.rb +75 -0
- data/lib/buildr/as3/ide.rb +23 -0
- data/lib/buildr/as3/ide/fdt4.rb +1 -1
- data/lib/buildr/as3/packaging.rb +4 -188
- data/lib/buildr/as3/packaging/air.rb +120 -0
- data/lib/buildr/as3/packaging/airi.rb +114 -0
- data/lib/buildr/as3/packaging/swc.rb +79 -0
- data/lib/buildr/as3/packaging/swf.rb +79 -0
- data/lib/buildr/as3/project.rb +34 -0
- data/lib/buildr/as3/test.rb +29 -0
- data/lib/buildr/as3/test/base.rb +47 -0
- data/lib/buildr/as3/test/flexunit4.rb +127 -0
- data/lib/buildr/as3/toolkits.rb +28 -0
- data/lib/buildr/as3/{alchemy.rb → toolkits/alchemy.rb} +13 -54
- data/lib/buildr/as3/{apparat.rb → toolkits/apparat.rb} +27 -54
- data/lib/buildr/as3/toolkits/base.rb +84 -0
- data/lib/buildr/as3/{flexsdk.rb → toolkits/flexsdk.rb} +18 -46
- metadata +32 -15
- data/lib/buildr/as3/tests.rb +0 -54
@@ -0,0 +1,79 @@
|
|
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
|
+
require "fileutils"
|
25
|
+
|
26
|
+
module Buildr
|
27
|
+
module AS3
|
28
|
+
module Packaging
|
29
|
+
|
30
|
+
class SwcTask < Rake::FileTask
|
31
|
+
|
32
|
+
include Extension
|
33
|
+
|
34
|
+
attr_writer :target_swc, :src_swc
|
35
|
+
attr_reader :target_swc, :src_swc
|
36
|
+
|
37
|
+
def initialize(*args) #:nodoc:
|
38
|
+
super
|
39
|
+
enhance do
|
40
|
+
fail "File not found: #{src_swc}" unless File.exists? src_swc
|
41
|
+
FileUtils.cp(src_swc, target_swc)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def needed?
|
46
|
+
return true unless File.exists?(target_swc)
|
47
|
+
File.stat(src_swc).mtime > File.stat(target_swc).mtime
|
48
|
+
end
|
49
|
+
|
50
|
+
first_time do
|
51
|
+
desc 'create swc package task'
|
52
|
+
Project.local_task('package_swc')
|
53
|
+
end
|
54
|
+
|
55
|
+
before_define do |project|
|
56
|
+
SwcTask.define_task('package_swc').tap do |package_swc|
|
57
|
+
package_swc
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
def package_swc(&block)
|
64
|
+
task("package_swc").enhance &block
|
65
|
+
end
|
66
|
+
|
67
|
+
protected
|
68
|
+
|
69
|
+
def package_as_swc(file_name)
|
70
|
+
fail("Package types don't match! :swc vs. :#{compile.packaging.to_s}") unless compile.packaging == :swc
|
71
|
+
SwcTask.define_task(file_name).tap do |swc|
|
72
|
+
swc.src_swc = get_as3_output(compile.target,compile.options)
|
73
|
+
swc.target_swc = file_name
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,79 @@
|
|
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
|
+
require 'fileutils'
|
25
|
+
|
26
|
+
module Buildr
|
27
|
+
module AS3
|
28
|
+
module Packaging
|
29
|
+
|
30
|
+
class SwfTask < Rake::FileTask
|
31
|
+
|
32
|
+
include Extension
|
33
|
+
|
34
|
+
attr_writer :target_swf, :src_swf
|
35
|
+
attr_reader :target_swf, :src_swf
|
36
|
+
|
37
|
+
def initialize(*args) #:nodoc:
|
38
|
+
super
|
39
|
+
enhance do
|
40
|
+
fail "File not found: #{src_swf}" unless File.exists? src_swf
|
41
|
+
FileUtils.cp(src_swf, target_swf)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def needed?
|
46
|
+
return true unless File.exists?(target_swf)
|
47
|
+
File.stat(src_swf).mtime > File.stat(target_swf).mtime
|
48
|
+
end
|
49
|
+
|
50
|
+
first_time do
|
51
|
+
desc 'create swf package task'
|
52
|
+
Project.local_task('package_swf')
|
53
|
+
end
|
54
|
+
|
55
|
+
before_define do |project|
|
56
|
+
SwfTask.define_task('package_swf').tap do |package_swf|
|
57
|
+
package_swf
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
def package_swf(&block)
|
64
|
+
task("package_swf").enhance &block
|
65
|
+
end
|
66
|
+
|
67
|
+
protected
|
68
|
+
|
69
|
+
def package_as_swf(file_name)
|
70
|
+
fail("Package types don't match! :swf vs. :#{compile.packaging.to_s}") unless compile.packaging == :swf
|
71
|
+
SwfTask.define_task(file_name).tap do |swf|
|
72
|
+
swf.src_swf = get_as3_output(compile.target,compile.options)
|
73
|
+
swf.target_swf = file_name
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,34 @@
|
|
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
|
+
class Buildr::Project
|
26
|
+
|
27
|
+
def get_as3_output( target, options )
|
28
|
+
# return compile.options[:output] if compile.options.has_key? :output
|
29
|
+
return "#{target}/#{File.basename(options[:main].to_s, File.extname(options[:main].to_s))}.swf" if compile.packaging == :swf
|
30
|
+
return "#{target}/#{name.gsub(":", "-")}.swc" if compile.packaging == :swc
|
31
|
+
fail("Could not guess output file for #{name}")
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
@@ -0,0 +1,29 @@
|
|
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
|
+
require File.dirname(__FILE__) + '/test/base'
|
26
|
+
require File.dirname(__FILE__) + '/test/flexunit4'
|
27
|
+
|
28
|
+
Buildr::TestFramework << Buildr::AS3::Test::FlexUnit4
|
29
|
+
|
@@ -0,0 +1,47 @@
|
|
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 Test
|
28
|
+
class TestFramework::AS3 < TestFramework::Base
|
29
|
+
|
30
|
+
class << self
|
31
|
+
|
32
|
+
def applies_to?(project) #:nodoc:
|
33
|
+
project.test.compile.language == :actionscript
|
34
|
+
end
|
35
|
+
|
36
|
+
def dependencies
|
37
|
+
unless @dependencies
|
38
|
+
super
|
39
|
+
end
|
40
|
+
@dependencies
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,127 @@
|
|
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
|
+
require 'fileutils'
|
25
|
+
require "rexml/document"
|
26
|
+
|
27
|
+
module Buildr
|
28
|
+
module AS3
|
29
|
+
module Test
|
30
|
+
# FlexUnit4 test framework.
|
31
|
+
#
|
32
|
+
# Support the following options:
|
33
|
+
# * :player -- ["air","flash"] defines the player to run the tests, when not set it chooses based on the projects compiler.
|
34
|
+
# * :haltonFailure -- [Boolean] stop unit-testing on error
|
35
|
+
# * :verbose -- [Boolean] print additional info
|
36
|
+
# * :localTrusted -- [Boolean] some sandbox thing
|
37
|
+
# * :htmlreport -- [Boolean] set to true if you want to create a JUnit HTML report
|
38
|
+
class FlexUnit4 < TestFramework::AS3
|
39
|
+
|
40
|
+
VERSION = '4.1.0_RC2-4'
|
41
|
+
FLEX_SDK_VERSION = '4.1.0.16076'
|
42
|
+
|
43
|
+
class << self
|
44
|
+
def flexunit_taskdef #:nodoc:
|
45
|
+
"com.adobe.flexunit:flexunitUnitTasks:jar:#{VERSION}"
|
46
|
+
end
|
47
|
+
|
48
|
+
def swc_dependencies
|
49
|
+
[
|
50
|
+
"com.adobe.flexunit:flexunit:swc:as3_#{FLEX_SDK_VERSION}:#{VERSION}",
|
51
|
+
"com.adobe.flexunit:flexunit:swc:flex_#{FLEX_SDK_VERSION}:#{VERSION}",
|
52
|
+
"com.adobe.flexunit:flexunit-aircilistener:swc:#{FLEX_SDK_VERSION}:#{VERSION}",
|
53
|
+
"com.adobe.flexunit:flexunit-cilistener:swc:#{FLEX_SDK_VERSION}:#{VERSION}",
|
54
|
+
"com.adobe.flexunit:flexunit-flexcoverlistener:swc:#{FLEX_SDK_VERSION}:#{VERSION}",
|
55
|
+
"com.adobe.flexunit:flexunit-uilistener:swc:#{FLEX_SDK_VERSION}:#{VERSION}"
|
56
|
+
]
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def tests(dependencies) #:nodoc:
|
61
|
+
candidates = []
|
62
|
+
task.project.test.compile.sources.each do |source|
|
63
|
+
files = Dir["#{source}/**/*Test.as"] + Dir["#{source}/**/*Test.mxml"]
|
64
|
+
files.each { |item| candidates << File.dirname(item).gsub!(source+"/", "").gsub!("/", ".")+"."+File.basename(item, '.*') }
|
65
|
+
end
|
66
|
+
candidates
|
67
|
+
end
|
68
|
+
|
69
|
+
def run(tests, dependencies) #:nodoc:
|
70
|
+
|
71
|
+
report_dir = task.project._(:reports, FlexUnit4.to_sym)
|
72
|
+
FileUtils.mkdir_p report_dir
|
73
|
+
|
74
|
+
project_dir = Dir.getwd
|
75
|
+
Dir.chdir report_dir
|
76
|
+
|
77
|
+
taskdef = Buildr.artifact(FlexUnit4.flexunit_taskdef)
|
78
|
+
taskdef.invoke
|
79
|
+
|
80
|
+
player = "air" if [:airmxmlc, :airompc].include?(task.project.compile.compiler)
|
81
|
+
player ||= "flash"
|
82
|
+
player || options[:player]
|
83
|
+
|
84
|
+
Buildr.ant("flexunit4test") do |ant|
|
85
|
+
|
86
|
+
ant.property :name => "FLEX_HOME",
|
87
|
+
:location=>task.project.compile.options[:flexsdk].home
|
88
|
+
|
89
|
+
ant.taskdef :resource => "flexUnitTasks.tasks",
|
90
|
+
:classpath => taskdef.to_s
|
91
|
+
|
92
|
+
ant.flexunit :player => player,
|
93
|
+
:haltonFailure => false || options[:haltonFailure],
|
94
|
+
:verbose => true || options[:verbose],
|
95
|
+
:localTrusted => true || options[:localTrusted],
|
96
|
+
:swf => task.project.get_as3_output(task.project.test.compile.target, task.project.test.compile.options)
|
97
|
+
|
98
|
+
ant.taskdef :name=>'junitreport',
|
99
|
+
:classname=>'org.apache.tools.ant.taskdefs.optional.junit.XMLResultAggregator',
|
100
|
+
:classpath=>Buildr.artifacts(JUnit.ant_taskdef).each(&:invoke).map(&:to_s).join(File::PATH_SEPARATOR)
|
101
|
+
unless options[:htmlreport] == false
|
102
|
+
ant.junitreport :todir => report_dir do
|
103
|
+
ant.fileset :dir => report_dir do
|
104
|
+
ant.include :name => "TEST-*.xml"
|
105
|
+
end
|
106
|
+
ant.report :format => "frames", :todir => report_dir + "/html"
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
|
111
|
+
Dir[report_dir+"/TEST-*.xml"].each do |xml_report|
|
112
|
+
doc = REXML::Document.new File.new(xml_report)
|
113
|
+
name = doc.elements["testsuite"].attributes["name"]
|
114
|
+
failures = Integer(doc.elements["testsuite"].attributes["failures"])
|
115
|
+
errors = Integer(doc.elements["testsuite"].attributes["errors"])
|
116
|
+
tests -= [name] unless failures + errors == 0
|
117
|
+
end
|
118
|
+
|
119
|
+
end
|
120
|
+
Dir.chdir project_dir
|
121
|
+
tests
|
122
|
+
end
|
123
|
+
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
@@ -0,0 +1,28 @@
|
|
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__)}/toolkits/base"
|
24
|
+
require "#{File.dirname(__FILE__)}/toolkits/flexsdk"
|
25
|
+
require "#{File.dirname(__FILE__)}/toolkits/apparat"
|
26
|
+
require "#{File.dirname(__FILE__)}/toolkits/alchemy"
|
27
|
+
|
28
|
+
include Buildr::AS3::Toolkits
|
@@ -19,10 +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
|
+
|
22
23
|
module Buildr
|
23
24
|
module AS3
|
24
|
-
module
|
25
|
-
class AlchemyToolkit
|
25
|
+
module Toolkits
|
26
|
+
class AlchemyToolkit < Buildr::AS3::Toolkits::ZipToolkiteBase
|
26
27
|
|
27
28
|
attr_reader :home, :achacks, :gcc, :flex_sdk, :alchemy_setup, :bin, :swfbridge
|
28
29
|
|
@@ -31,60 +32,20 @@ module Buildr
|
|
31
32
|
@system = Buildr::Util.win_os? ? "win" : "unix"
|
32
33
|
@spec = "com.adobe.alchemy:toolkit:zip:#{@system}:#{@version}"
|
33
34
|
@flex_sdk = flex_sdk
|
34
|
-
@
|
35
|
-
@
|
36
|
-
generate_paths @
|
35
|
+
@zip = Buildr.artifact(@spec)
|
36
|
+
@zip_destination = File.join(File.dirname(@zip.to_s), "alchemy-#{@system}-#{@version}", get_alchemy_toolkit_subfolder(@system) )
|
37
|
+
generate_paths @zip_destination
|
37
38
|
self
|
38
39
|
end
|
39
40
|
|
40
41
|
def invoke
|
41
|
-
|
42
|
-
|
43
|
-
if Buildr::Util.win_os?
|
44
|
-
unless File.exists? @alchemy_zip.to_s
|
45
|
-
FileUtils.mkdir_p File.dirname(@alchemy_zip.to_s) unless File.directory? File.dirname(@alchemy_zip.to_s)
|
46
|
-
File.open @alchemy_zip.to_s, 'w' do |file|
|
47
|
-
file.binmode()
|
48
|
-
URI.read(@url, {:progress=>true}) { |chunk| file.write chunk }
|
49
|
-
end
|
50
|
-
end
|
51
|
-
else
|
52
|
-
Buildr.artifact(@spec).from(Buildr.download(@url)).invoke unless File.exists? @alchemy_zip.to_s
|
53
|
-
end
|
54
|
-
|
55
|
-
unless File.exists? @alchemy_dir
|
56
|
-
puts "Unzipping Alchemy, this might take a while."
|
57
|
-
unzip_dir = File.dirname @alchemy_dir
|
58
|
-
if Buildr::Util.win_os?
|
59
|
-
puts "Please make sure unzip is installed and in your PATH variable!"
|
60
|
-
unzip @alchemy_zip, unzip_dir
|
61
|
-
else
|
62
|
-
begin
|
63
|
-
Buildr.unzip(unzip_dir.to_s=>@alchemy_zip.to_s).target.invoke
|
64
|
-
rescue TypeError
|
65
|
-
puts "RubyZip extract failed, trying system unzip now."
|
66
|
-
unzip @alchemy_zip, unzip_dir
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
42
|
+
super
|
70
43
|
setup unless File.exists? @alchemy_setup
|
71
44
|
self
|
72
45
|
end
|
73
46
|
|
74
|
-
def from(url)
|
75
|
-
@url = url
|
76
|
-
self
|
77
|
-
end
|
78
|
-
|
79
47
|
protected
|
80
48
|
|
81
|
-
def unzip(zip, destination)
|
82
|
-
project_dir = Dir.getwd
|
83
|
-
Dir.chdir File.dirname(zip.to_s)
|
84
|
-
system("unzip #{File.basename(zip.to_s).to_s} -d #{File.basename(destination).to_s}")
|
85
|
-
Dir.chdir project_dir
|
86
|
-
end
|
87
|
-
|
88
49
|
def setup
|
89
50
|
project_dir = Dir.getwd
|
90
51
|
ENV["PATH"] = "#{flex_sdk.bin}#{File::PATH_SEPARATOR}#{ENV["PATH"]}"
|
@@ -136,19 +97,17 @@ module Buildr
|
|
136
97
|
|
137
98
|
attr_reader :project
|
138
99
|
|
139
|
-
def
|
140
|
-
|
141
|
-
|
100
|
+
def needed?(sources, target, dependencies)
|
101
|
+
return true unless File.exist?(@project.get_as3_output)
|
102
|
+
Dir.glob(FileList[sources,dependencies].to_a.collect{ |file| file += "**/*" } ).
|
103
|
+
map{|file| File.stat(file).mtime}.max > File.stat(@project.get_as3_output).mtime
|
142
104
|
end
|
143
105
|
|
144
|
-
include Buildr::AS3::Compiler::CompilerUtils
|
145
|
-
|
146
106
|
def compile(sources, target, dependencies)
|
147
107
|
alchemy_tk = options[:alchemy].invoke
|
148
108
|
flex_sdk = alchemy_tk.flex_sdk
|
149
|
-
output =
|
109
|
+
output = @project.get_as3_output
|
150
110
|
|
151
|
-
# gcc stringecho.c -O3 -Wall -swc -o stringecho.swc
|
152
111
|
cmd_args = []
|
153
112
|
cmd_args << "gcc"
|
154
113
|
cmd_args << File.basename(options[:main])
|
@@ -183,4 +142,4 @@ module Buildr
|
|
183
142
|
end
|
184
143
|
end
|
185
144
|
end
|
186
|
-
Buildr::Compiler.compilers << Buildr::AS3::
|
145
|
+
Buildr::Compiler.compilers << Buildr::AS3::Toolkits::Compiler::AlcGcc
|