buildr-as3 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/buildr-as3.gemspec +1 -1
- data/lib/buildr/as3/alchemy.rb +77 -75
- data/lib/buildr/as3/apparat.rb +63 -59
- data/lib/buildr/as3/compiler.rb +4 -4
- data/lib/buildr/as3/flexsdk.rb +33 -31
- data/lib/buildr/as3.rb +4 -1
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.9
|
data/buildr-as3.gemspec
CHANGED
data/lib/buildr/as3/alchemy.rb
CHANGED
@@ -21,98 +21,100 @@
|
|
21
21
|
#
|
22
22
|
module Buildr
|
23
23
|
module AS3
|
24
|
-
|
25
|
-
|
26
|
-
attr_reader :home, :achacks, :gcc, :flex_sdk, :alchemy_setup, :bin
|
27
|
-
|
28
|
-
def initialize( flex_sdk )
|
24
|
+
module Alchemy
|
25
|
+
class AlchemyToolkit
|
29
26
|
|
30
|
-
|
27
|
+
attr_reader :home, :achacks, :gcc, :flex_sdk, :alchemy_setup, :bin
|
31
28
|
|
32
|
-
|
33
|
-
toolkit_url = "http://download.macromedia.com/pub/labs/alchemy/alchemy_sdk_darwin_p1_121008.zip"
|
34
|
-
|
35
|
-
toolkit_zip = Buildr::artifact("com.adobe.alchemy:toolkit:zip:#{toolkit_version}").from(Buildr::download(toolkit_url))
|
36
|
-
toolkit_zip.invoke unless File.exists? toolkit_zip.to_s
|
29
|
+
def initialize( flex_sdk )
|
37
30
|
|
38
|
-
|
31
|
+
@flex_sdk = flex_sdk
|
39
32
|
|
40
|
-
|
41
|
-
|
42
|
-
Buildr::unzip("#{toolkit_dir}"=>toolkit_zip.to_s).target.invoke
|
43
|
-
end
|
33
|
+
toolkit_version = "1.0.0"
|
34
|
+
toolkit_url = "http://download.macromedia.com/pub/labs/alchemy/alchemy_sdk_darwin_p1_121008.zip"
|
44
35
|
|
45
|
-
|
46
|
-
|
47
|
-
@gcc = "#{@achacks}/gcc"
|
48
|
-
@alchemy_setup = "#{@home}/alchemy-setup"
|
49
|
-
@config = "#{@home}/config"
|
50
|
-
@bin = "#{@home}/bin"
|
51
|
-
|
52
|
-
# Run config script if alchemy-setup doesn't exist
|
53
|
-
unless File.exists? @alchemy_setup
|
54
|
-
project_dir = Dir.getwd
|
55
|
-
ENV["PATH"] = "#{ENV["PATH"]}:#{flex_sdk.bin}"
|
56
|
-
Dir.chdir @home
|
57
|
-
system("sh ./config")
|
58
|
-
Dir.chdir project_dir
|
59
|
-
end
|
36
|
+
toolkit_zip = Buildr::artifact("com.adobe.alchemy:toolkit:zip:#{toolkit_version}").from(Buildr::download(toolkit_url))
|
37
|
+
toolkit_zip.invoke unless File.exists? toolkit_zip.to_s
|
60
38
|
|
61
|
-
|
62
|
-
end
|
39
|
+
toolkit_dir = File.join(File.dirname(toolkit_zip.to_s), "toolkit-#{toolkit_version}")
|
63
40
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
:target => "bin", :target_ext => "swc",
|
69
|
-
:packaging => :swc
|
41
|
+
unless File.exists? toolkit_dir
|
42
|
+
puts "Unzipping Alchemy Toolkit, this may take a while."
|
43
|
+
Buildr::unzip("#{toolkit_dir}"=>toolkit_zip.to_s).target.invoke
|
44
|
+
end
|
70
45
|
|
71
|
-
|
46
|
+
@home = "#{toolkit_dir}/alchemy-darwin-v0.5a"
|
47
|
+
@achacks = "#{@home}/achacks"
|
48
|
+
@gcc = "#{@achacks}/gcc"
|
49
|
+
@alchemy_setup = "#{@home}/alchemy-setup"
|
50
|
+
@config = "#{@home}/config"
|
51
|
+
@bin = "#{@home}/bin"
|
72
52
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
53
|
+
# Run config script if alchemy-setup doesn't exist
|
54
|
+
unless File.exists? @alchemy_setup
|
55
|
+
project_dir = Dir.getwd
|
56
|
+
ENV["PATH"] = "#{ENV["PATH"]}:#{flex_sdk.bin}"
|
57
|
+
Dir.chdir @home
|
58
|
+
system("sh ./config")
|
59
|
+
Dir.chdir project_dir
|
60
|
+
end
|
77
61
|
|
78
|
-
|
62
|
+
end
|
63
|
+
end
|
79
64
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
65
|
+
module Compiler
|
66
|
+
class AlcGcc < Buildr::Compiler::Base
|
67
|
+
specify :language => :c,
|
68
|
+
:sources => :c, :source_ext => :c,
|
69
|
+
:target => "bin", :target_ext => "swc",
|
70
|
+
:packaging => :swc
|
84
71
|
|
85
|
-
|
86
|
-
cmd_args = []
|
87
|
-
cmd_args << "gcc"
|
88
|
-
cmd_args << File.basename(options[:main])
|
89
|
-
cmd_args << "-O3 -Wall -swc"
|
90
|
-
cmd_args << "-o #{File.basename output}"
|
72
|
+
attr_reader :project
|
91
73
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
cmd_args << "-#{key}=#{value}"
|
74
|
+
def initialize(project, options)
|
75
|
+
super
|
76
|
+
@project = project
|
96
77
|
end
|
97
78
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
79
|
+
include Buildr::AS3::Compiler::CompilerUtils
|
80
|
+
|
81
|
+
def compile(sources, target, dependencies)
|
82
|
+
alchemy_tk = options[:alchemy]
|
83
|
+
flex_sdk = alchemy_tk.flex_sdk
|
84
|
+
output = Buildr::AS3::Compiler::CompilerUtils::get_output(project,target,:swc,options)
|
85
|
+
|
86
|
+
# gcc stringecho.c -O3 -Wall -swc -o stringecho.swc
|
87
|
+
cmd_args = []
|
88
|
+
cmd_args << "gcc"
|
89
|
+
cmd_args << File.basename(options[:main])
|
90
|
+
cmd_args << "-O3 -Wall -swc"
|
91
|
+
cmd_args << "-o #{File.basename output}"
|
92
|
+
|
93
|
+
reserved = [:flexsdk,:main,:alchemy]
|
94
|
+
options.to_hash.reject { |key, value| reserved.include?(key) }.
|
95
|
+
each do |key, value|
|
96
|
+
cmd_args << "-#{key}=#{value}"
|
97
|
+
end
|
98
|
+
|
99
|
+
unless Buildr.application.options.dryrun
|
100
|
+
ENV["ALCHEMY_HOME"]= alchemy_tk.home
|
101
|
+
ENV["ALCHEMY_VER"] = "0.4a"
|
102
|
+
ENV["PATH"] = "#{alchemy_tk.bin}:#{ENV["PATH"]}"
|
103
|
+
ENV["ASC"]="#{alchemy_tk.home}/bin/asc.jar"
|
104
|
+
ENV["SWFBRIDGE"]="#{alchemy_tk.home}/bin/swfbridge"
|
105
|
+
ENV["PATH"] = "#{alchemy_tk.achacks}:#{ENV["PATH"]}"
|
106
|
+
ENV["PATH"] = "#{ENV["PATH"]}:#{flex_sdk.bin}"
|
107
|
+
project_dir = Dir.getwd
|
108
|
+
Dir.chdir File.dirname options[:main]
|
109
|
+
system(cmd_args.join(" "))
|
110
|
+
File.copy( File.basename(output), output)
|
111
|
+
File.delete File.basename(output)
|
112
|
+
Dir.chdir project_dir
|
113
|
+
end
|
114
|
+
end
|
112
115
|
end
|
113
116
|
end
|
114
117
|
end
|
115
|
-
end
|
116
118
|
end
|
117
119
|
end
|
118
|
-
Buildr::Compiler.compilers << Buildr::AS3::Compiler::AlcGcc
|
120
|
+
Buildr::Compiler.compilers << Buildr::AS3::Alchemy::Compiler::AlcGcc
|
data/lib/buildr/as3/apparat.rb
CHANGED
@@ -21,78 +21,82 @@
|
|
21
21
|
#
|
22
22
|
module Buildr
|
23
23
|
module AS3
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
24
|
+
module Apparat
|
25
|
+
class ApparatToolkit
|
26
|
+
attr_reader :home, :asmifier, :concrete, :coverage, :dump,
|
27
|
+
:jitb, :reducer, :stripper, :tdsi, :asm_swc,
|
28
|
+
:ersatz_swc, :lzma_decoder_swc
|
28
29
|
|
29
|
-
|
30
|
+
def initialize(apparat_version,apparat_url)
|
30
31
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
32
|
+
apparat_zip = Buildr::artifact("com.googlecode:apparat-bin:zip:#{apparat_version}").from(Buildr::download(apparat_url))
|
33
|
+
apparat_zip.invoke unless File.exists? apparat_zip.to_s
|
34
|
+
apparat_dir = File.join(File.dirname(apparat_zip.to_s), "apparat-bin-#{apparat_version}")
|
35
|
+
unless File.exists? apparat_dir
|
36
|
+
puts "Unzipping Apparat, this may take a while."
|
37
|
+
Buildr::unzip(apparat_dir=>apparat_zip.to_s).target.invoke
|
38
|
+
end
|
38
39
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
40
|
+
@home = apparat_dir
|
41
|
+
bat_ext = Buildr::Util.win_os? ? ".bat" : ""
|
42
|
+
@apparat = "#{@home}/apparat#{bat_ext}"
|
43
|
+
@asmifier = "#{@home}/asmifier#{bat_ext}"
|
44
|
+
@concrete = "#{@home}/concrete#{bat_ext}"
|
45
|
+
@coverage = "#{@home}/coverage#{bat_ext}"
|
46
|
+
@dump = "#{@home}/dump#{bat_ext}"
|
47
|
+
@jitb = "#{@home}/jitb#{bat_ext}"
|
48
|
+
@reducer = "#{@home}/reducer#{bat_ext}"
|
49
|
+
@stripper = "#{@home}/stripper#{bat_ext}"
|
50
|
+
@tdsi = "#{@home}/tdsi#{bat_ext}"
|
51
|
+
@asm_swc = "#{@home}/apparat-asm-#{apparat_version}.swc"
|
52
|
+
@ersatz_swc = "#{@home}/apparat-ersatz-#{apparat_version}.swc"
|
53
|
+
@lzma_decoder_swc = "#{@home}/apparat-lzma-decoder-#{apparat_version}.swc"
|
54
|
+
end
|
53
55
|
end
|
54
|
-
|
55
|
-
|
56
|
-
include Extension
|
56
|
+
module Tasks
|
57
|
+
include Extension
|
57
58
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
59
|
+
first_time do
|
60
|
+
Project.local_task('apparat_tdsi')
|
61
|
+
Project.local_task('apparat_reducer')
|
62
|
+
end
|
62
63
|
|
63
|
-
|
64
|
-
|
64
|
+
before_define do |project|
|
65
|
+
end
|
65
66
|
|
66
|
-
|
67
|
-
|
67
|
+
after_define do |project|
|
68
|
+
end
|
68
69
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
70
|
+
def apparat_tdsi(options = {})
|
71
|
+
output = Buildr::AS3::Compiler::CompilerUtils::get_output(project,compile.target,compile.packaging,compile.options)
|
72
|
+
apparat_tk = compile.options[:apparat]
|
73
|
+
cmd_args = []
|
74
|
+
cmd_args << apparat_tk.tdsi
|
75
|
+
cmd_args << "-i #{output}"
|
76
|
+
cmd_args << "-o #{output}"
|
77
|
+
reserved = []
|
78
|
+
options.to_hash.reject { |key, value| reserved.include?(key) }.
|
79
|
+
each do |key, value|
|
80
|
+
cmd_args << "-#{key} #{value}"
|
81
|
+
end
|
82
|
+
system(cmd_args.join " ")
|
79
83
|
end
|
80
|
-
system(cmd_args.join " ")
|
81
|
-
end
|
82
84
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
85
|
+
def apparat_reducer(quality)
|
86
|
+
output = Buildr::AS3::Compiler::CompilerUtils::get_output(project,compile.target,compile.packaging,compile.options)
|
87
|
+
apparat_tk = compile.options[:apparat]
|
88
|
+
cmd_args = []
|
89
|
+
cmd_args << apparat_tk.reducer
|
90
|
+
cmd_args << "-i #{output}"
|
91
|
+
cmd_args << "-o #{output}"
|
92
|
+
cmd_args << "-q"
|
93
|
+
cmd_args << quality || 100
|
94
|
+
system(cmd_args.join " ")
|
95
|
+
end
|
92
96
|
end
|
93
97
|
end
|
94
98
|
end
|
95
99
|
class Project
|
96
|
-
include Buildr::AS3::Apparat
|
100
|
+
include Buildr::AS3::Apparat::Tasks
|
97
101
|
end
|
98
102
|
end
|
data/lib/buildr/as3/compiler.rb
CHANGED
@@ -104,7 +104,7 @@ module Buildr
|
|
104
104
|
cmd_args << "-load-config" << flex_sdk.flex_config
|
105
105
|
cmd_args << "-source-path" << sources.join(" ")
|
106
106
|
cmd_args << "-library-path+=#{dependencies.join(",")}" unless dependencies.empty?
|
107
|
-
reserved = [:flexsdk,:main]
|
107
|
+
reserved = [:flexsdk,:main,:apparat]
|
108
108
|
options.to_hash.reject { |key, value| reserved.include?(key) }.
|
109
109
|
each do |key, value|
|
110
110
|
cmd_args << "-#{key}=#{value}"
|
@@ -148,7 +148,7 @@ module Buildr
|
|
148
148
|
cmd_args << "-load-config" << flex_sdk.air_config
|
149
149
|
cmd_args << "-source-path" << sources.join(" ")
|
150
150
|
cmd_args << "-library-path+=#{dependencies.join(",")}" unless dependencies.empty?
|
151
|
-
reserved = [:flexsdk,:main]
|
151
|
+
reserved = [:flexsdk,:main,:apparat]
|
152
152
|
options.to_hash.reject { |key, value| reserved.include?(key) }.
|
153
153
|
each do |key, value|
|
154
154
|
cmd_args << "-#{key}=#{value}"
|
@@ -186,7 +186,7 @@ module Buildr
|
|
186
186
|
cmd_args << "-load-config" << flex_sdk.flex_config
|
187
187
|
cmd_args << "-include-sources" << sources.join(" ")
|
188
188
|
cmd_args << "-library-path+=#{dependencies.join(",")}" unless dependencies.empty?
|
189
|
-
reserved = [:flexsdk
|
189
|
+
reserved = [:flexsdk,:main,:apparat]
|
190
190
|
options.to_hash.reject { |key, value| reserved.include?(key) }.
|
191
191
|
each do |key, value|
|
192
192
|
cmd_args << "-#{key}=#{value}"
|
@@ -225,7 +225,7 @@ module Buildr
|
|
225
225
|
cmd_args << "+configname" << "air"
|
226
226
|
cmd_args << "-include-sources" << sources.join(" ")
|
227
227
|
cmd_args << "-library-path+=#{dependencies.join(",")}" unless dependencies.empty?
|
228
|
-
reserved = [:flexsdk
|
228
|
+
reserved = [:flexsdk,:main,:apparat]
|
229
229
|
options.to_hash.reject { |key, value| reserved.include?(key) }.
|
230
230
|
each do |key, value|
|
231
231
|
cmd_args << "-#{key}=#{value}"
|
data/lib/buildr/as3/flexsdk.rb
CHANGED
@@ -21,45 +21,47 @@
|
|
21
21
|
#
|
22
22
|
module Buildr
|
23
23
|
module AS3
|
24
|
-
|
25
|
-
|
26
|
-
attr_reader :home, :mxmlc_jar, :compc_jar, :asdoc_jar, :fcsh_jar, :flex_config,
|
27
|
-
:asdoc_templates, :default_options, :air_config, :bin
|
28
|
-
|
29
|
-
attr_writer :flex_config, :air_config, :asdoc_templates
|
30
|
-
|
31
|
-
def initialize(sdk_opts = {})
|
24
|
+
module Flex
|
25
|
+
class FlexSDK
|
32
26
|
|
33
|
-
|
27
|
+
attr_reader :home, :mxmlc_jar, :compc_jar, :asdoc_jar, :fcsh_jar, :flex_config,
|
28
|
+
:asdoc_templates, :default_options, :air_config, :bin
|
34
29
|
|
35
|
-
|
36
|
-
|
37
|
-
sdk_zip = Buildr::artifact("com.adobe.flex:sdk:zip:#{sdk_opts[:sdk_version]}").from(Buildr::download(sdk_opts[:sdk_url]))
|
38
|
-
sdk_zip.invoke unless File.exists? sdk_zip.to_s
|
39
|
-
sdk_dir = File.join(File.dirname(sdk_zip.to_s), "sdk-#{sdk_opts[:sdk_version]}")
|
30
|
+
attr_writer :flex_config, :air_config, :asdoc_templates
|
40
31
|
|
41
|
-
|
42
|
-
|
43
|
-
|
32
|
+
def initialize(sdk_opts = {})
|
33
|
+
|
34
|
+
@default_options = {}
|
35
|
+
|
36
|
+
generate_url(sdk_opts)
|
37
|
+
|
38
|
+
sdk_zip = Buildr::artifact("com.adobe.flex:sdk:zip:#{sdk_opts[:sdk_version]}").from(Buildr::download(sdk_opts[:sdk_url]))
|
39
|
+
sdk_zip.invoke unless File.exists? sdk_zip.to_s
|
40
|
+
sdk_dir = File.join(File.dirname(sdk_zip.to_s), "sdk-#{sdk_opts[:sdk_version]}")
|
41
|
+
|
42
|
+
unless File.exists? sdk_dir
|
43
|
+
puts "Unzipping FlexSDK, this may take a while."
|
44
|
+
Buildr::unzip("#{sdk_dir}"=>sdk_zip.to_s).target.invoke
|
45
|
+
end
|
46
|
+
|
47
|
+
@home = sdk_dir
|
48
|
+
@mxmlc_jar = "#{@home}/lib/mxmlc.jar"
|
49
|
+
@compc_jar = "#{@home}/lib/compc.jar"
|
50
|
+
@asdoc_jar = "#{@home}/lib/asdoc.jar"
|
51
|
+
@asdoc_templates = "#{@home}/asdoc/templates"
|
52
|
+
@fcsh_jar = "#{@home}/lib/fcsh.jar"
|
53
|
+
@flex_config = "#{@home}/frameworks/flex-config.xml"
|
54
|
+
@air_config = "#{@home}/frameworks/air-config.xml"
|
55
|
+
@bin = "#{@home}/bin"
|
44
56
|
end
|
45
57
|
|
46
|
-
|
47
|
-
@mxmlc_jar = "#{@home}/lib/mxmlc.jar"
|
48
|
-
@compc_jar = "#{@home}/lib/compc.jar"
|
49
|
-
@asdoc_jar = "#{@home}/lib/asdoc.jar"
|
50
|
-
@asdoc_templates = "#{@home}/asdoc/templates"
|
51
|
-
@fcsh_jar = "#{@home}/lib/fcsh.jar"
|
52
|
-
@flex_config = "#{@home}/frameworks/flex-config.xml"
|
53
|
-
@air_config = "#{@home}/frameworks/air-config.xml"
|
54
|
-
@bin = "#{@home}/bin"
|
55
|
-
end
|
58
|
+
protected
|
56
59
|
|
57
|
-
|
60
|
+
def generate_url(opts = {})
|
61
|
+
opts[:sdk_url] ||= "http://fpdownload.adobe.com/pub/flex/sdk/builds/flex#{opts[:sdk_version].split(".")[0]}/flex_sdk_#{opts[:sdk_version]}.zip"
|
62
|
+
end
|
58
63
|
|
59
|
-
def generate_url(opts = {})
|
60
|
-
opts[:sdk_url] ||= "http://fpdownload.adobe.com/pub/flex/sdk/builds/flex#{opts[:sdk_version].split(".")[0]}/flex_sdk_#{opts[:sdk_version]}.zip"
|
61
64
|
end
|
62
|
-
|
63
65
|
end
|
64
66
|
end
|
65
67
|
end
|
data/lib/buildr/as3.rb
CHANGED
@@ -24,4 +24,7 @@ require "#{File.dirname(__FILE__)}/as3/packaging"
|
|
24
24
|
require "#{File.dirname(__FILE__)}/as3/flexsdk"
|
25
25
|
require "#{File.dirname(__FILE__)}/as3/doc"
|
26
26
|
require "#{File.dirname(__FILE__)}/as3/alchemy"
|
27
|
-
require "#{File.dirname(__FILE__)}/as3/apparat"
|
27
|
+
require "#{File.dirname(__FILE__)}/as3/apparat"
|
28
|
+
include Buildr::AS3::Flex
|
29
|
+
include Buildr::AS3::Apparat
|
30
|
+
include Buildr::AS3::Alchemy
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: buildr-as3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 9
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 9
|
10
|
+
version: 0.1.9
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Dominic Graefen
|